# temporal-test262-runner

> Lightweight runner for ECMAScript Temporal's Test262 tests

Latest version **0.4.0** (published 2023-01-03) · BSD-3-Clause license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install temporal-test262-runner
pnpm add temporal-test262-runner
yarn add temporal-test262-runner
bun add temporal-test262-runner
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.4.0 |
| Published | 2023-01-03 |
| First published | 2023-01-03 |
| Weekly downloads | 0 |
| License | BSD-3-Clause |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 18 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Maintainers | justingrant |
| Keywords | temporal, test262 |

## Links

- npm: https://www.npmjs.com/package/temporal-test262-runner
- Repository: https://github.com/js-temporal/temporal-test262-runner
- Homepage: https://github.com/js-temporal/temporal-test262-runner#readme
- Issues: https://github.com/js-temporal/temporal-test262-runner/issues
- npm.io page: https://npm.io/package/temporal-test262-runner

## Dependencies (4)

- [js-yaml](https://npm.io/package/js-yaml.md) ^4.1.0
- [progress](https://npm.io/package/progress.md) ^2.0.3
- [tiny-glob](https://npm.io/package/tiny-glob.md) ^0.2.9
- [ansi-colors](https://npm.io/package/ansi-colors.md) ^4.1.3

## Alternatives

- [localforage](https://npm.io/package/localforage.md) — 6.2M weekly downloads
- [localforage-observable](https://npm.io/package/localforage-observable.md) — 30.8K weekly downloads
- [@y/y](https://npm.io/package/@y/y.md) — 30.1K weekly downloads
- [@metaobjectsdev/render](https://npm.io/package/@metaobjectsdev/render.md) — 3.5K weekly downloads
- [@ledgerhq/coin-algorand](https://npm.io/package/@ledgerhq/coin-algorand.md) — 1.1K weekly downloads

## Recent versions

- 0.4.0 (latest) — 2023-01-03
- 0.3.0 — 2023-01-03
- 0.2.0 — 2023-01-03
- 0.1.0 — 2023-01-03

## README

# Lightweight runner for ECMAScript Temporal's Test262 tests

This package provides a fast way for polyfills of ECMAScript
[`Temporal`](https://github.com/tc39/proposal-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`](https://github.com/bterlson/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`](https://nodejs.org/api/vm.html#class-vmscript), 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`](https://github.com/bcoe/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

```js
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)
});

// if result is `true`, all tests succeeded
process.exit(result ? 0 : 1);
```

## Options

* `polyfillCodeFile: string` - Filename of the Temporal polyfill. Must
  be a single ECMAScript file that contains the Temporal object injected into
  the global namespace, as well as Temporal-related changes polyfilled into
  `Intl` and `Date` built-in objects.
* `test262Dir: string` - Root directory of the test262 submodule repo.
* `testGlobs?: string[]` - If omitted, all tests will be run. This option
  provides glob patterns that specify a subset of tests to be run. Globs are
  resolved relative to `test/**/Temporal/` subdirectories of `test262Dir`. If a
  pattern doesn't match any files relative to `test/**/Temporal/`, it will also
  try to match relative to the current working directory, so that tab completion
  works. Example: `[ 'PlainDateTime/**', 'prototype/with/*.js' ]`
* `expectedFailureFiles?: string[]` Optional array of text filenames
  that each contain a list of test files (relative to the `test` subdirectory
  of `test262Dir`) that are expected to fail. Lines starting with `#` and
  blank lines are ignored. Lines from multiple files will be concatenated and
  de-duped. Example:
  ```
  # https://github.com/tc39/test262/pull/3548
  built-ins/Temporal/Duration/compare/argument-string-negative-fractional-units.js
  built-ins/Temporal/Duration/from/argument-string-negative-fractional-units.js
  ```

---
_Source: https://npm.io/package/temporal-test262-runner · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
