Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jest rootDir is ignored/replaced #1847

Closed
michael42 opened this issue Nov 13, 2019 · 8 comments · Fixed by #2713
Closed

Jest rootDir is ignored/replaced #1847

michael42 opened this issue Nov 13, 2019 · 8 comments · Fixed by #2713
Labels
🐛 Bug Something isn't working

Comments

@michael42
Copy link

michael42 commented Nov 13, 2019

Summary

When setting a custom rootDir (i.e. src) in the jest.config.js, Stryker seems to override it with the sandbox root path (ignoring the value from jest.config.js). This causes files not be found (because the src/ prefix is missing).

Module tests/setup.ts in the setupFiles option was not found.
       <rootDir> is: [...]/.stryker-tmp/sandbox3026627        // <- should have been [...]/.stryker-tmp/sandbox3026627/src

Stryker config

module.exports = function (config) {
  config.set({
    mutate: ['src/**/*.ts', '!src/**/*.spec.ts'],
    mutator: 'vue',
    testRunner: 'jest',
    reporters: ['progress', 'clear-text', 'html'],
    coverageAnalysis: 'off'
  });
};

Test runner config

jest.config.js:

module.exports = {
  globals: {
    'ts-jest': {
      babelConfig: false,
      tsConfig: {target: 'es2017'},
      diagnostics: { pathRegex: '/\.(spec|test)\.ts$/' }
    },
  },
  rootDir: 'src',
  testMatch: [
    '**/__tests__/**/*.ts?(x)',
    '**/?(*.)spec.ts?(x)'
  ],
  setupFiles: ['tests/setup.ts'],
  setupFilesAfterEnv: ['tests/setupScript.ts'],
  moduleFileExtensions: [
    'ts',
    'tsx',
    'js',
    'jsx',
    'json',
    'vue'
  ],
  transform: {
    '^.+\\.vue$': 'vue-jest',
    '^.+\\.tsx?$': 'ts-jest',
    '.+\\.(css|styl|less|sass|scss)$': 'jest-transform-stub',
  },
};

Stryker environment

