You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
In a mutation switching world, Stryker will add the // @ts-nocheck header to each .js, .ts, .tsx and .jsx file in the sandbox. This allows for the project to run even though mutators created type errors (users can opt-in to use the @stryker-mutator/typescript-checker to filter out invalid mutants). However, adding this header can have undesired side effects.
For example, the integration tests of @stryker-mutator/typescript-checker itself rely on files located in the testResources directory. They should not be prefixed, otherwise the tests will fail (because an error is actually expected, that's the goal of the test).
Describe the solution you'd like
I think the only way around these edge cases is to make adding this header configurable. I was thinking something like this:
{"sandbox": {"tsNoCheck": "+(src|test)/**/*.ts"// can also be a boolean}}
The following options are allowed:
true would prefix each file (default).
false would result in completely disabling.
'src/**/*.ts' only prefix files that matches this glob expression.
Describe alternatives you've considered
We can keep hard coding it, but disable it for testResources, but I don't like this magic default and it wouldn't work for all projects.
The configuration option name candidates:
sandbox.tsNoCheck
sandbox['@ts-nocheck']
sandbox.disableTypeChecking
I would like to make it a property of sandbox, in order to later add a mode property there as well (see #2163 ).
@simondel what do you think? It does add (additional) complexity, but the default would be fine for 99.9% of use cases anyhow IMHO, so it is acceptable?
The text was updated successfully, but these errors were encountered:
Just discussed this with @hugo-vrijswijk . We're now thinking to make it a bit more generic. Also allowing this to work for other headers, like /* eslint-disable */.
And after more careful considereration, I've changed it to sandbox: { fileHeaders: "**/*+(.js|.ts)?(x)": "/* eslint-disable */\n// @ts-nocheck\n" } } 🤷♂️
Is your feature request related to a problem? Please describe.
In a mutation switching world, Stryker will add the
// @ts-nocheck
header to each.js
,.ts
,.tsx
and.jsx
file in the sandbox. This allows for the project to run even though mutators created type errors (users can opt-in to use the@stryker-mutator/typescript-checker
to filter out invalid mutants). However, adding this header can have undesired side effects.For example, the integration tests of
@stryker-mutator/typescript-checker
itself rely on files located in thetestResources
directory. They should not be prefixed, otherwise the tests will fail (because an error is actually expected, that's the goal of the test).Describe the solution you'd like
I think the only way around these edge cases is to make adding this header configurable. I was thinking something like this:
The following options are allowed:
true
would prefix each file (default).false
would result in completely disabling.'src/**/*.ts'
only prefix files that matches this glob expression.Describe alternatives you've considered
We can keep hard coding it, but disable it for
testResources
, but I don't like this magic default and it wouldn't work for all projects.The configuration option name candidates:
sandbox.tsNoCheck
sandbox['@ts-nocheck']
sandbox.disableTypeChecking
I would like to make it a property of
sandbox
, in order to later add amode
property there as well (see #2163 ).@simondel what do you think? It does add (additional) complexity, but the default would be fine for 99.9% of use cases anyhow IMHO, so it is acceptable?
The text was updated successfully, but these errors were encountered: