angular-builders icon indicating copy to clipboard operation
angular-builders copied to clipboard

@angular-builders/jest - Support jest.config in typescript

Open myndco opened this issue 3 years ago • 2 comments

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.

myndco avatar Nov 17 '21 05:11 myndco

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 avatar Jan 06 '22 18:01 littleninja

@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:

matheo avatar Jan 06 '22 23:01 matheo