│  ├─ @stryker-mutator/[email protected]
│  ├─ @stryker-mutator/[email protected]
│  ├─ @stryker-mutator/[email protected]
│  ├─ @stryker-mutator/[email protected]
│  ├─ @stryker-mutator/[email protected]
│  ├─ @stryker-mutator/[email protected]
│  ├─ @stryker-mutator/[email protected]
│  ├─ @stryker-mutator/[email protected]
│  ├─ @stryker-mutator/[email protected]
├─ @stryker-mutator/[email protected]
├─ @stryker-mutator/[email protected]
│  ├─ @stryker-mutator/api@^2.1.0
│  ├─ @stryker-mutator/util@^2.1.0
├─ @stryker-mutator/[email protected]
│  ├─ @stryker-mutator/api@^2.1.0
│  ├─ @stryker-mutator/util@^2.1.0
├─ @stryker-mutator/[email protected]
│  ├─ @stryker-mutator/api@^2.1.0
├─ @stryker-mutator/[email protected]
│  ├─ @stryker-mutator/api@^2.1.0
│  ├─ @stryker-mutator/util@^2.1.0
├─ @stryker-mutator/[email protected]
├─ @stryker-mutator/[email protected]
│  └─ @stryker-mutator/api@^2.1.0
├─ @jest/[email protected]
│  ├─ @jest/source-map@^24.9.0
├─ @jest/[email protected]
│  ├─ @jest/console@^24.7.1
│  ├─ @jest/reporters@^24.9.0
│  ├─ @jest/test-result@^24.9.0
│  ├─ @jest/transform@^24.9.0
│  ├─ @jest/types@^24.9.0
│  ├─ jest-changed-files@^24.9.0
│  ├─ jest-config@^24.9.0
│  ├─ jest-haste-map@^24.9.0
│  ├─ jest-message-util@^24.9.0
│  ├─ jest-regex-util@^24.3.0
│  ├─ jest-resolve-dependencies@^24.9.0
│  ├─ jest-resolve@^24.9.0
│  ├─ jest-runner@^24.9.0
│  ├─ jest-runtime@^24.9.0
│  ├─ jest-snapshot@^24.9.0
│  ├─ jest-util@^24.9.0
│  ├─ jest-validate@^24.9.0
│  ├─ jest-watcher@^24.9.0
├─ @jest/[email protected]
│  ├─ @jest/fake-timers@^24.9.0
│  ├─ @jest/transform@^24.9.0
│  ├─ @jest/types@^24.9.0
│  └─ jest-mock@^24.9.0
├─ @jest/[email protected]
│  ├─ @jest/types@^24.9.0
│  ├─ jest-message-util@^24.9.0
│  └─ jest-mock@^24.9.0
├─ @jest/[email protected]
│  ├─ @jest/environment@^24.9.0
│  ├─ @jest/test-result@^24.9.0
│  ├─ @jest/transform@^24.9.0
│  ├─ @jest/types@^24.9.0
│  ├─ jest-haste-map@^24.9.0
│  ├─ jest-resolve@^24.9.0
│  ├─ jest-runtime@^24.9.0
│  ├─ jest-util@^24.9.0
│  ├─ jest-worker@^24.6.0
├─ @jest/[email protected]
├─ @jest/[email protected]
│  ├─ @jest/console@^24.9.0
│  ├─ @jest/types@^24.9.0
├─ @jest/[email protected]
│  ├─ @jest/test-result@^24.9.0
│  ├─ jest-haste-map@^24.9.0
│  ├─ jest-runner@^24.9.0
│  └─ jest-runtime@^24.9.0
├─ @jest/[email protected]
│  ├─ @jest/types@^24.9.0
│  ├─ jest-haste-map@^24.9.0
│  ├─ jest-regex-util@^24.9.0
│  ├─ jest-util@^24.9.0
├─ @jest/[email protected]
│  ├─ @stryker-mutator/[email protected]
│  ├─ @types/[email protected]
│  ├─ [email protected]
│  ├─ [email protected]
│  ├─ [email protected]
│  ├─ @stryker-mutator/[email protected]
│  ├─ @types/[email protected]
│  ├─ @vue/[email protected]
│  │  ├─ @types/jest@^24.0.18
│  │  ├─ @types/[email protected]
│  │  │  └─ @types/jest-diff@*
│  │  ├─ babel-jest@^24.9.0
│  │  ├─ jest-environment-jsdom-fifteen@^1.0.0
│  │  ├─ jest-serializer-vue@^2.0.2
│  │  ├─ jest-transform-stub@^2.0.0
│  │  ├─ jest-watch-typeahead@^0.4.0
│  │  ├─ jest@^24.9.0
│  │  ├─ ts-jest@^24.1.0
│  │  └─ vue-jest@^3.0.5
│  ├─ @vue/[email protected]
│  ├─ [email protected]
│  ├─ [email protected]
│  ├─ [email protected]
│  ├─ [email protected]
│  ├─ [email protected]
│  ├─ [email protected]
│  ├─ @types/[email protected]
│  ├─ [email protected]
│  ├─ [email protected]
│  ├─ [email protected]
│  ├─ [email protected]
│  ├─ @types/[email protected]
│  ├─ [email protected]
│  ├─ [email protected]
│  ├─ [email protected]
│  ├─ [email protected]
│  ├─ [email protected]
│  ├─ [email protected]
│  ├─ [email protected]
│  ├─ @types/[email protected]
│  ├─ [email protected]
│  ├─ [email protected]
│  ├─ @types/[email protected]
│  ├─ [email protected]
│  ├─ [email protected]
├─ @stryker-mutator/[email protected]
├─ @types/[email protected]
├─ @types/[email protected]
│  └─ @types/jest-diff@*
├─ [email protected]
│  ├─ @jest/transform@^24.9.0
│  ├─ @jest/types@^24.9.0
│  ├─ babel-preset-jest@^24.9.0
├─ [email protected]
├─ [email protected]
│  └─ babel-plugin-jest-hoist@^24.9.0
│  ├─ @jest/types@^24.9.0
│  ├─ jest-get-type@^24.9.0
│  ├─ jest-matcher-utils@^24.9.0
│  ├─ jest-message-util@^24.9.0
│  └─ jest-regex-util@^24.9.0
├─ [email protected]
│  ├─ @jest/types@^24.9.0
├─ [email protected]
│  ├─ @jest/core@^24.9.0
│  ├─ @jest/test-result@^24.9.0
│  ├─ @jest/types@^24.9.0
│  ├─ jest-config@^24.9.0
│  ├─ jest-util@^24.9.0
│  ├─ jest-validate@^24.9.0
├─ [email protected]
│  ├─ @jest/test-sequencer@^24.9.0
│  ├─ @jest/types@^24.9.0
│  ├─ babel-jest@^24.9.0
│  ├─ jest-environment-jsdom@^24.9.0
│  ├─ jest-environment-node@^24.9.0
│  ├─ jest-get-type@^24.9.0
│  ├─ jest-jasmine2@^24.9.0
│  ├─ jest-regex-util@^24.3.0
│  ├─ jest-resolve@^24.9.0
│  ├─ jest-util@^24.9.0
│  ├─ jest-validate@^24.9.0
├─ [email protected]
│  ├─ jest-get-type@^24.9.0
├─ [email protected]
├─ [email protected]
│  ├─ @jest/types@^24.9.0
│  ├─ jest-get-type@^24.9.0
│  ├─ jest-util@^24.9.0
├─ [email protected]
│  ├─ @jest/environment@^24.3.0
│  ├─ @jest/fake-timers@^24.3.0
│  ├─ @jest/types@^24.3.0
│  ├─ jest-mock@^24.0.0
│  ├─ jest-util@^24.0.0
├─ [email protected]
│  ├─ jest-mock@^24.5.0
│  ├─ jest-util@^24.5.0
├─ [email protected]
│  ├─ @jest/environment@^24.9.0
│  ├─ @jest/fake-timers@^24.9.0
│  ├─ @jest/types@^24.9.0
│  ├─ jest-mock@^24.9.0
│  ├─ jest-util@^24.9.0
├─ [email protected]
│  ├─ @jest/environment@^24.9.0
│  ├─ @jest/fake-timers@^24.9.0
│  ├─ @jest/types@^24.9.0
│  ├─ jest-mock@^24.9.0
│  └─ jest-util@^24.9.0
├─ [email protected]
├─ [email protected]
│  ├─ @jest/types@^24.9.0
│  ├─ jest-serializer@^24.9.0
│  ├─ jest-util@^24.9.0
│  ├─ jest-worker@^24.9.0
├─ [email protected]
├─ [email protected]
│  ├─ @jest/environment@^24.9.0
│  ├─ @jest/test-result@^24.9.0
│  ├─ @jest/types@^24.9.0
│  ├─ jest-each@^24.9.0
│  ├─ jest-matcher-utils@^24.9.0
│  ├─ jest-message-util@^24.9.0
│  ├─ jest-runtime@^24.9.0
│  ├─ jest-snapshot@^24.9.0
│  ├─ jest-util@^24.9.0
├─ [email protected]
│  ├─ jest-get-type@^24.9.0
├─ [email protected]
│  ├─ jest-diff@^24.9.0
│  ├─ jest-get-type@^24.9.0
├─ [email protected]
│  ├─ @jest/test-result@^24.9.0
│  ├─ @jest/types@^24.9.0
├─ [email protected]
│  └─ @jest/types@^24.9.0
├─ [email protected]
├─ [email protected]
├─ [email protected]
│  ├─ @jest/types@^24.9.0
│  ├─ jest-regex-util@^24.3.0
│  └─ jest-snapshot@^24.9.0
├─ [email protected]
│  ├─ @jest/types@^24.9.0
│  ├─ jest-pnp-resolver@^1.2.1
├─ [email protected]
│  ├─ @jest/console@^24.7.1
│  ├─ @jest/environment@^24.9.0
│  ├─ @jest/test-result@^24.9.0
│  ├─ @jest/types@^24.9.0
│  ├─ jest-config@^24.9.0
│  ├─ jest-docblock@^24.3.0
│  ├─ jest-haste-map@^24.9.0
│  ├─ jest-jasmine2@^24.9.0
│  ├─ jest-leak-detector@^24.9.0
│  ├─ jest-message-util@^24.9.0
│  ├─ jest-resolve@^24.9.0
│  ├─ jest-runtime@^24.9.0
│  ├─ jest-util@^24.9.0
│  ├─ jest-worker@^24.6.0
├─ [email protected]
│  ├─ @jest/console@^24.7.1
│  ├─ @jest/environment@^24.9.0
│  ├─ @jest/source-map@^24.3.0
│  ├─ @jest/transform@^24.9.0
│  ├─ @jest/types@^24.9.0
│  ├─ jest-config@^24.9.0
│  ├─ jest-haste-map@^24.9.0
│  ├─ jest-message-util@^24.9.0
│  ├─ jest-mock@^24.9.0
│  ├─ jest-regex-util@^24.3.0
│  ├─ jest-resolve@^24.9.0
│  ├─ jest-snapshot@^24.9.0
│  ├─ jest-util@^24.9.0
│  ├─ jest-validate@^24.9.0
├─ [email protected]
├─ [email protected]
├─ [email protected]
│  ├─ @jest/types@^24.9.0
│  ├─ jest-diff@^24.9.0
│  ├─ jest-get-type@^24.9.0
│  ├─ jest-matcher-utils@^24.9.0
│  ├─ jest-message-util@^24.9.0
│  ├─ jest-resolve@^24.9.0
├─ [email protected]
├─ [email protected]
│  ├─ @jest/console@^24.9.0
│  ├─ @jest/fake-timers@^24.9.0
│  ├─ @jest/source-map@^24.9.0
│  ├─ @jest/test-result@^24.9.0
│  ├─ @jest/types@^24.9.0
├─ [email protected]
│  ├─ @jest/types@^24.9.0
│  ├─ jest-get-type@^24.9.0
├─ [email protected]
│  ├─ jest-watcher@^24.3.0
├─ [email protected]
│  ├─ @jest/test-result@^24.9.0
│  ├─ @jest/types@^24.9.0
│  ├─ jest-util@^24.9.0
├─ [email protected]
├─ [email protected]
│  └─ jest-cli@^24.9.0
│  ├─ @jest/types@^24.9.0
│  ├─ jest-worker@^24.9.0
├─ [email protected]
├─ [email protected]

