Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: test/browser/_bootstrap.js

Issue 29874649: Issue 6822 - Report browser test errors (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: throw instead of Promise.reject() Created Sept. 21, 2018, 3:39 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | test/runners/chromium_process.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-present eyeo GmbH 3 * Copyright (C) 2006-present eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 28 matching lines...) Expand all
39 39
40 let tests = {}; 40 let tests = {};
41 for (let module of moduleNames) 41 for (let module of moduleNames)
42 tests[module] = nodeunit.testCase(require("./" + module + ".js")); 42 tests[module] = nodeunit.testCase(require("./" + module + ".js"));
43 43
44 return new Promise((resolve, reject) => 44 return new Promise((resolve, reject) =>
45 { 45 {
46 nodeunit.runModules(tests, { 46 nodeunit.runModules(tests, {
47 moduleStart(name) 47 moduleStart(name)
48 { 48 {
49 if (typeof window._consoleLogs == "undefined")
50 window._consoleLogs = {failures: 0, log: []};
49 console.log(bold(name)); 51 console.log(bold(name));
50 }, 52 },
51 testDone(name, assertions) 53 testDone(name, assertions)
52 { 54 {
53 let errors = assertions.filter(assertion => assertion.failed()) 55 let errors = assertions.filter(assertion => assertion.failed())
54 .map(assertion => assertion.error); 56 .map(assertion => assertion.error);
55 57
56 if (errors.length == 0) 58 if (errors.length == 0)
57 console.log("\u2714 " + name); 59 console.log("\u2714 " + name);
58 else 60 else
59 { 61 {
60 console.log(error("\u2716 " + name) + "\n"); 62 console.log(error("\u2716 " + name) + "\n");
61 errors.forEach(e => 63 errors.forEach(e =>
62 { 64 {
63 if (e.stack) 65 if (e.stack)
64 console.log(e.stack); 66 console.log(e.stack);
65 else 67 else
66 console.log(String(e)); 68 console.log(String(e));
67 console.log(""); 69 console.log("");
68 }); 70 });
69 } 71 }
70 }, 72 },
71 done(assertions) 73 done(assertions)
72 { 74 {
73 let failures = assertions.filter(assertion => assertion.failed()); 75 let failures = assertions.filter(assertion => assertion.failed());
74 if (failures.length) 76 if (failures.length)
75 { 77 {
78 window._consoleLogs.failures += failures.length;
76 console.log( 79 console.log(
77 "\n" + 80 "\n" +
78 bold(error("FAILURES: ")) + 81 bold(error("FAILURES: ")) +
79 failures.length + "/" + assertions.length + " assertions failed" 82 failures.length + "/" + assertions.length + " assertions failed"
80 ); 83 );
81 } 84 }
82 else 85 else
83 { 86 {
84 console.log( 87 console.log(
85 "\n" + bold(ok("OK: ")) + 88 `\n ${bold(ok("OK: "))}${assertions.length} assertions (${assertions .duration}ms)`
86 assertions.length + " assertions"
87 ); 89 );
88 } 90 }
89 91
90 resolve(); 92 resolve();
91 } 93 }
92 }); 94 });
93 }); 95 });
94 } 96 }
95 97
96 module.exports = runTests; 98 module.exports = runTests;
OLDNEW
« no previous file with comments | « no previous file | test/runners/chromium_process.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld