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

Have to use "enableFindRelatedTests: false" for jest-runner to kill mutants #2147

Closed
candentira opened this issue Apr 14, 2020 · 2 comments
Closed
Labels
🐛 Bug Something isn't working

Comments

@candentira
Copy link

Have to use "enableFindRelatedTests: false" for jest-runner to kill mutants - otherwise no tests are found for mutants and they all survive.

Using this option makes mutution testing to run much longer then without it. But without it result isn't correct - all mutants survive as no corresponding tests are found.

I've setup smallest repo with TS, Jest and stryker setup so that you could see the issue reproduced.

Stryker config

module.exports = {
  $schema: 'https://raw.githubusercontent.com/stryker-mutator/stryker/master/packages/api/schema/stryker-core.json',
  mutator: 'typescript',
  packageManager: 'npm',
  reporters: [ 'html', 'clear-text', 'progress', 'dashboard' ],
  testRunner: 'jest',
  coverageAnalysis: 'off',
  jest: {
    config: require('./jest.config'),
    //next line is required for properly kill mutants - without it all survive
    enableFindRelatedTests: false
  },
  mutate: [
    'src/**/*.ts'
  ],
  thresholds: { high: 80, low: 60, break: null },
  maxConcurrentTestRunners: 2
}

Test runner config (Jest.config.js)

module.exports = {
  roots: ['test'],
  testEnvironment: 'node',
  transform: {
    '.(ts|tsx)': 'ts-jest',
  },
  testRegex: '(\\.(test|spec))\\.(ts|js)$',
  moduleFileExtensions: ['ts', 'tsx', 'js'],
  globals: {
    'ts-jest': {
      diagnostics: {
        pathRegex: '(\\.(test|spec))\\.(ts)$',
      },
    },
  },
};

Stryker environment

+-- @stryker-mutator/core@3.1.0
| +-- @stryker-mutator/api@3.1.0
| +-- @stryker-mutator/util@3.1.0
+-- @stryker-mutator/jest-runner@3.1.0
| +-- @stryker-mutator/api@3.1.0 deduped
+-- @stryker-mutator/typescript@3.1.0
| +-- @stryker-mutator/api@3.1.0 deduped
| +-- @stryker-mutator/util@3.1.0 deduped
@types/jest: 25.1.3,
jest: 25.1.0"
ts-jest: 25.2.1

Test runner environment

npm run mt

Your Environment

software version(s)
node v12.13.0
npm 6.12.0
Operating System Windows 10

Add stryker.log

stryker.log

@candentira candentira added the 🐛 Bug Something isn't working label Apr 14, 2020
@nicojs
Copy link
Member

nicojs commented Apr 17, 2020

I guess this is a duplicate of #2122 . Could try one of the other workarounds reported here? #2122 (comment)

@nicojs
Copy link
Member

nicojs commented Jan 25, 2021

You can also use the new --inPlace mode, new since Stryker 4.4. Closing this issue for now, please open a new one if this problem persists.

@nicojs nicojs closed this as completed Jan 25, 2021
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

No branches or pull requests

2 participants