Test runner environment

# stryker run

Your Environment

software version(s)
node v10.17.0
yarn 1.19.1
Operating System Linux

Add stryker.log

11:51:23 (30867) INFO ConfigReader Using stryker.conf.js in the current working directory.
11:51:23 (30867) DEBUG BroadcastReporter Broadcasting to reporters ["progress","clear-text","html"]
11:51:23 (30867) DEBUG ConfigReader Loading config stryker.conf.js
11:51:23 (30867) DEBUG PluginLoader Loading @stryker-mutator/* from /tmp/stryker-test/node_modules/@stryker-mutator
11:51:23 (30867) DEBUG PluginLoader Loading plugin "/tmp/stryker-test/node_modules/@stryker-mutator/html-reporter" (matched with expression @stryker-mutator/*)
11:51:23 (30867) DEBUG PluginLoader Loading plugin "/tmp/stryker-test/node_modules/@stryker-mutator/jest-runner" (matched with expression @stryker-mutator/*)
11:51:23 (30867) DEBUG PluginLoader Loading plugin "/tmp/stryker-test/node_modules/@stryker-mutator/typescript" (matched with expression @stryker-mutator/*)
11:51:23 (30867) DEBUG PluginLoader Loading plugin "/tmp/stryker-test/node_modules/@stryker-mutator/vue-mutator" (matched with expression @stryker-mutator/*)
11:51:23 (30867) DEBUG PluginLoader Loading plugins /tmp/stryker-test/node_modules/@stryker-mutator/html-reporter
11:51:23 (30867) DEBUG PluginLoader Loading plugins /tmp/stryker-test/node_modules/@stryker-mutator/jest-runner
11:51:23 (30867) DEBUG PluginLoader Loading plugins /tmp/stryker-test/node_modules/@stryker-mutator/typescript
11:51:23 (30867) DEBUG PluginLoader Loading plugins /tmp/stryker-test/node_modules/@stryker-mutator/vue-mutator
11:51:23 (30867) DEBUG PluginLoader Loading plugins /tmp/stryker-test/node_modules/@stryker-mutator/core/src/reporters/index.js
11:51:23 (30867) DEBUG TypescriptConfigEditor No 'tsconfigFile' specified, not loading any config
11:51:23 (30867) INFO InputFileResolver Found 40 of 1533 file(s) to be mutated.
11:51:23 (30867) DEBUG InputFileResolver All input files: [
  { ... }
]
11:51:23 (30867) DEBUG InputFileResolver Files to mutate: [
  { ... }
  "/tmp/stryker-test/frontend/src/components/Test.ts"
]
11:51:23 (30867) DEBUG TemporaryDirectory Using temp directory "/tmp/stryker-test/frontend/.stryker-tmp"
11:51:23 (30867) DEBUG TestFrameworkOrchestrator The `coverageAnalysis` setting is "off", not hooking into the test framework to achieve performance benefits.
11:51:23 (30867) INFO InitialTestExecutor Starting initial test run. This may take a while.
11:51:23 (30867) DEBUG Sandbox Creating a sandbox for files in /tmp/stryker-test/frontend/.stryker-tmp/sandbox6479207
11:51:23 (30867) DEBUG Sandbox Creating test runner 0
11:51:23 (30867) DEBUG ChildProcessProxy Starting /tmp/stryker-test/node_modules/@stryker-mutator/core/src/test-runner/ChildProcessTestRunnerWorker.js in child process 30889
11:51:24 (30867) DEBUG TimeoutDecorator Starting timeout timer (300000 ms) for a test run
11:51:24 (30889) DEBUG ChildProcessProxyWorker Changing current working directory for this process to /tmp/stryker-test/frontend/.stryker-tmp/sandbox6479207
11:51:24 (30889) DEBUG PluginLoader Loading @stryker-mutator/* from /tmp/stryker-test/node_modules/@stryker-mutator
11:51:24 (30889) DEBUG PluginLoader Loading plugin "/tmp/stryker-test/node_modules/@stryker-mutator/html-reporter" (matched with expression @stryker-mutator/*)
11:51:24 (30889) DEBUG PluginLoader Loading plugin "/tmp/stryker-test/node_modules/@stryker-mutator/jest-runner" (matched with expression @stryker-mutator/*)
11:51:24 (30889) DEBUG PluginLoader Loading plugin "/tmp/stryker-test/node_modules/@stryker-mutator/typescript" (matched with expression @stryker-mutator/*)
11:51:24 (30889) DEBUG PluginLoader Loading plugin "/tmp/stryker-test/node_modules/@stryker-mutator/vue-mutator" (matched with expression @stryker-mutator/*)
11:51:24 (30889) DEBUG PluginLoader Loading plugins /tmp/stryker-test/node_modules/@stryker-mutator/html-reporter
11:51:24 (30889) DEBUG PluginLoader Loading plugins /tmp/stryker-test/node_modules/@stryker-mutator/jest-runner
11:51:24 (30889) DEBUG PluginLoader Loading plugins /tmp/stryker-test/node_modules/@stryker-mutator/typescript
11:51:24 (30889) DEBUG PluginLoader Loading plugins /tmp/stryker-test/node_modules/@stryker-mutator/vue-mutator
11:51:24 (30889) DEBUG PluginLoader Loading plugins /tmp/stryker-test/node_modules/@stryker-mutator/core/src/reporters/index.js
11:51:24 (30889) DEBUG JestTestRunner Running jest with --findRelatedTests flag. Set jest.enableFindRelatedTests to false to run all tests on every mutant.
11:51:24 (30889) DEBUG JestTestRunner Project root is /tmp/stryker-test/frontend/.stryker-tmp/sandbox6479207
11:51:24 (30889) TRACE JestPromiseTestAdapter Invoking Jest with config {"globals":{"ts-jest":{"babelConfig":false,"tsConfig":{"target":"es2017"},"diagnostics":{"pathRegex":"/.(spec|test).ts$/"}}},"testEnvironment":"jest-environment-jsdom-fourteen","cache":false,"rootDir":"/tmp/stryker-test/frontend/.stryker-tmp/sandbox6479207","testMatch":["<rootDir>/**/__tests__/**/*.ts?(x)","<rootDir>/**/?(*.)spec.ts?(x)"],"setupFiles":["tests/setup.ts"],"setupFilesAfterEnv":["tests/setupScript.ts"],"moduleFileExtensions":["ts","tsx","js","jsx","json","vue"],"coverageThreshold":{"global":{"statements":95,"branches":85,"functions":95,"lines":95}},"collectCoverage":false,"coverageDirectory":"build/coverage/","collectCoverageFrom":["**/*.{ts,vue}","!**/*.d.ts","!**/*.vue.ts","!@types/**","!main.ts","!pages/global-error/registerGlobalErrorHandler.ts","!pages/global-error/showErrorSnackbar.ts","!tests/**","!showcase/**","!component-test-pages/**"],"coverageReporters":["html","json","lcov","text"],"transform":{"^.+\\.vue$":"vue-jest","^.+\\.tsx?$":"ts-jest",".+\\.(css|styl|less|sass|scss)$":"jest-transform-stub"},"reporters":[],"moduleNameMapper":{"\\.(gif|png|jpg|jpeg|ttf|woff|woff2)$":"<rootDir>/tests/__mocks__/fileLoaderMock.ts","\\.svg$":"<rootDir>/tests/__mocks__/svgLoaderMock.ts","^file-loader[^!]*!":"<rootDir>/tests/__mocks__/fileLoaderMock.ts","\\.html$":"<rootDir>/tests/__mocks__/fileLoaderMock.ts"},"snapshotSerializers":["jest-serializer-vue"],"modulePathIgnorePatterns":["integration"],"verbose":false,"bail":false,"notify":false}
11:51:24 (30867) DEBUG ChildProcessProxy Disposing of worker process 30889
11:51:24 (30867) DEBUG ChildProcessProxy Kill 30889
11:51:24 (30867) DEBUG ChildProcessProxy Starting /tmp/stryker-test/node_modules/@stryker-mutator/core/src/test-runner/ChildProcessTestRunnerWorker.js in child process 30902
11:51:24 (30867) DEBUG TimeoutDecorator Starting timeout timer (300000 ms) for a test run
11:51:24 (30902) DEBUG ChildProcessProxyWorker Changing current working directory for this process to /tmp/stryker-test/frontend/.stryker-tmp/sandbox6479207
11:51:24 (30902) DEBUG PluginLoader Loading @stryker-mutator/* from /tmp/stryker-test/node_modules/@stryker-mutator
11:51:24 (30902) DEBUG PluginLoader Loading plugin "/tmp/stryker-test/node_modules/@stryker-mutator/html-reporter" (matched with expression @stryker-mutator/*)
11:51:24 (30902) DEBUG PluginLoader Loading plugin "/tmp/stryker-test/node_modules/@stryker-mutator/jest-runner" (matched with expression @stryker-mutator/*)
11:51:24 (30902) DEBUG PluginLoader Loading plugin "/tmp/stryker-test/node_modules/@stryker-mutator/typescript" (matched with expression @stryker-mutator/*)
11:51:24 (30902) DEBUG PluginLoader Loading plugin "/tmp/stryker-test/node_modules/@stryker-mutator/vue-mutator" (matched with expression @stryker-mutator/*)
11:51:24 (30902) DEBUG PluginLoader Loading plugins /tmp/stryker-test/node_modules/@stryker-mutator/html-reporter
11:51:24 (30902) DEBUG PluginLoader Loading plugins /tmp/stryker-test/node_modules/@stryker-mutator/jest-runner
11:51:24 (30902) DEBUG PluginLoader Loading plugins /tmp/stryker-test/node_modules/@stryker-mutator/typescript
11:51:24 (30902) DEBUG PluginLoader Loading plugins /tmp/stryker-test/node_modules/@stryker-mutator/vue-mutator
11:51:24 (30902) DEBUG PluginLoader Loading plugins /tmp/stryker-test/node_modules/@stryker-mutator/core/src/reporters/index.js
11:51:24 (30902) DEBUG JestTestRunner Running jest with --findRelatedTests flag. Set jest.enableFindRelatedTests to false to run all tests on every mutant.
11:51:24 (30902) DEBUG JestTestRunner Project root is /tmp/stryker-test/frontend/.stryker-tmp/sandbox6479207
11:51:24 (30902) TRACE JestPromiseTestAdapter Invoking Jest with config {"globals":{"ts-jest":{"babelConfig":false,"tsConfig":{"target":"es2017"},"diagnostics":{"pathRegex":"/.(spec|test).ts$/"}}},"testEnvironment":"jest-environment-jsdom-fourteen","cache":false,"rootDir":"/tmp/stryker-test/frontend/.stryker-tmp/sandbox6479207","testMatch":["<rootDir>/**/__tests__/**/*.ts?(x)","<rootDir>/**/?(*.)spec.ts?(x)"],"setupFiles":["tests/setup.ts"],"setupFilesAfterEnv":["tests/setupScript.ts"],"moduleFileExtensions":["ts","tsx","js","jsx","json","vue"],"coverageThreshold":{"global":{"statements":95,"branches":85,"functions":95,"lines":95}},"collectCoverage":false,"coverageDirectory":"build/coverage/","collectCoverageFrom":["**/*.{ts,vue}","!**/*.d.ts","!**/*.vue.ts","!@types/**","!main.ts","!pages/global-error/registerGlobalErrorHandler.ts","!pages/global-error/showErrorSnackbar.ts","!tests/**","!showcase/**","!component-test-pages/**"],"coverageReporters":["html","json","lcov","text"],"transform":{"^.+\\.vue$":"vue-jest","^.+\\.tsx?$":"ts-jest",".+\\.(css|styl|less|sass|scss)$":"jest-transform-stub"},"reporters":[],"moduleNameMapper":{"\\.(gif|png|jpg|jpeg|ttf|woff|woff2)$":"<rootDir>/tests/__mocks__/fileLoaderMock.ts","\\.svg$":"<rootDir>/tests/__mocks__/svgLoaderMock.ts","^file-loader[^!]*!":"<rootDir>/tests/__mocks__/fileLoaderMock.ts","\\.html$":"<rootDir>/tests/__mocks__/fileLoaderMock.ts"},"snapshotSerializers":["jest-serializer-vue"],"modulePathIgnorePatterns":["integration"],"verbose":false,"bail":false,"notify":false}
11:51:24 (30867) DEBUG ChildProcessProxy Disposing of worker process 30902
11:51:24 (30867) DEBUG ChildProcessProxy Kill 30902
11:51:24 (30867) DEBUG ChildProcessProxy Starting /tmp/stryker-test/node_modules/@stryker-mutator/core/src/test-runner/ChildProcessTestRunnerWorker.js in child process 30918
11:51:24 (30918) DEBUG ChildProcessProxyWorker Changing current working directory for this process to /tmp/stryker-test/frontend/.stryker-tmp/sandbox6479207
11:51:24 (30918) DEBUG PluginLoader Loading @stryker-mutator/* from /tmp/stryker-test/node_modules/@stryker-mutator
11:51:24 (30918) DEBUG PluginLoader Loading plugin "/tmp/stryker-test/node_modules/@stryker-mutator/html-reporter" (matched with expression @stryker-mutator/*)
11:51:24 (30918) DEBUG PluginLoader Loading plugin "/tmp/stryker-test/node_modules/@stryker-mutator/jest-runner" (matched with expression @stryker-mutator/*)
11:51:24 (30918) DEBUG PluginLoader Loading plugin "/tmp/stryker-test/node_modules/@stryker-mutator/typescript" (matched with expression @stryker-mutator/*)
11:51:24 (30918) DEBUG PluginLoader Loading plugin "/tmp/stryker-test/node_modules/@stryker-mutator/vue-mutator" (matched with expression @stryker-mutator/*)
11:51:24 (30918) DEBUG PluginLoader Loading plugins /tmp/stryker-test/node_modules/@stryker-mutator/html-reporter
11:51:24 (30918) DEBUG PluginLoader Loading plugins /tmp/stryker-test/node_modules/@stryker-mutator/jest-runner
11:51:24 (30918) DEBUG PluginLoader Loading plugins /tmp/stryker-test/node_modules/@stryker-mutator/typescript
11:51:25 (30918) DEBUG PluginLoader Loading plugins /tmp/stryker-test/node_modules/@stryker-mutator/vue-mutator
11:51:25 (30918) DEBUG PluginLoader Loading plugins /tmp/stryker-test/node_modules/@stryker-mutator/core/src/reporters/index.js
11:51:25 (30918) DEBUG JestTestRunner Running jest with --findRelatedTests flag. Set jest.enableFindRelatedTests to false to run all tests on every mutant.
11:51:25 (30918) DEBUG JestTestRunner Project root is /tmp/stryker-test/frontend/.stryker-tmp/sandbox6479207
11:51:25 (30867) DEBUG ChildProcessProxy Disposing of worker process 30918
11:51:25 (30867) DEBUG ChildProcessProxy Kill 30918
11:51:25 (30867) DEBUG ChildProcessProxy Starting /tmp/stryker-test/node_modules/@stryker-mutator/core/src/test-runner/ChildProcessTestRunnerWorker.js in child process 30930
11:51:25 (30930) DEBUG ChildProcessProxyWorker Changing current working directory for this process to /tmp/stryker-test/frontend/.stryker-tmp/sandbox6479207
11:51:25 (30930) DEBUG PluginLoader Loading @stryker-mutator/* from /tmp/stryker-test/node_modules/@stryker-mutator
11:51:25 (30930) DEBUG PluginLoader Loading plugin "/tmp/stryker-test/node_modules/@stryker-mutator/html-reporter" (matched with expression @stryker-mutator/*)
11:51:25 (30930) DEBUG PluginLoader Loading plugin "/tmp/stryker-test/node_modules/@stryker-mutator/jest-runner" (matched with expression @stryker-mutator/*)
11:51:25 (30930) DEBUG PluginLoader Loading plugin "/tmp/stryker-test/node_modules/@stryker-mutator/typescript" (matched with expression @stryker-mutator/*)
11:51:25 (30930) DEBUG PluginLoader Loading plugin "/tmp/stryker-test/node_modules/@stryker-mutator/vue-mutator" (matched with expression @stryker-mutator/*)
11:51:25 (30930) DEBUG PluginLoader Loading plugins /tmp/stryker-test/node_modules/@stryker-mutator/html-reporter
11:51:25 (30930) DEBUG PluginLoader Loading plugins /tmp/stryker-test/node_modules/@stryker-mutator/jest-runner
11:51:25 (30930) DEBUG PluginLoader Loading plugins /tmp/stryker-test/node_modules/@stryker-mutator/typescript
11:51:25 (30930) DEBUG PluginLoader Loading plugins /tmp/stryker-test/node_modules/@stryker-mutator/vue-mutator
11:51:25 (30930) DEBUG PluginLoader Loading plugins /tmp/stryker-test/node_modules/@stryker-mutator/core/src/reporters/index.js
11:51:25 (30930) DEBUG JestTestRunner Running jest with --findRelatedTests flag. Set jest.enableFindRelatedTests to false to run all tests on every mutant.
11:51:25 (30930) DEBUG JestTestRunner Project root is /tmp/stryker-test/frontend/.stryker-tmp/sandbox6479207
11:51:25 (30867) DEBUG ChildProcessProxy Disposing of worker process 30930
11:51:25 (30867) DEBUG ChildProcessProxy Kill 30930
11:51:25 (30867) ERROR InitialTestExecutor One or more tests resulted in an error:
	Test runner crashed. Tried twice to restart it without any luck. Last time the error message was: Error: : ● Validation Error:

  Module tests/setup.ts in the setupFiles option was not found.
         <rootDir> is: /tmp/stryker-test/frontend/.stryker-tmp/sandbox6479207

  Configuration Documentation:
  https://jestjs.io/docs/configuration.html

● Validation Error:

  Module tests/setup.ts in the setupFiles option was not found.
         <rootDir> is: /tmp/stryker-test/frontend/.stryker-tmp/sandbox6479207

  Configuration Documentation:
  https://jestjs.io/docs/configuration.html

Error: : ● Validation Error:

  Module tests/setup.ts in the setupFiles option was not found.
         <rootDir> is: /tmp/stryker-test/frontend/.stryker-tmp/sandbox6479207

  Configuration Documentation:
  https://jestjs.io/docs/configuration.html

● Validation Error:

  Module tests/setup.ts in the setupFiles option was not found.
         <rootDir> is: /tmp/stryker-test/frontend/.stryker-tmp/sandbox6479207

  Configuration Documentation:
  https://jestjs.io/docs/configuration.html

    at ChildProcess.worker.on (/tmp/stryker-test/node_modules/@stryker-mutator/core/src/child-proxy/ChildProcessProxy.js:133:68)
    at ChildProcess.emit (events.js:198:13)
    at emit (internal/child_process.js:832:12)
    at process._tickCallback (internal/process/next_tick.js:63:19)

Minimal repository demonstating the issue with stryker 4.0.0: https://github.com/michael42/stryker-issue-1847

@michael42 michael42 added the 🐛 Bug Something isn't working label Nov 13, 2019
@bartekleon
Copy link
Member

@michael42 try

module.exports = function (config) {
  config.set({
    mutate: ['src/**/*.ts', '!src/**/*.spec.ts'],
    mutator: 'vue',
    testRunner: 'jest',
    reporters: ['progress', 'clear-text', 'html'],
    coverageAnalysis: 'off',
   jest: {
      rootDir: 'src'
   }
  });
};

