Chore:-(Jest-types)-Added strict type for option extension toTreatAsEsm
Make extensionsToTreatAsEsm type stricter by excluding 3 error cases .js, .cjs and .mjs.
Can you add a type test?
Sure could you give some direction how should i do it?
https://github.com/facebook/jest/blob/601ba290cd3c456c433461326df4c98dd4d07161/packages/jest-types/typetests/config.test.ts
Then yarn test-types to run them
https://github.com/facebook/jest/blob/601ba290cd3c456c433461326df4c98dd4d07161/packages/jest-types/typetests/config.test.ts
Then
yarn test-typesto run them
Thanks will wrap it up soon!
@mrazauskas could you guide me up a little bit on how should i add test for the types, feeling overwhelmed looking at the config.test.ts file
Probably something like this:
expectAssignable<Config.InitialOptions>({
extensionsToTreatAsEsm: ['.ts'],
});
expectError<Config.InitialOptions>({
extensionsToTreatAsEsm: '.ts', // should error, because the expression is not array
});
// test each excluded extension like this
expectError<Config.InitialOptions>({
extensionsToTreatAsEsm: ['.js'], // should error if the implementation works
});
This PR is stale because it has been open 1 year with no activity. Remove stale label or comment or this will be closed in 30 days.
This PR was closed because it has been stalled for 30 days with no activity. Please open a new PR if the issue is still relevant, linking to this one.
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.