Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(sandbox): support symlinking of node_modules anywhere
Improve the way `symlinkNodeModules` works. With `symlinkNodeModules` (default is `true`), Stryker will symlink your current node_modules inside the sandbox directory it uses during mutation testing. This allows your dependencies to be resolved. However, you might use a [monorepo](https://en.wikipedia.org/wiki/Monorepo) setup (or some other kind), where your `node_modules` might not all reside inside the current working directory (often the _root_ directory). This change allows also `node_modules` inside your child directories to be symlinked. Thanks @wwwzbwcom for contributing this feature! Co-authored-by: Nico Jansen <jansennico@gmail.com>
- Loading branch information
Showing
12 changed files
with
156 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"spec": ["packages/*/test/**/*.js"] | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"name": "mocha-repo", | ||
"version": "0.0.0", | ||
"private": true, | ||
"description": "A module to perform an integration test", | ||
"main": "index.js", | ||
"scripts": { | ||
"postinstall": "node tasks/bootstrap.js", | ||
"pretest": "rimraf \"reports\"", | ||
"test": "stryker run", | ||
"test:unit": "mocha", | ||
"posttest": "mocha --no-config --require ../../tasks/ts-node-register.js verify/*.ts" | ||
}, | ||
"author": "", | ||
"license": "ISC" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
const foo = require('foo'); | ||
|
||
exports.concatWithFoo = (msg) => { | ||
return foo + ': ' + msg; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
const assert = require('assert'); | ||
const app = require('../src/app'); | ||
|
||
describe('app', () => { | ||
it('should concat with foo', () => { | ||
assert.strictEqual(app.concatWithFoo('test'), 'foo: test'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"$schema": "../../node_modules/@stryker-mutator/core/schema/stryker-schema.json", | ||
"testRunner": "mocha", | ||
"concurrency": 2, | ||
"mutate": [ | ||
"packages/*/{src,lib}/**/!(*.+(s|S)pec|*.+(t|T)est).+(cjs|mjs|js|ts|jsx|tsx|html|vue)" | ||
], | ||
"coverageAnalysis": "perTest", | ||
"reporters": ["clear-text", "html", "event-recorder"], | ||
"plugins": [ | ||
"@stryker-mutator/mocha-runner" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
const fooNodeModule = path.resolve(__dirname, '..', 'packages', 'app', 'node_modules', 'foo'); | ||
fs.mkdirSync(fooNodeModule, { recursive: true }); | ||
fs.writeFileSync(path.resolve(fooNodeModule, 'index.js'), 'module.exports = "foo"'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { expectMetrics } from '../../../helpers'; | ||
|
||
describe('Verify stryker has ran correctly', () => { | ||
|
||
it('should report correct score', async () => { | ||
await expectMetrics({ | ||
killed: 2 | ||
}); | ||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters