fix(testing): do not inherit existing env (#30688)

<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->

Inheriting the existing environment variable here causes tests to fail
for some reason.

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

This reverts it to how it functioned before and fixes the failing tests.

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #
This commit is contained in:
Jason Jean 2025-04-11 14:25:49 -04:00 committed by GitHub
parent f839b070f0
commit f3013ccafe
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 1 additions and 5 deletions

View File

@ -245,7 +245,7 @@
"nxCloudId": "62d013ea0852fe0a2df74438", "nxCloudId": "62d013ea0852fe0a2df74438",
"nxCloudUrl": "https://staging.nx.app", "nxCloudUrl": "https://staging.nx.app",
"parallel": 1, "parallel": 1,
"bust": 6, "bust": 7,
"defaultBase": "master", "defaultBase": "master",
"conformance": { "conformance": {
"rules": [ "rules": [

View File

@ -253,11 +253,7 @@ async function buildJestTargets(
const targets: Record<string, TargetConfiguration> = {}; const targets: Record<string, TargetConfiguration> = {};
const namedInputs = getNamedInputs(projectRoot, context); const namedInputs = getNamedInputs(projectRoot, context);
const existingTsNodeCompilerOptions = process.env['TS_NODE_COMPILER_OPTIONS'];
const tsNodeCompilerOptions = JSON.stringify({ const tsNodeCompilerOptions = JSON.stringify({
...(existingTsNodeCompilerOptions
? JSON.parse(existingTsNodeCompilerOptions)
: {}),
moduleResolution: 'node10', moduleResolution: 'node10',
module: 'commonjs', module: 'commonjs',
customConditions: null, customConditions: null,