shapesecurity / shift-parser-js

ECMAScript parser that produces a Shift format AST
http://shift-ast.org/parser.html
Apache License 2.0
251 stars 28 forks source link

Test262 #395

Closed bakkot closed 6 years ago

bakkot commented 6 years ago

This adds test262 as a dev dependency, and asserts that every test in it parses or fails to parse as appropriate.

The bulk of this PR is test expectations. These are split into files for ease of maintenance.

Managing expectations is a lot easier since the project adopted feature flags. Part of the test expectations is a list of flags we expect to indicate syntax which isn't parseable; some of these are parseable despite such a flag, and need to be explicitly whitelisted.

The test runner enforces that expectations are not stale: every named test must exist, and every test which is whitelisted as in the above paragraph must refer to an xfailed feature.

No tests are skipped, nor is a mechanism provided to do so.

Fixes #362.

bakkot commented 6 years ago

Note: this should definitely be up-to-date with the es2016 branch before merging.

bakkot commented 6 years ago

Also, these are added to the default npm run test, which means it takes a lot longer (on my machine, 30 seconds instead of 10). It could be a separate command run by CI, if we want to avoid that.