stryker-js: npx stryker run with Jest does not work
Summary
I was running the 0.34.x version previously in my project. I have since removed all traces to stryker, installed the new @stryker-mutator/core and proceeded to use the npx stryker init to install the dependencies and try to get stryker working in my environment with Jest and Yarn.
While my Jest tests all run normally, I get errors running stryker: npx stryker run stryker.conf.js. The error indicates that test files were not found.
11:49:51 (11656) WARN ChildProcessProxy Child process [pid 13664] exited unexpectedly with exit code 1 (without signal). Last part of stdout and stderr was:
No tests found, exiting with code 1
Run with --passWithNoTests
to exit with code 0
No files found in C:\Users\stevens\Development\TestScripts\Emulator.stryker-tmp\sandbox1586172.
Make sure Jest’s configuration does not exclude this directory.
To set up Jest, make sure a package.json file exists.
Jest Documentation: facebook.github.io/jest/docs/configuration.html
Pattern: - 0 matches
Stryker config
module.exports = function(config) {
config.set({
mutator: "typescript",
packageManager: "yarn",
reporters: ["html", "clear-text", "progress"],
testRunner: "jest",
transpilers: ["typescript"],
coverageAnalysis: "off",
tsconfigFile: "tsconfig.json",
mutate: [
"src/**/*.ts",
"!src/**/*.spec.ts"
],
htmlReporter: {
baseDir: 'docs/mutation'
}
});
};
Stryker environment
$ yarn list |grep stryker
├─ @stryker-mutator/api@1.1.0
├─ @stryker-mutator/core@1.1.0
│ ├─ @stryker-mutator/api@^1.1.0
│ ├─ @stryker-mutator/util@^1.1.0
├─ @stryker-mutator/html-reporter@1.1.0
│ ├─ @stryker-mutator/api@^1.1.0
│ ├─ @stryker-mutator/util@^1.1.0
├─ @stryker-mutator/jest-runner@1.1.0
│ ├─ @stryker-mutator/api@^1.1.0
├─ @stryker-mutator/typescript@1.1.0
│ ├─ @stryker-mutator/api@^1.1.0
│ ├─ @stryker-mutator/util@^1.1.0
├─ @stryker-mutator/util@1.1.0
$ yarn list |grep jest
├─ @jest/console@24.3.0
│ ├─ @jest/source-map@^24.3.0
├─ @jest/core@24.5.0
│ ├─ @jest/console@^24.3.0
│ ├─ @jest/reporters@^24.5.0
│ ├─ @jest/test-result@^24.5.0
│ ├─ @jest/transform@^24.5.0
│ ├─ @jest/types@^24.5.0
│ ├─ jest-changed-files@^24.5.0
│ ├─ jest-config@^24.5.0
│ ├─ jest-haste-map@^24.5.0
│ ├─ jest-message-util@^24.5.0
│ ├─ jest-regex-util@^24.3.0
│ ├─ jest-resolve-dependencies@^24.5.0
│ ├─ jest-runner@^24.5.0
│ ├─ jest-runtime@^24.5.0
│ ├─ jest-snapshot@^24.5.0
│ ├─ jest-util@^24.5.0
│ ├─ jest-validate@^24.5.0
│ ├─ jest-watcher@^24.5.0
├─ @jest/environment@24.5.0
│ ├─ @jest/fake-timers@^24.5.0
│ ├─ @jest/transform@^24.5.0
│ ├─ @jest/types@^24.5.0
│ └─ jest-mock@^24.5.0
├─ @jest/fake-timers@24.5.0
│ ├─ @jest/types@^24.5.0
│ ├─ jest-message-util@^24.5.0
│ └─ jest-mock@^24.5.0
├─ @jest/reporters@24.5.0
│ ├─ @jest/environment@^24.5.0
│ ├─ @jest/test-result@^24.5.0
│ ├─ @jest/transform@^24.5.0
│ ├─ @jest/types@^24.5.0
│ ├─ jest-haste-map@^24.5.0
│ ├─ jest-resolve@^24.5.0
│ ├─ jest-runtime@^24.5.0
│ ├─ jest-util@^24.5.0
│ ├─ jest-worker@^24.4.0
├─ @jest/source-map@24.3.0
├─ @jest/test-result@24.5.0
│ ├─ @jest/console@^24.3.0
│ ├─ @jest/types@^24.5.0
├─ @jest/transform@24.5.0
│ ├─ @jest/types@^24.5.0
│ ├─ jest-haste-map@^24.5.0
│ ├─ jest-regex-util@^24.3.0
│ ├─ jest-util@^24.5.0
├─ @jest/types@24.5.0
├─ @stryker-mutator/jest-runner@1.1.0
├─ @types/jest-diff@20.0.1
├─ @types/jest@24.0.11
│ └─ @types/jest-diff@*
├─ babel-jest@24.5.0
│ ├─ @jest/transform@^24.5.0
│ ├─ @jest/types@^24.5.0
│ ├─ babel-preset-jest@^24.3.0
├─ babel-plugin-jest-hoist@24.3.0
├─ babel-preset-jest@24.3.0
│ └─ babel-plugin-jest-hoist@^24.3.0
│ ├─ @jest/types@^24.5.0
│ ├─ jest-get-type@^24.3.0
│ ├─ jest-matcher-utils@^24.5.0
│ ├─ jest-message-util@^24.5.0
│ └─ jest-regex-util@^24.3.0
├─ jest-changed-files@24.5.0
│ ├─ @jest/types@^24.5.0
├─ jest-cli@24.5.0
│ ├─ @jest/core@^24.5.0
│ ├─ @jest/test-result@^24.5.0
│ ├─ @jest/types@^24.5.0
│ ├─ jest-config@^24.5.0
│ ├─ jest-util@^24.5.0
│ ├─ jest-validate@^24.5.0
├─ jest-config@24.5.0
│ ├─ @jest/types@^24.5.0
│ ├─ babel-jest@^24.5.0
│ ├─ jest-environment-jsdom@^24.5.0
│ ├─ jest-environment-node@^24.5.0
│ ├─ jest-get-type@^24.3.0
│ ├─ jest-jasmine2@^24.5.0
│ ├─ jest-regex-util@^24.3.0
│ ├─ jest-resolve@^24.5.0
│ ├─ jest-util@^24.5.0
│ ├─ jest-validate@^24.5.0
├─ jest-diff@24.5.0
│ ├─ jest-get-type@^24.3.0
├─ jest-docblock@24.3.0
├─ jest-each@24.5.0
│ ├─ @jest/types@^24.5.0
│ ├─ jest-get-type@^24.3.0
│ ├─ jest-util@^24.5.0
├─ jest-environment-jsdom@24.5.0
│ ├─ @jest/environment@^24.5.0
│ ├─ @jest/fake-timers@^24.5.0
│ ├─ @jest/types@^24.5.0
│ ├─ jest-mock@^24.5.0
│ ├─ jest-util@^24.5.0
├─ jest-environment-node@24.5.0
│ ├─ @jest/environment@^24.5.0
│ ├─ @jest/fake-timers@^24.5.0
│ ├─ @jest/types@^24.5.0
│ ├─ jest-mock@^24.5.0
│ └─ jest-util@^24.5.0
├─ jest-get-type@24.3.0
├─ jest-haste-map@24.5.0
│ ├─ @jest/types@^24.5.0
│ ├─ jest-serializer@^24.4.0
│ ├─ jest-util@^24.5.0
│ ├─ jest-worker@^24.4.0
├─ jest-jasmine2@24.5.0
│ ├─ @jest/environment@^24.5.0
│ ├─ @jest/test-result@^24.5.0
│ ├─ @jest/types@^24.5.0
│ ├─ jest-each@^24.5.0
│ ├─ jest-matcher-utils@^24.5.0
│ ├─ jest-message-util@^24.5.0
│ ├─ jest-runtime@^24.5.0
│ ├─ jest-snapshot@^24.5.0
│ ├─ jest-util@^24.5.0
├─ jest-leak-detector@24.5.0
├─ jest-matcher-utils@24.5.0
│ ├─ jest-diff@^24.5.0
│ ├─ jest-get-type@^24.3.0
├─ jest-message-util@24.5.0
│ ├─ @jest/test-result@^24.5.0
│ ├─ @jest/types@^24.5.0
├─ jest-mock@24.5.0
│ └─ @jest/types@^24.5.0
├─ jest-pnp-resolver@1.2.1
├─ jest-regex-util@24.3.0
├─ jest-resolve-dependencies@24.5.0
│ ├─ @jest/types@^24.5.0
│ ├─ jest-regex-util@^24.3.0
│ └─ jest-snapshot@^24.5.0
├─ jest-resolve@24.5.0
│ ├─ @jest/types@^24.5.0
│ ├─ jest-pnp-resolver@^1.2.1
├─ jest-runner@24.5.0
│ ├─ @jest/console@^24.3.0
│ ├─ @jest/environment@^24.5.0
│ ├─ @jest/test-result@^24.5.0
│ ├─ @jest/types@^24.5.0
│ ├─ jest-config@^24.5.0
│ ├─ jest-docblock@^24.3.0
│ ├─ jest-haste-map@^24.5.0
│ ├─ jest-jasmine2@^24.5.0
│ ├─ jest-leak-detector@^24.5.0
│ ├─ jest-message-util@^24.5.0
│ ├─ jest-resolve@^24.5.0
│ ├─ jest-runtime@^24.5.0
│ ├─ jest-util@^24.5.0
│ ├─ jest-worker@^24.4.0
├─ jest-runtime@24.5.0
│ ├─ @jest/console@^24.3.0
│ ├─ @jest/environment@^24.5.0
│ ├─ @jest/source-map@^24.3.0
│ ├─ @jest/transform@^24.5.0
│ ├─ @jest/types@^24.5.0
│ ├─ jest-config@^24.5.0
│ ├─ jest-haste-map@^24.5.0
│ ├─ jest-message-util@^24.5.0
│ ├─ jest-mock@^24.5.0
│ ├─ jest-regex-util@^24.3.0
│ ├─ jest-resolve@^24.5.0
│ ├─ jest-snapshot@^24.5.0
│ ├─ jest-util@^24.5.0
│ ├─ jest-validate@^24.5.0
├─ jest-serializer@24.4.0
├─ jest-snapshot@24.5.0
│ ├─ @jest/types@^24.5.0
│ ├─ jest-diff@^24.5.0
│ ├─ jest-matcher-utils@^24.5.0
│ ├─ jest-message-util@^24.5.0
│ ├─ jest-resolve@^24.5.0
├─ jest-util@24.5.0
│ ├─ @jest/console@^24.3.0
│ ├─ @jest/fake-timers@^24.5.0
│ ├─ @jest/source-map@^24.3.0
│ ├─ @jest/test-result@^24.5.0
│ ├─ @jest/types@^24.5.0
├─ jest-validate@24.5.0
│ ├─ @jest/types@^24.5.0
│ ├─ jest-get-type@^24.3.0
├─ jest-watcher@24.5.0
│ ├─ @jest/test-result@^24.5.0
│ ├─ @jest/types@^24.5.0
│ ├─ jest-util@^24.5.0
├─ jest-worker@24.4.0
├─ jest@24.5.0
│ └─ jest-cli@^24.5.0
│ ├─ @jest/types@^24.5.0
├─ ts-jest@24.0.0
Test runner environment
jest --config jest.config.js --no-cache
module.exports = {
// Indicates whether the coverage information should be collected while executing the test
collectCoverage: true,
// An array of glob patterns indicating a set of files for which coverage information should be collected
collectCoverageFrom: [
'<rootDir>/src/**/*.ts',
'!<rootDir>/src/**/*.mock.ts',
'!<rootDir>/src/**/*.module.ts',
'!<rootDir>/src/**/*.spec.ts',
'!<rootDir>/src/**/*.test.ts',
'!<rootDir>/src/**/*.d.ts',
'!<rootDir>/src/**/__*__/*',
],
// The directory where Jest should output its coverage files
coverageDirectory: "<rootDir>/docs",
// An array of regexp pattern strings used to skip coverage collection
coveragePathIgnorePatterns: [
"\\\\node_modules\\\\"
],
// A list of reporter names that Jest uses when writing coverage reports
coverageReporters: [
"lcov",
"clover"
],
// Make calling deprecated APIs throw helpful error messages
errorOnDeprecated: true,
// A set of global variables that need to be available in all test environments
globals: {
"ts-jest": {
"diagnostics": false,
"tsConfig": "tsconfig.json"
}
},
// An array of file extensions your modules use
moduleFileExtensions: [
"ts",
"tsx",
"js"
],
// A list of paths to directories that Jest should use to search for files in
roots: [
"<rootDir>/src"
],
// The test environment that will be used for testing
testEnvironment: "node",
// The glob patterns Jest uses to detect test files
testMatch: [
"**/*.spec.ts"
],
// A map from regular expressions to paths to transformers
transform: {
"^.+\\.(ts|tsx)$": "ts-jest"
},
// Indicates whether each individual test should be reported during the run
verbose: false
};
Your Environment
software | version(s) |
---|---|
node | 11.6.0 |
npm | 6.5.0-next.0 |
yarn | 1.15.2 |
Operating System | Windows 10 |
Add stryker.log
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 18 (9 by maintainers)
One of the questions during
stryker init
is:That’s where you probably selected
typescript
. Maybe this question should be reworded to:@Chowarmaan would that help you?
@simondel, agree?
Hmmm maybe we should give a warning from the
JestRunner
. Something like: “WARN: You configured the “typescript” transpiler. This is probably not needed since Jest normally takes care of that. Setjest.ignoreTranspilerWarning
totrue
to ignore this warning”Would that help you @Chowarmaan ?
Hi @Chowarmaan thanks for opening this issue.
Could you please remove the
transpilers
part of your stryker.conf.js file and try again? Since your using Jest, it will take care of the typescript transpiling. Stryker doesn’t need to do that for you.@nicojs That corrected my issue. I guess I still flagged the additional transpiler option during the
stryker init
as I did not enter that myself. It has allowed my tests to run again.