Parser fails on certain files
See original GitHub issueSummary
I was trying to implement Stryker for one of our repos to see if it was easy to do. Sadly, I’ve had no luck so far. I ran into two issues: the first one is that the parser crashes on certain files. But the error stacktrace is not helpful (for an end user), because it starts and ends within the node modules.
This is the Stryker output for such an error:
$ stryker run
[2018-02-07 08:46:56.360] [INFO] ConfigReader - Using stryker.conf.js in the current working directory.
[2018-02-07 08:46:57.104] [INFO] InputFileResolver - Found 1 of 161 file(s) to be mutated.
[2018-02-07 08:46:57.105] [INFO] InitialTestExecutor - Starting initial test run. This may take a while.
[2018-02-07 08:46:57.106] [INFO] BabelConfigReader - Reading .babelrc file from path "/Users/ronderksen/Sites/blaze-wishlist-site-wehkamp/.babelrc"
[2018-02-07 08:47:13.505] [INFO] InitialTestExecutor - Initial test run succeeded. Ran 118 tests in 16 seconds.
[2018-02-07 08:47:13.509] [ERROR] StrykerCli - an error occurred { SyntaxError: Unexpected token (37:6)
at Parser.pp$5.raise (/Users/ronderksen/Sites/blaze-wishlist-site-wehkamp/node_modules/babylon/lib/index.js:4454:13)
at Parser.pp.unexpected (/Users/ronderksen/Sites/blaze-wishlist-site-wehkamp/node_modules/babylon/lib/index.js:1761:8)
at Parser.pp$3.parseIdentifier (/Users/ronderksen/Sites/blaze-wishlist-site-wehkamp/node_modules/babylon/lib/index.js:4332:10)
at Parser.pp$3.parsePropertyName (/Users/ronderksen/Sites/blaze-wishlist-site-wehkamp/node_modules/babylon/lib/index.js:4156:96)
at Parser.parsePropertyName (/Users/ronderksen/Sites/blaze-wishlist-site-wehkamp/node_modules/babylon/lib/index.js:6229:23)
at Parser.pp$3.parseObj (/Users/ronderksen/Sites/blaze-wishlist-site-wehkamp/node_modules/babylon/lib/index.js:4045:12)
at Parser.pp$3.parseExprAtom (/Users/ronderksen/Sites/blaze-wishlist-site-wehkamp/node_modules/babylon/lib/index.js:3719:19)
at Parser.parseExprAtom (/Users/ronderksen/Sites/blaze-wishlist-site-wehkamp/node_modules/babylon/lib/index.js:7238:22)
at Parser.pp$3.parseExprSubscripts (/Users/ronderksen/Sites/blaze-wishlist-site-wehkamp/node_modules/babylon/lib/index.js:3494:19)
at Parser.pp$3.parseMaybeUnary (/Users/ronderksen/Sites/blaze-wishlist-site-wehkamp/node_modules/babylon/lib/index.js:3474:19)
at Parser.pp$3.parseExprOps (/Users/ronderksen/Sites/blaze-wishlist-site-wehkamp/node_modules/babylon/lib/index.js:3404:19)
at Parser.pp$3.parseMaybeConditional (/Users/ronderksen/Sites/blaze-wishlist-site-wehkamp/node_modules/babylon/lib/index.js:3381:19)
at Parser.pp$3.parseMaybeAssign (/Users/ronderksen/Sites/blaze-wishlist-site-wehkamp/node_modules/babylon/lib/index.js:3344:19)
at Parser.parseMaybeAssign (/Users/ronderksen/Sites/blaze-wishlist-site-wehkamp/node_modules/babylon/lib/index.js:6474:20)
at Parser.pp$3.parseParenAndDistinguishExpression (/Users/ronderksen/Sites/blaze-wishlist-site-wehkamp/node_modules/babylon/lib/index.js:3828:26)
at Parser.pp$3.parseExprAtom (/Users/ronderksen/Sites/blaze-wishlist-site-wehkamp/node_modules/babylon/lib/index.js:3709:19) pos: 1631, loc: Position { line: 37, column: 6 } }
Stryker config
const path = require('path');
module.exports = function(config) {
config.set({
files: [
{
pattern: 'src/app/path/to/file.js',
mutated: true,
included: false,
},
'src/public/**/*',
'src/app/**/*.scss',
'src/app/**/path/to/file.spec.js',
'src/app/**/path/to/file.spec.js.snap',
'src/**/*',
'test/*',
'development/*',
],
testRunner: 'jest',
mutator: 'javascript',
transpilers: ['babel'],
reporter: ['html', 'clear-text', 'progress'],
coverageAnalysis: 'off',
babelrcFile: '.babelrc',
jest: {
config: require(path.resolve(__dirname, './test/jest.config.json')),
},
});
};
Stryker environment
├─┬ stryker@0.18.2
├─┬ stryker-api@0.12.0
├─┬ stryker-babel-transpiler@0.2.4
├─┬ stryker-html-reporter@0.11.5
├─┬ stryker-javascript-mutator@0.3.3
├─┬ stryker-jest-runner@0.4.0
├─┬ stryker-webpack-transpiler@0.1.2
Your Environment
software | version(s) |
---|---|
node | v8.9.4 |
npm | v.5.5.1 |
Operating System | macOS 10.13.2 |
Issue Analytics
- State:
- Created 6 years ago
- Comments:11 (6 by maintainers)
Top Results From Across the Web
File upload or parsing fails - IBM
When you attempt to upload an event file or a parameter file, the upload or parse fails. Event and parameter files must be...
Read more >Parse Error: What It Is and How to Fix It - Lifewire
A parse error is an error message you sometimes get on Android devices when an app fails to install. The message itself is...
Read more >Corrupt File In Relation to Parser Error [SOLVED]
Error 0x80070570: The file or directory is corrupted and unreadable." I have attempted to boot up in Safe Mode to complete the renaming,...
Read more >Parse error of some documents (not all) #447 - GitHub
I do get an error by comsuming some documents. In the log file I got the following message: PARSE FAILURE for /home/paperless/consume/20181201132749Z ...
Read more >Unable to Parse Error - When opening Tag Manager - DocMoto
Generally the reason for the 'unable to parse' error is because the .xml files in the Meta Tags folder are checked out on...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@ronderksen thanks for the clear reproduction steps. It seems that we don’t support the
objectRestSpread
yet. See list of plugins here: https://github.com/babel/babel/tree/master/packages/babylon#pluginsI will add it (and some more stage 1, 2 and 3 features) to the default list of plugins. At a later time we should make this part configurable.
Glad to hear that the problem has been solved! We usually reply to issues like these with a message which version of which plugin fixed the issue.
So you should have seen something like “This has been fixed with stryker-javascript-mutator 0.4.0” but we forgot that this time 😦
Thanks for creating a reproduction repo! Those really help us a lot 😃 If you need any more help, don’t hesitate to contact us!