Skip to content

Commit

Permalink
fix(testing): set TS_NODE_PROJECT before running Jest so j.config.ts …
Browse files Browse the repository at this point in the history
…file transpile using the root tsconfig file (nrwl#20372)
  • Loading branch information
jaysoo authored Nov 22, 2023
1 parent d2b444c commit 729bb5c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/jest/src/executors/jest/jest.impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,16 @@ 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(
options: JestExecutorOptions,
context: ExecutorContext
): Promise<{ success: boolean }> {
const config = await jestConfigParser(options, context);
process.env['TS_NODE_PROJECT'] ??= getRootTsConfigPath();

const { results } = await runCLI(config, [options.jestConfig]);

Expand Down

0 comments on commit 729bb5c

Please sign in to comment.