Stryker: expressionMutantPlacer could not place mutants with type(s): "StringLiteral"

Created on 8 Oct 2020  路  3Comments  路  Source: stryker-mutator/stryker

Stryker 4.0.0 fails to mutate typescript classes with string variable names.

07:54:42 (3876) ERROR Stryker SyntaxError: expressionMutantPlacer could not place mutants with type(s): "StringLiteral". Either remove this file from the list of files to be mutated, or ignore the mutators. Please report this issue at https://github.com/stryker-mutator/stryker/issues/new?assignees=&labels=%F0%9F%90%9B+Bug&template=bug_report.md&title=expressionMutantPlacer%20could%20not%20place%20mutants%20with%20type(s)%3A%20%22StringLiteral%22.
1 | export class ClassA{

2 | public readonly 'variable-name': boolean = true
| ^^^^^^^^^^^^^^^^^^^^^^^^^
5 | }

stryker.config.js:
module.exports = {
mutate: [
'/.ts',
'!
/.spec.ts',
'!/.mock.ts',
'!
/.config.ts',
'!/.enum.ts',
'!
/.const.ts',
'!jest.setup.ts'
],
packageManager: 'npm',
reporters: ['clear-text', 'progress', 'html'],
testRunner: 'jest',
jest: {
enableFindRelatedTests: true,
config: {
preset: 'ts-jest',
testEnvironment: 'node',
resetModules: true,
setupFilesAfterEnv: ['jest-extended', ${process.cwd()}/jest.setup.ts],
testPathIgnorePatterns: ['/dist/', '/node_modules/']
}
},
thresholds: { high: 100, low: 80, break: 100 },
coverageAnalysis: 'off',
tsconfigFile: 'tsconfig.json',
htmlReporter: {
baseDir: 'reports/coverage/mutation'
},
timeoutMS: 60000
}

jest.config.js:
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
setupFilesAfterEnv: ['jest-extended', './jest.setup.ts'],
testPathIgnorePatterns: ['/.stryker-tmp/', '/dist/', '/node_modules/'],
coverageDirectory: 'reports/coverage/unit',
collectCoverageFrom: ['src//*.ts', '!/runner.ts'],
coverageThreshold: {
global: {
branches: 100,
functions: 100,
lines: 100,
statements: 100
}
},
reporters: [
'default',
[
'jest-junit',
{
outputDirectory: '/reports/tests',
outputName: 'unit-test-evidence.xml'
}
],
[
'./node_modules/jest-html-reporter',
{
outputPath: 'reports/cucumber/requirements-evidence.html'
}
]
]
}

馃悰 Bug

Most helpful comment

Wow! Great find.

class A {
  public readonly 'variable-name': boolean = true
}

Didn't know this was valid code 馃槄

Should be an easy fix.

All 3 comments

Wow! Great find.

class A {
  public readonly 'variable-name': boolean = true
}

Didn't know this was valid code 馃槄

Should be an easy fix.

yeaa... come edge cases can be really tricky :)

Glad I spent time polishing that error message.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

simondel picture simondel  路  25Comments

nicojs picture nicojs  路  33Comments

Lakitna picture Lakitna  路  42Comments

VincentLanglet picture VincentLanglet  路  31Comments

j-truax picture j-truax  路  20Comments