
Security News
ECMAScript 2025 Finalized with Iterator Helpers, Set Methods, RegExp.escape, and More
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.
shift-parser-expectations
Advanced tools
This module provides Shift format ASTs and metadata for the passing (i.e. syntactically valid) tests in test262-parser-tests.
npm install shift-parser-expectations
const file = '0a2fc93b6a63bbd3.js';
const src = fs.readFileSync('node_modules/test262-parser-tests/pass/' + file, 'utf8');
const expectation = fs.readFileSync('node_modules/shift-parser-expectations/expectations/' + file + '-tree.json');
const treeWithLocations = parse('src');
assert.deepEquals(treeWithLocations, JSON.parse(expectation));
Every file f
in test262-parser-tests/pass/
has two corresponding files in expectations/
in this module: one named f-tree.json
and one named f-comments.json
.
The tree
file holds a JSON encoding of Shift AST for the source text in f
, with keys ordered according to the order in the Shift specification, with the first key for a node being an additional 'type' property holding the string name of the node's type and the last key being an additional 'loc' property holding location information for the node.
The comments
file holds a JSON encoding of an array of the comments in the source text in f
in source order, including location information.
The expectations are generated by running node generate-expectations
, which uses shift-parser. It is expected that you will use an in-development version of that project to update expectations files (using npm link shift-parser
), so this project's package.json
does not include shift-parser
even as a dev dependency.
npm install
.npm run build && npm test
.npm run build && npm test
.Copyright 2017 Shape Security, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
FAQs
Shift ASTs for test262-parser-tests
We found that shift-parser-expectations demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.
Security News
A new Node.js homepage button linking to paid support for EOL versions has sparked a heated discussion among contributors and the wider community.
Research
North Korean threat actors linked to the Contagious Interview campaign return with 35 new malicious npm packages using a stealthy multi-stage malware loader.