-
Notifications
You must be signed in to change notification settings - Fork 309
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(config): set
allowJs: true
internally always (#976)
Closes #974
- Loading branch information
Showing
11 changed files
with
52 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
{ | ||
"extends": "./tsconfig.spec.json", | ||
"compilerOptions": { | ||
"module": "ESNext", | ||
"allowJs": true | ||
"module": "ESNext" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
{ | ||
"extends": "./tsconfig.spec.json", | ||
"compilerOptions": { | ||
"module": "ESNext", | ||
"allowJs": true | ||
"module": "ESNext" | ||
} | ||
} |
3 changes: 1 addition & 2 deletions
3
examples/example-app-v12-monorepo/projects/app1/tsconfig-esm.spec.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
{ | ||
"extends": "./tsconfig.spec.json", | ||
"compilerOptions": { | ||
"module": "ESNext", | ||
"allowJs": true | ||
"module": "ESNext" | ||
} | ||
} |
3 changes: 1 addition & 2 deletions
3
examples/example-app-v12-monorepo/projects/app2/tsconfig-esm.spec.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
{ | ||
"extends": "./tsconfig.spec.json", | ||
"compilerOptions": { | ||
"module": "ESNext", | ||
"allowJs": true | ||
"module": "ESNext" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
{ | ||
"extends": "./tsconfig.spec.json", | ||
"compilerOptions": { | ||
"module": "ESNext", | ||
"allowJs": true | ||
"module": "ESNext" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
{ | ||
"extends": "./tsconfig.spec.json", | ||
"compilerOptions": { | ||
"module": "ESNext", | ||
"allowJs": true | ||
"module": "ESNext" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { NgJestConfig } from '../config/ng-jest-config'; | ||
|
||
describe('NgJestConfig', () => { | ||
test('should override some compiler options', () => { | ||
const compilerOptions = new NgJestConfig(Object.create(null)).parsedTsConfig.options; | ||
|
||
expect(compilerOptions.enableIvy).toBe(true); | ||
expect(compilerOptions.noEmitOnError).toBe(false); | ||
expect(compilerOptions.suppressOutputPathCheck).toBe(true); | ||
expect(compilerOptions.allowEmptyCodegenFiles).toBe(false); | ||
expect(compilerOptions.annotationsAs).toBe('decorators'); | ||
expect(compilerOptions.enableResourceInlining).toBe(false); | ||
expect(compilerOptions.allowJs).toBe(true); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { ConfigSet } from 'ts-jest/dist/config/config-set'; | ||
import type { RawCompilerOptions } from 'ts-jest/dist/raw-compiler-options'; | ||
import type { ParsedCommandLine } from 'typescript'; | ||
|
||
export class NgJestConfig extends ConfigSet { | ||
/** | ||
* Override `ts-jest` behavior because we use `readConfiguration` which will read and resolve tsconfig. | ||
*/ | ||
protected _resolveTsConfig(compilerOptions?: RawCompilerOptions, resolvedConfigFile?: string): ParsedCommandLine { | ||
const result = super._resolveTsConfig(compilerOptions, resolvedConfigFile); | ||
result.options.enableIvy = true; | ||
result.options.noEmitOnError = false; | ||
result.options.suppressOutputPathCheck = true; | ||
result.options.allowEmptyCodegenFiles = false; | ||
result.options.annotationsAs = 'decorators'; | ||
result.options.enableResourceInlining = false; | ||
// Since we define preset default also transform `js` so we need to set `allowJs` true | ||
result.options.allowJs = true; | ||
|
||
return result as ParsedCommandLine; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters