Skip to content

Commit 3564b4c

Browse files
committed
fix(nx-infra-plugin): fix CLDR deps resolution in localization e2e tests
1 parent 970c632 commit 3564b4c

File tree

2 files changed

+35
-2
lines changed

2 files changed

+35
-2
lines changed

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

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,17 @@ import * as fs from 'fs';
22
import * as path from 'path';
33
import executor from './executor';
44
import { LocalizationExecutorSchema } from './schema';
5-
import { createTempDir, cleanupTempDir, createMockContext } from '../../utils/test-utils';
6-
import { writeFileText, writeJson, readFileText } from '../../utils';
5+
import {
6+
writeFileText,
7+
writeJson,
8+
cleanupTempDir,
9+
readFileText,
10+
createTempDir,
11+
createMockContext,
12+
findWorkspaceRoot,
13+
} from '../../utils';
14+
15+
const WORKSPACE_ROOT = findWorkspaceRoot();
716

817
const PROJECT_SUBPATH = ['packages', 'test-lib'] as const;
918

@@ -122,6 +131,16 @@ describe('LocalizationExecutor E2E', () => {
122131
tempDir = createTempDir('nx-localization-e2e-');
123132
context = createMockContext({ root: tempDir });
124133
fixture = await createLocalizationTestFixture(tempDir);
134+
135+
const devextremeNodeModules = path.join(
136+
WORKSPACE_ROOT,
137+
'packages',
138+
'devextreme',
139+
'node_modules',
140+
);
141+
142+
const tempNodeModules = path.join(fixture.projectDir, 'node_modules');
143+
fs.symlinkSync(devextremeNodeModules, tempNodeModules, 'junction');
125144
});
126145

127146
afterEach(() => {

packages/nx-infra-plugin/src/utils/test-utils.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,17 @@ export function createMockContext(options: MockContextOptions = {}): ExecutorCon
4141
},
4242
};
4343
}
44+
45+
export function findWorkspaceRoot(): string {
46+
let dir = process.cwd();
47+
while (dir !== path.dirname(dir)) {
48+
if (
49+
fs.existsSync(path.join(dir, 'nx.json'))
50+
|| fs.existsSync(path.join(dir, 'pnpm-workspace.yaml'))
51+
) {
52+
return dir;
53+
}
54+
dir = path.dirname(dir);
55+
}
56+
throw new Error('Could not find workspace root');
57+
}

0 commit comments

Comments
 (0)