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

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

Closed
jmtelljohann opened this issue Oct 8, 2020 · 3 comments · Fixed by #2544
Closed

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

jmtelljohann opened this issue Oct 8, 2020 · 3 comments · Fixed by #2544
Labels
🐛 Bug Something isn't working

Comments

@jmtelljohann
Copy link

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'
}
]
]
}

@jmtelljohann jmtelljohann added the 🐛 Bug Something isn't working label Oct 8, 2020
@nicojs
Copy link
Member

nicojs commented Oct 8, 2020

Wow! Great find.

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

Didn't know this was valid code 😅

Should be an easy fix.

@bartekleon
Copy link
Member

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

@nicojs
Copy link
Member

nicojs commented Oct 8, 2020

Glad I spent time polishing that error message.

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