Closed Lakitna closed 4 years ago
I'll have a look at this issue tomorrow
I can't reproduce this. Running on express crashes with this error:
14:13:35 (26924) ERROR DryRunExecutor One or more tests resulted in an error:
SyntaxError: Invalid or unexpected token
C:\z\github\stryker-mutator\stryker-2\perf\test\express\.stryker-tmp\sandbox4426232\test\app.router.js:690
app.get('/file
^^^^^^
SyntaxError: Invalid or unexpected token
at wrapSafe (internal/modules/cjs/loader.js:1072:16)
at Module._compile (internal/modules/cjs/loader.js:1122:27)
If you then look at the file, (test/app.router.js
), you'll see something interesting:
it('should require a preceding /', function(done){
var app = express();
app.get('/file
There the test ends. End of file.
The problem is with the strip-comments
dependency. I've created an issue: https://github.com/jonschlinkert/strip-comments/issues/60
Disabling stripping of comments solves it:
"sandbox": {
"stripComments": false
}
We're using strip-comments
to remove // @ts-expect-error
or // @ts-check
from test and production code files. This is needed for typescript compilation to work (we're adding // @ts-nocheck
on top of each file, where your own // @ts-expect-error
and // @ts-check
might interfere with). More info: https://github.com/stryker-mutator/stryker/pull/2365
I was hoping that strip comments would (almost) always be safe to do. But I see it has some unfortunate side effects and now this bug. @brodybits isn't happy with this solution either (#2407).
Any ideas on how to solve this issue better would be much appreciated. I'll open a new discussion issue and closing this one for now.
Summary
This is a bug regarding Stryker 4 beta 3.
When instrumenting an object definition with as below:
Stryker throws the following error
This only happens with a URL string (including protocol) that is preceded by an empty string. When the second string does not contain
*://
this does not happen.Additional note. It does not matter if the empty string is nested. The following throws the same error:
Stryker config
Test runner config
Stryker environment
Test runner environment
Your Environment
Add stryker.log
stryker.log