@ghost
Copy link

ghost commented Mar 15, 2020

Running into this same issue today.

@kmdrGroch It appears that when I add that, my jest.config's testEnvironment: '<rootDir>/myFolder' path still does not respect 'src' being the root dir. :(

@ghost
Copy link

ghost commented Mar 15, 2020

I can't tell if this is related: jestjs/jest#8520 (comment)

@ghost
Copy link

ghost commented Mar 15, 2020

My solution was to just avoid using <rootDir> in my jest.config :/

@bartekleon
Copy link
Member

Yes, it is specifically issue with Jest, we have had problems with it. So now please hang on and try these workarounds. We have this issue on top of our heads and we will be working on it as soon as we can.
For now I would ask for closing this one since #2163 is a summary of all these jest folder issues :)

@bartekleon
Copy link
Member

Is this issue solved? Or can it be closed?

@michael42
Copy link
Author

Seems to be still broken with stryker 4.0.0, here's a more minimal reproduction. Running jest works fine, but stryker run fails to run the setupFiles, setupFilesAfterEnv and additionally tries to run tests outside of the rootDir. Setting jest: { rootDir: 'src' } in the stryker.conf.js isn't allowed by the OptionsValidator.

@nicojs
Copy link
Member

nicojs commented Jan 25, 2021

This issue was wrongly lumped in with other jest issues with regards to --inPlace mode. Apparently, we were hardcoding the rootDir to be the cwd for some reason. I've implemented a fix in #2713

Thanks for the awesome reproduction @michael42

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 Bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants