Skip to content

Commit 900aa50

Browse files
committed
fix(nx-infra-plugin): fix babel-transform E2E tests failing under pnpx nx
1 parent 9ead2c5 commit 900aa50

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

packages/nx-infra-plugin/src/executors/babel-transform/executor.e2e.spec.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,25 @@ describe('BabelTransformExecutor E2E', () => {
4646
let tempDir: string;
4747
let context = createMockContext();
4848
let projectDir: string;
49+
let savedCwd: string;
4950

5051
beforeEach(async () => {
52+
savedCwd = process.cwd();
5153
tempDir = createTempDir('nx-babel-e2e-');
5254
context = createMockContext({ root: tempDir });
5355
projectDir = path.join(tempDir, 'packages', 'test-lib');
5456
fs.mkdirSync(projectDir, { recursive: true });
5557

56-
const workspaceNodeModules = path.join(WORKSPACE_ROOT, 'node_modules');
58+
const infraPluginNodeModules = path.join(
59+
WORKSPACE_ROOT,
60+
'packages',
61+
'nx-infra-plugin',
62+
'node_modules',
63+
);
5764
const tempNodeModules = path.join(projectDir, 'node_modules');
58-
fs.symlinkSync(workspaceNodeModules, tempNodeModules, 'junction');
65+
fs.symlinkSync(infraPluginNodeModules, tempNodeModules, 'junction');
66+
67+
process.chdir(projectDir);
5968

6069
const buildDir = path.join(projectDir, 'build', 'gulp');
6170
fs.mkdirSync(buildDir, { recursive: true });
@@ -93,6 +102,7 @@ export function helper() {
93102
});
94103

95104
afterEach(() => {
105+
process.chdir(savedCwd);
96106
cleanupTempDir(tempDir);
97107
});
98108

0 commit comments

Comments
 (0)