angular-builders
angular-builders copied to clipboard
@angular-builders/jest - Support jest.config in typescript
Is your feature request related to a problem? Please describe.
According https://jestjs.io/docs/configuration it's possible to use a Typescript jest-config if ts-node
is installed, but I tried it and I got An unhandled exception occurred: Cannot use import statement outside a module
Should I include it in the tsconfig.spec.ts
that I'm passing to ts-jest
? or there's just no support ATM?
Describe the solution you'd like
Support a typescript config file in the angular.json
.
What is the full exception? This looks like an error I'm working through related to the Angular 13 upgrade. We use jest-preset-angular
. The builder migration doc and linked migration doc for jest-preset-angular and this comment on the jest-preset-angular v13 support issue were really helpful for getting our tests working again.
Reading your question more carefully, though, are you asking to support a Typescript config file? jest.config.ts
?
@littleninja yeah, TS config instead the JS file perhaps my use case was about customizing the VIrtualConsole and I found the objects created in my config doesn't keep the type after the processing done by the builder, so probably this is not worth anyways :shrug: