Skip to content

Commit

Permalink
feat(jest-runner): support mutation switching (#2350)
Browse files Browse the repository at this point in the history
Add mutation switching support (new test runner API) for `@stryker-mutator/jest-runner`.

* Implement new test runner interface in `@stryker-mutator/jest-runner`.
* Add `sandboxFileName` to `RunOptions` and use that in the jest runner to provide the "fileNameUnderTest"
* Enable 3 jest e2e tests
* Add support for `.tsx` files to `@stryker-mutator/instrumenter`
  • Loading branch information
nicojs committed Aug 5, 2020
1 parent d8b368d commit 9e6e6e0
Show file tree
Hide file tree
Showing 48 changed files with 7,518 additions and 12,593 deletions.
5 changes: 4 additions & 1 deletion e2e/tasks/run-e2e-tests.ts
Expand Up @@ -21,7 +21,10 @@ const mutationSwitchingTempWhiteList = [
'babel-transpiling',
'typescript-transpiling',
'command',
'vue-cli-typescript-mocha'
'vue-cli-typescript-mocha',
'jest-react-ts',
'jest-node',
'jest-with-ts'
]

function runE2eTests() {
Expand Down
5 changes: 2 additions & 3 deletions e2e/test/jest-node/stryker.conf.json
@@ -1,11 +1,10 @@
{
"$schema": "https://raw.githubusercontent.com/stryker-mutator/stryker/master/packages/api/schema/stryker-core.json",
"$schema": "../../node_modules/@stryker-mutator/core/schema/stryker-schema.json",
"mutator": "javascript",
"packageManager": "npm",
"testRunner": "jest",
"tempDirName": "stryker-tmp",
"transpilers": [],
"concurrency": 2,
"concurrency": 1,
"coverageAnalysis": "off",
"reporters": [
"clear-text",
Expand Down
4 changes: 0 additions & 4 deletions e2e/test/jest-react-ts/b.js

This file was deleted.

8 changes: 5 additions & 3 deletions e2e/test/jest-react-ts/stryker.conf.json
@@ -1,6 +1,5 @@
{
"$schema": "https://raw.githubusercontent.com/stryker-mutator/stryker/master/packages/api/schema/stryker-core.json",
"mutator": "typescript",
"$schema": "../../node_modules/@stryker-mutator/core/schema/stryker-schema.json",
"packageManager": "npm",
"testRunner": "jest",
"tempDirName": "stryker-tmp",
Expand All @@ -11,7 +10,10 @@
"concurrency": 2,
"coverageAnalysis": "off",
"reporters": [
"event-recorder"
"event-recorder",
"progress",
"clear-text",
"html"
],
"jest": {
"projectType": "create-react-app"
Expand Down
6 changes: 3 additions & 3 deletions e2e/test/jest-react-ts/verify/verify.ts
Expand Up @@ -3,9 +3,9 @@ import { expectMetrics } from '../../../helpers';
describe('After running stryker on jest-react project', () => {
it('should report expected scores', async () => {
await expectMetrics({
survived: 45,
killed: 46,
timeout: 5,
survived: 53,
killed: 53,
timeout: 6,
noCoverage: 0
});
});
Expand Down
52 changes: 40 additions & 12 deletions e2e/test/jest-react/.babelrc
@@ -1,20 +1,48 @@
{
"presets": [
["es2015", {"modules": false}],
"react"
[
"@babel/env",
{
"loose": true,
"shippedProposals": true,
"modules": "commonjs",
"targets": {
"ie": 9
}
}
],
"@babel/react"
],
"plugins": [
"transform-object-rest-spread"
"@babel/plugin-proposal-export-default-from",
"@babel/plugin-proposal-export-namespace-from",
"@babel/plugin-transform-runtime",
"@babel/plugin-proposal-object-rest-spread"
],
"env": {
"lib-dir": {
"plugins": ["transform-es2015-modules-commonjs"]
},
"webpack": {
"plugins": ["transform-es2015-modules-commonjs"]
},
"test": {
"plugins": ["transform-es2015-modules-commonjs"]
"esm-dir": {
"presets": [
[
"@babel/env",
{
"loose": true,
"shippedProposals": true,
"modules": false,
"targets": {
"ie": 9
}
}
],
"@babel/react"
],
"plugins": [
[
"@babel/plugin-transform-runtime",
{
"useESModules": true
}
]
]
}
}
}
}

0 comments on commit 9e6e6e0

Please sign in to comment.