🚀 Feature Proposal
A new option for transformOptions to tell transformers if Jest runs in watch mode.
Motivation
I have a scenario in ts-jest related to kulshekhar/ts-jest#943
// foo.ts
export function getWelcomeMessage(username: string): string {
return `yolo ${username}`;
}
// foo.spec.ts
it(`should return a message for this username`, (): void => {
const result = getWelcomeMessage(username);
expect(result).toStrictEqual(`yolo C0ZEN`);
});
- Run test in watch mode, the test passes successfully
- Modify
foo.ts to
// foo.ts
export function getWelcomeMessage(username: number): string {
return `yolo ${username}`;
}
- Now test is rerun, however test still passes because
ts-jest doesn't know if Jest runs in watch mode to properly redo type check
Example
A new option for transformOptions can be named something like watchMode and ts-jest can use that.
Currently I'm using a workaround that I have a check process.argv.includes('--watch'), it works but not optimal.
Pitch
Allow transformers to perform certain logic depending on watch mode
cc @SimenB @thymikee
🚀 Feature Proposal
A new option for
transformOptionsto tell transformers if Jest runs in watch mode.Motivation
I have a scenario in
ts-jestrelated to kulshekhar/ts-jest#943foo.tstots-jestdoesn't know if Jest runs in watch mode to properly redo type checkExample
A new option for
transformOptionscan be named something likewatchModeandts-jestcan use that.Currently I'm using a workaround that I have a check
process.argv.includes('--watch'), it works but not optimal.Pitch
Allow transformers to perform certain logic depending on watch mode
cc @SimenB @thymikee