forked from js-temporal/temporal-polyfill
-
Notifications
You must be signed in to change notification settings - Fork 0
/
runtest262.mjs
51 lines (45 loc) · 1.87 KB
/
runtest262.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import runTest262 from '@js-temporal/temporal-test262-runner';
import yargs from 'yargs';
import * as process from 'process';
import { hideBin } from 'yargs/helpers';
const isProduction = process.env.NODE_ENV === 'production';
const isTranspiledBuild = !!process.env.TRANSPILE;
const timeoutMsecs = process.env.TIMEOUT || 30000;
yargs(hideBin(process.argv))
.command(
'*',
'Run test262 tests',
(builder) => {
builder.option('update-expected-failure-files', {
requiresArg: false,
default: false,
type: 'boolean',
description: 'Whether to update the existing expected-failure files on-disk and remove tests that now pass.'
});
},
(parsedArgv) => {
const expectedFailureFiles = ['test/expected-failures.txt'];
if (isProduction) {
expectedFailureFiles.push(
isTranspiledBuild ? 'test/expected-failures-es5.txt' : 'test/expected-failures-opt.txt'
);
}
const nodeVersion = parseInt(process.versions.node.split('.')[0]);
if (nodeVersion < 18) expectedFailureFiles.push('test/expected-failures-before-node18.txt');
if (nodeVersion < 16) expectedFailureFiles.push('test/expected-failures-before-node16.txt');
// Eventually this should be fixed and this condition should be updated.
if (nodeVersion >= 18) expectedFailureFiles.push('test/expected-failures-cldr42.txt');
// As we migrate commits from proposal-temporal, remove expected failures from here.
expectedFailureFiles.push('test/expected-failures-todo-migrated-code.txt');
const result = runTest262({
test262Dir: 'test262',
polyfillCodeFile: 'dist/script.js',
expectedFailureFiles,
testGlobs: parsedArgv._,
timeoutMsecs,
updateExpectedFailureFiles: parsedArgv.updateExpectedFailureFiles
});
process.exit(result ? 0 : 1);
}
)
.help().argv;