diff --git a/src/ng-jest-transformer.spec.ts b/src/ng-jest-transformer.spec.ts index 686874a55c..0c089a8da4 100644 --- a/src/ng-jest-transformer.spec.ts +++ b/src/ng-jest-transformer.spec.ts @@ -105,6 +105,7 @@ describe('NgJestTransformer', () => { // eslint-disable-next-line @typescript-eslint/no-explicit-any const transformSyncMock = transformSync as unknown as jest.MockInstance; const transformCfg = { + cacheFS: new Map(), config: { cwd: process.cwd(), extensionsToTreatAsEsm: [], @@ -161,6 +162,7 @@ describe('NgJestTransformer', () => { // eslint-disable-next-line @typescript-eslint/no-explicit-any const transformSyncMock = transformSync as unknown as jest.MockInstance; const transformCfg = { + cacheFS: new Map(), config: { cwd: process.cwd(), extensionsToTreatAsEsm: [], diff --git a/src/ng-jest-transformer.ts b/src/ng-jest-transformer.ts index cd284dec17..95cc4450e6 100644 --- a/src/ng-jest-transformer.ts +++ b/src/ng-jest-transformer.ts @@ -50,7 +50,8 @@ export class NgJestTransformer extends TsJestTransformer { filePath: Config.Path, transformOptions: TransformOptionsTsJest, ): TransformedSource | string { - const configSet = this._createConfigSet(transformOptions.config); + // @ts-expect-error we are accessing the private cache to avoid creating new objects all the time + const configSet = super._configsFor(transformOptions); /** * TypeScript < 4.5 doesn't support compiling `.mjs` file by default when running `tsc` which throws error. Also we * transform `js` files from `node_modules` assuming that `node_modules` contains compiled files to speed up compilation.