fix(testing): set TS_NODE_PROJECT before running Jest so j.config.ts file transpile using the root tsconfig file (#20372)
This commit is contained in:
parent
d2b444c23b
commit
729bb5c398
@ -15,6 +15,8 @@ import {
|
|||||||
import { getSummary } from './summary';
|
import { getSummary } from './summary';
|
||||||
import { readFileSync } from 'fs';
|
import { readFileSync } from 'fs';
|
||||||
import type { BatchResults } from 'nx/src/tasks-runner/batch/batch-messages';
|
import type { BatchResults } from 'nx/src/tasks-runner/batch/batch-messages';
|
||||||
|
import { getRootTsConfigPath } from '@nx/js';
|
||||||
|
|
||||||
process.env.NODE_ENV ??= 'test';
|
process.env.NODE_ENV ??= 'test';
|
||||||
|
|
||||||
export async function jestExecutor(
|
export async function jestExecutor(
|
||||||
@ -22,6 +24,7 @@ export async function jestExecutor(
|
|||||||
context: ExecutorContext
|
context: ExecutorContext
|
||||||
): Promise<{ success: boolean }> {
|
): Promise<{ success: boolean }> {
|
||||||
const config = await jestConfigParser(options, context);
|
const config = await jestConfigParser(options, context);
|
||||||
|
process.env['TS_NODE_PROJECT'] ??= getRootTsConfigPath();
|
||||||
|
|
||||||
const { results } = await runCLI(config, [options.jestConfig]);
|
const { results } = await runCLI(config, [options.jestConfig]);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user