Skip to content

Commit 0bb45dd

Browse files
authored
Return a failing result if any tests unexpectedly pass. (#6)
* Use `npm link` to test the HEAD runner. * Make `npm test` fail if any tests unexpectedly pass.
1 parent 4c545ea commit 0bb45dd

File tree

4 files changed

+7
-34
lines changed

4 files changed

+7
-34
lines changed

index.mjs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -295,8 +295,9 @@ export default function runTest262({ test262Dir, testGlobs, polyfillCodeFile, ex
295295
const elapsed = Number(finish - start) / 1_000_000_000;
296296

297297
print(color.underline('\nSummary of results:'));
298-
298+
let hasFailures = false;
299299
if (failures.length > 0) {
300+
hasFailures = true;
300301
failures.forEach(({ file, error }) => {
301302
print(color.yellow(`\n${color.bold('FAIL')}: ${file}`));
302303
if (error.constructor.name === 'Test262Error') {
@@ -310,6 +311,7 @@ export default function runTest262({ test262Dir, testGlobs, polyfillCodeFile, ex
310311
if (unexpectedPasses.length > 0) {
311312
print(`\n${color.yellow.bold('WARNING:')} Tests passed unexpectedly; remove them from expected-failures.txt?`);
312313
unexpectedPasses.forEach((file) => print(` \u2022 ${file}`));
314+
hasFailures = true;
313315
}
314316

315317
if (longTests.length > 0) {
@@ -325,7 +327,5 @@ export default function runTest262({ test262Dir, testGlobs, polyfillCodeFile, ex
325327
if (expectedFailCount > 0) {
326328
print(color.cyan(` ${expectedFailCount} expected failures`));
327329
}
328-
329-
return failures.length === 0;
330-
// process.exit(failures.length > 0 ? 1 : 0);
330+
return !hasFailures;
331331
}

test/resolve-test.mjs

Lines changed: 0 additions & 8 deletions
This file was deleted.

test/runtest262.mjs

Lines changed: 0 additions & 19 deletions
This file was deleted.

test/test.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ cd test
66
rm -rf temporal-polyfill
77
git clone --recurse-submodules https://github.com/js-temporal/temporal-polyfill.git
88
cd temporal-polyfill
9-
npm i
10-
TEST262=1 npm run build
11-
node --loader ../resolve-test.mjs ../runtest262.mjs
9+
npm i --ignore-scripts --no-audit
10+
npm link ../../ --ignore-scripts --no-audit
11+
npm run test262

0 commit comments

Comments
 (0)