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

Delta Between Two Patch Sets: test/browser/_bootstrap.js

Issue 29874649: Issue 6822 - Report browser test errors (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Left Patch Set: Created Sept. 4, 2018, 7:03 p.m.
Right 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:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | test/runners/chromium_process.js » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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") 49 if (typeof window._consoleLogs == "undefined")
Manish Jethani 2018/09/05 19:47:21 I have nothing against using strict equality where
hub 2018/09/06 01:00:13 Done.
50 window.consoleLogs = {failures: 0, log: []}; 50 window._consoleLogs = {failures: 0, log: []};
51 console.log(bold(name)); 51 console.log(bold(name));
52 }, 52 },
53 testDone(name, assertions) 53 testDone(name, assertions)
54 { 54 {
55 let errors = assertions.filter(assertion => assertion.failed()) 55 let errors = assertions.filter(assertion => assertion.failed())
56 .map(assertion => assertion.error); 56 .map(assertion => assertion.error);
57 57
58 if (errors.length == 0) 58 if (errors.length == 0)
59 console.log("\u2714 " + name); 59 console.log("\u2714 " + name);
60 else 60 else
61 { 61 {
62 console.log(error("\u2716 " + name) + "\n"); 62 console.log(error("\u2716 " + name) + "\n");
63 errors.forEach(e => 63 errors.forEach(e =>
64 { 64 {
65 if (e.stack) 65 if (e.stack)
66 console.log(e.stack); 66 console.log(e.stack);
67 else 67 else
68 console.log(String(e)); 68 console.log(String(e));
69 console.log(""); 69 console.log("");
70 }); 70 });
71 } 71 }
72 }, 72 },
73 done(assertions) 73 done(assertions)
74 { 74 {
75 let failures = assertions.filter(assertion => assertion.failed()); 75 let failures = assertions.filter(assertion => assertion.failed());
76 if (failures.length) 76 if (failures.length)
77 { 77 {
78 window.consoleLogs.failures += failures.length; 78 window._consoleLogs.failures += failures.length;
79 console.log( 79 console.log(
80 "\n" + 80 "\n" +
81 bold(error("FAILURES: ")) + 81 bold(error("FAILURES: ")) +
82 failures.length + "/" + assertions.length + " assertions failed" 82 failures.length + "/" + assertions.length + " assertions failed"
83 ); 83 );
84 } 84 }
85 else 85 else
86 { 86 {
87 console.log( 87 console.log(
88 "\n" + bold(ok("OK: ")) + 88 `\n ${bold(ok("OK: "))}${assertions.length} assertions (${assertions .duration}ms)`
89 assertions.length + " assertions (" + assertions.duration + "ms)"
90 ); 89 );
91 } 90 }
92 91
93 resolve(); 92 resolve();
94 } 93 }
95 }); 94 });
96 }); 95 });
97 } 96 }
98 97
99 module.exports = runTests; 98 module.exports = runTests;
LEFTRIGHT

Powered by Google App Engine
This is Rietveld