Testing: Rename tests to test folder (so Mocha can auto pick up and can alternatively pass in a specific test as argument)
Maintenance: Add .editorconfig
One fix I wanted to make but didn't (without hearing your feedback) is to add eslint, or at least to make consistent tab/space usage.
Note that this PR reveals there are, as I see it, at least four failing tests (assuming the expect statements reflected your intent as I tried to do):
json6BadTest.js:12 - true is not failing as an object key, though your test seemed to suggest it should fail.
json6BadTest.js:54 - For what should have been a bad value, { a : 'no quote' [1] }, this was received instead: { a: [ 1 ] }.
json6StreamTest.js:40 - Some values were missing when the stream pushed parser.write( 'true false null undefined NaN Infinity' ); (I figured all of these were supposed to make it.)
json6Test.js:126 - In "Basic parsing" -> "Objects" -> "Single-quoted key value with backslash, carriage return, and newline:", an extra letter got stripped out after a backslash, carriage return, newline.
(There may of course be more bugs revealed by bringing up coverage from the current 75% statement coverage.)
Note that I have added Mocha 3, and changed your tests so that they are compatible with the old Node versions your .travis.yml file indicated you were supporting (e.g., removing a few arrow functions and ES6 templates (though I chose to avoid strings in favor of objects which I regular JSON.stringify'ed to take advantage of out-of-the-box IDE syntax highlighting)).
If you'd prefer to drop that old support, I could make the change in .travis.yml and in the engines property I added to package.json.
I did not add nyc in the test script because the latest version I've installed won't work in the older Node environments.
And finally, the reason I moved files from tests to test was so that the test script could use Mocha's default of checking a test folder, while also allowing the same script to be used to pass in individual files, e.g.,
Builds on #23
tests
totest
folder (so Mocha can auto pick up and can alternatively pass in a specific test as argument).editorconfig
One fix I wanted to make but didn't (without hearing your feedback) is to add eslint, or at least to make consistent tab/space usage.
Note that this PR reveals there are, as I see it, at least four failing tests (assuming the
expect
statements reflected your intent as I tried to do):json6BadTest.js:12
-true
is not failing as an object key, though your test seemed to suggest it should fail.json6BadTest.js:54
- For what should have been a bad value,{ a : 'no quote' [1] }
, this was received instead:{ a: [ 1 ] }
.json6StreamTest.js:40
- Some values were missing when the stream pushedparser.write( 'true false null undefined NaN Infinity' );
(I figured all of these were supposed to make it.)json6Test.js:126
- In "Basic parsing" -> "Objects" -> "Single-quoted key value with backslash, carriage return, and newline:", an extra letter got stripped out after a backslash, carriage return, newline.(There may of course be more bugs revealed by bringing up coverage from the current 75% statement coverage.)
Note that I have added Mocha 3, and changed your tests so that they are compatible with the old Node versions your
.travis.yml
file indicated you were supporting (e.g., removing a few arrow functions and ES6 templates (though I chose to avoid strings in favor of objects which I regularJSON.stringify
'ed to take advantage of out-of-the-box IDE syntax highlighting)).If you'd prefer to drop that old support, I could make the change in
.travis.yml
and in theengines
property I added topackage.json
.I did not add
nyc
in thetest
script because the latest version I've installed won't work in the older Node environments.And finally, the reason I moved files from
tests
totest
was so that thetest
script could use Mocha's default of checking atest
folder, while also allowing the same script to be used to pass in individual files, e.g.,npm test -- test/json6Test.js
...will also work.