diff --git a/packages/jest/src/executors/jest/jest.impl.ts b/packages/jest/src/executors/jest/jest.impl.ts index 2c8210d5cb..3b3daaf329 100644 --- a/packages/jest/src/executors/jest/jest.impl.ts +++ b/packages/jest/src/executors/jest/jest.impl.ts @@ -15,6 +15,8 @@ import { import { getSummary } from './summary'; import { readFileSync } from 'fs'; import type { BatchResults } from 'nx/src/tasks-runner/batch/batch-messages'; +import { getRootTsConfigPath } from '@nx/js'; + process.env.NODE_ENV ??= 'test'; export async function jestExecutor( @@ -22,6 +24,7 @@ export async function jestExecutor( context: ExecutorContext ): Promise<{ success: boolean }> { const config = await jestConfigParser(options, context); + process.env['TS_NODE_PROJECT'] ??= getRootTsConfigPath(); const { results } = await runCLI(config, [options.jestConfig]);