I understand that Stryker type checks (using typescript that is) the current file being tested. Could we have an option to transpile all files so that we can be sure any mutations used would not have been caught by type checking?
I am using typescript to add safety and relying on the type checking so that I do not have to write extra tests just for types. If a mutation in file1.ts results in a type error in file2.ts stryker won't know about it and the mutant will be used to check if a test failes. As I am relying on typescript to catch this kind of bug I don't then want to have to write extra tests just for stryker!
@leonormes stryker does not change anything to create issue with types (probably emptying function could cause an issue, but i am not sure). If there is type error in your code, it won't be transpiled by typescript, so stryker won't even start.
@kmdrGroch If there is a type error the mutant isn't even tested, indeed. However @leonormes is correct in that when a mutant in foo.ts causes a type error in bar.ts it won't result in a compile error (or TranspileError as we call it). This issue is created after the discussion on Gitter, thanks for that.
but how can mutant cause type error? I cannot imagine an example
When we empty a function, we may cause a type error because a return value is expected, either explicitly in the definition of the function, or implicitly by code that calls the function.
@simondel, @nicojs, what about instead of empty function, provide sth like:
function functionName(): someType {
return new someType();
}
Or replace "someType" with "any"
We'll be reworking the way we check for errors in the future so I'm closing this issue for now.
Most helpful comment
When we empty a function, we may cause a type error because a return value is expected, either explicitly in the definition of the function, or implicitly by code that calls the function.