-
Notifications
You must be signed in to change notification settings - Fork 396
Description
When trying to set custom tsconfig compiler options for ts-jest, the generated output is incorrect:
Example .projenrc.ts
:
new awscdk.AwsCdkConstructLibrary({
// ...
tsJestOptions: {
transformOptions: {
tsconfig: TsJestTsconfig.custom({
compilerOptions: { isolatedModules: true },
}),
},
},
})
This generates the following package.json
:
{
"jest": {
"transform": {
"^.+\\.[t]sx?$": [
"ts-jest",
{
"tsconfig": {
"compilerOptions": {
"isolatedModules": true
}
}
}
]
}
}
}
However, when running pj test
an error is shown:
● Test suite failed to run
error TS5023: Unknown compiler option 'compilerOptions'.
I'm pretty sure that the compilerOptions
field in the package.json should not be there. Instead it should look like this, matching the ts-jest docs.
{
"jest": {
"transform": {
"^.+\\.[t]sx?$": [
"ts-jest",
{
"tsconfig": {
"isolatedModules": true
}
}
]
}
}
}
I suppose a possible fix could be to change the TsJestTsconfig.custom function like this:
-public static custom(config: TypescriptConfigOptions) {
+public static custom(config: TypeScriptCompilerOptions) {
knthls
Metadata
Metadata
Assignees
Labels
No labels