Prerequisites
Describe the Feature Request
Stencil tests should be able to run using Jest ES Module support, instead of transpiling all ESM modules to CJS. This needs to be done to improve test perf, and because ESM is preferred in all modern projects that are used in browsers.
Right now, stencil jest support hard-codes CJS output: https://github.com/ionic-team/stencil/blob/main/src/testing/test-transpile.ts
Describe the Use Case
When I run stencil tests, I should have the option to run them in Jest ESM mode.
The lack of this feature causes bugs and wasted dev effort, eg: #2178
Performance should be improved b/c .mjs files (most dependencies) will no longer need to be transpiled. Dev cycle speed is important!
In addition, there are behavioral differences between CJS and ESM, and it's valuable for the test environment to be as similar as possible to the runtime environment.
Describe Preferred Solution
A config option exists for running tests in Jest ESM mode.
Describe Alternatives
No response
Related Code
No response
Additional Information
https://kulshekhar.github.io/ts-jest/docs/next/guides/esm-support/
Related issues:
I'm willing to work on a PR for this - looks like it shouldn't be too hard.
Prerequisites
Describe the Feature Request
Stencil tests should be able to run using Jest ES Module support, instead of transpiling all ESM modules to CJS. This needs to be done to improve test perf, and because ESM is preferred in all modern projects that are used in browsers.
Right now, stencil jest support hard-codes CJS output: https://github.com/ionic-team/stencil/blob/main/src/testing/test-transpile.ts
Describe the Use Case
When I run stencil tests, I should have the option to run them in Jest ESM mode.
The lack of this feature causes bugs and wasted dev effort, eg: #2178
Performance should be improved b/c .mjs files (most dependencies) will no longer need to be transpiled. Dev cycle speed is important!
In addition, there are behavioral differences between CJS and ESM, and it's valuable for the test environment to be as similar as possible to the runtime environment.
Describe Preferred Solution
A config option exists for running tests in Jest ESM mode.
Describe Alternatives
No response
Related Code
No response
Additional Information
https://kulshekhar.github.io/ts-jest/docs/next/guides/esm-support/
Related issues:
I'm willing to work on a PR for this - looks like it shouldn't be too hard.