Lightweight runner for ECMAScript Temporal's Test262 tests
This package provides a fast way for polyfills of ECMAScript
Temporal
to run Temporal's 6,300+
Test262 tests. Test262 (https://github.com/tc39/test262) is the official
conformance test suite for ECMAScript, and this package quickly runs a subset of
those tests that are specific to Temporal. All Temporal polyfills should pass
Test262.
This runner is much faster than
test262-harness
(the default
Test262 harness) because:
- It runs only 6,300+ Temporal-specific tests, instead of the full suite.
- It pre-parses the Temporal polyfill into a
vm.Script
, instead of
reading and parsing the whole file once for each test like the prelude option
of test262-harness
does.
For code coverage, set the environment variable NODE_V8_COVERAGE
to the path
(relative to the working directory) where coverage metrics should be output.
These can be processed with the c8
tool. NOTE:
as of Node 18.7 there is a memory leak that makes it impossible to run the
entire suite with NODE_V8_COVERAGE, so for code coverage tests you should run it
in chunks.
Example Usage
import runTest262 from 'temporal-test262-runner';
const result = runTest262({
test262Dir: 'test262',
polyfillCodeFile: 'dist/script.js',
expectedFailureFiles: ['test/expected-failures.txt'],
testGlobs: process.argv.slice(2)
});
process.exit(result ? 0 : 1);
Options