esprima-fb
Advanced tools
Comparing version 8001.1001.0-dev-harmony-fb to 8001.2001.0-dev-harmony-fb
@@ -10,3 +10,3 @@ { | ||
}, | ||
"version": "8001.1001.0-dev-harmony-fb", | ||
"version": "8001.2001.0-dev-harmony-fb", | ||
"files": [ | ||
@@ -47,7 +47,8 @@ "bin", | ||
"eslint": "~0.1.0", | ||
"istanbul": "~0.1.27", | ||
"istanbul": "~0.2.6", | ||
"complexity-report": "~0.6.1", | ||
"regenerate": "~0.5.4", | ||
"unicode-6.3.0": "~0.1.0", | ||
"json-diff": "~0.3.1" | ||
"json-diff": "~0.3.1", | ||
"commander": "~2.5.0" | ||
}, | ||
@@ -59,3 +60,3 @@ "scripts": { | ||
"analyze-coverage": "node node_modules/istanbul/lib/cli.js cover test/runner.js", | ||
"check-coverage": "node node_modules/istanbul/lib/cli.js check-coverage --statement -11 --branch -30 --function 99.69", | ||
"check-coverage": "node node_modules/istanbul/lib/cli.js check-coverage --statement 100 --branch 100 --function 100", | ||
"complexity": "npm run-script analyze-complexity && npm run-script check-complexity", | ||
@@ -62,0 +63,0 @@ "analyze-complexity": "node tools/list-complexity.js", |
@@ -18,3 +18,4 @@ **Esprima** ([esprima.org](http://esprima.org), BSD license) is a high performance, | ||
- Optional tracking of syntax node location (index-based and line-column) | ||
- [Heavily tested](https://travis-ci.org/facebook/esprima) (> 600 unit tests with solid statement and branch coverage) | ||
- Heavily tested (> 650 [unit tests](http://esprima.org/test/) with [full code coverage](http://esprima.org/test/coverage.html)) | ||
- Ongoing support for ES6/Harmony (module, class, destructuring, ...) | ||
@@ -21,0 +22,0 @@ ### Versioning rules |
@@ -112,3 +112,3 @@ /* | ||
function testParse(esprima, code, syntax) { | ||
function testParse(esprima, code, syntax, testOptions) { | ||
'use strict'; | ||
@@ -127,3 +127,4 @@ var expected, tree, actual, options, StringObject, i, len, err; | ||
tolerant: (typeof syntax.errors !== 'undefined'), | ||
source: null | ||
source: null, | ||
sourceType: testOptions.sourceType | ||
}; | ||
@@ -220,3 +221,3 @@ | ||
function testTokenize(esprima, code, tokens) { | ||
function testTokenize(esprima, code, tokens, testOptions) { | ||
'use strict'; | ||
@@ -229,3 +230,4 @@ var options, expected, actual, tree; | ||
loc: true, | ||
range: true | ||
range: true, | ||
sourceType: testOptions.sourceType | ||
}; | ||
@@ -246,12 +248,13 @@ | ||
function testError(esprima, code, exception) { | ||
function testError(esprima, code, exception, testOptions) { | ||
'use strict'; | ||
var i, options, expected, actual, err, handleInvalidRegexFlag, tokenize; | ||
var i, options, expected, actual, err, handleInvalidRegexFlag, tokenize, | ||
sourceType; | ||
// Different parsing options should give the same error. | ||
options = [ | ||
{}, | ||
{ comment: true }, | ||
{ raw: true }, | ||
{ raw: true, comment: true } | ||
{ sourceType: testOptions.sourceType }, | ||
{ sourceType: testOptions.sourceType, comment: true }, | ||
{ sourceType: testOptions.sourceType, raw: true }, | ||
{ sourceType: testOptions.sourceType, raw: true, comment: true } | ||
]; | ||
@@ -326,12 +329,12 @@ | ||
function runTest(esprima, code, result) { | ||
function runTest(esprima, code, result, options) { | ||
'use strict'; | ||
if (result.hasOwnProperty('lineNumber')) { | ||
testError(esprima, code, result); | ||
testError(esprima, code, result, options); | ||
} else if (result.hasOwnProperty('result')) { | ||
testAPI(esprima, code, result); | ||
} else if (result instanceof Array) { | ||
testTokenize(esprima, code, result); | ||
testTokenize(esprima, code, result, options); | ||
} else { | ||
testParse(esprima, code, result); | ||
testParse(esprima, code, result, options); | ||
} | ||
@@ -417,2 +420,3 @@ } | ||
if (testFixture.hasOwnProperty(category)) { | ||
var categoryOptions = testFixtureOptions[category] || {}; | ||
startCategory(category); | ||
@@ -422,6 +426,12 @@ fixture = testFixture[category]; | ||
if (fixture.hasOwnProperty(source)) { | ||
var sourceOptions = | ||
categoryOptions.hasOwnProperty(source) | ||
? categoryOptions[source] | ||
: categoryOptions; | ||
expected = fixture[source]; | ||
total += 1; | ||
try { | ||
runTest(esprima, source, expected); | ||
runTest(esprima, source, expected, sourceOptions); | ||
reportSuccess(source, JSON.stringify(expected, null, 4)); | ||
@@ -468,3 +478,8 @@ } catch (e) { | ||
Object.keys(testFixture).forEach(function (category) { | ||
var categoryOptions = testFixtureOptions[category] || {}; | ||
Object.keys(testFixture[category]).forEach(function (source) { | ||
var sourceOptions = | ||
categoryOptions.hasOwnProperty(source) | ||
? categoryOptions[source] | ||
: categoryOptions; | ||
total += 1; | ||
@@ -476,3 +491,3 @@ expected = testFixture[category][source]; | ||
try { | ||
runTest(esprima, source, expected); | ||
runTest(esprima, source, expected, sourceOptions); | ||
} catch (e) { | ||
@@ -479,0 +494,0 @@ e.source = source; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
1088874
30262
33
8