@quenty/nevermore-cli 4.49.0 → 4.50.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/commands/tools-command/ci-post-test-results.d.ts.map +1 -1
- package/dist/commands/tools-command/ci-post-test-results.js +7 -3
- package/dist/commands/tools-command/ci-post-test-results.js.map +1 -1
- package/dist/utils/batch/changed-packages-utils.d.ts +8 -0
- package/dist/utils/batch/changed-packages-utils.d.ts.map +1 -1
- package/dist/utils/batch/changed-packages-utils.js +9 -11
- package/dist/utils/batch/changed-packages-utils.js.map +1 -1
- package/dist/utils/testing/batch-run.e2e.test.js +2 -2
- package/dist/utils/testing/batch-run.e2e.test.js.map +1 -1
- package/dist/utils/testing/parsers/annotation-workspace.d.ts +17 -0
- package/dist/utils/testing/parsers/annotation-workspace.d.ts.map +1 -0
- package/dist/utils/testing/parsers/annotation-workspace.js +47 -0
- package/dist/utils/testing/parsers/annotation-workspace.js.map +1 -0
- package/dist/utils/testing/parsers/index.d.ts +0 -1
- package/dist/utils/testing/parsers/index.d.ts.map +1 -1
- package/dist/utils/testing/parsers/index.js +0 -1
- package/dist/utils/testing/parsers/index.js.map +1 -1
- package/dist/utils/testing/parsers/jest-lua-parser.d.ts +14 -29
- package/dist/utils/testing/parsers/jest-lua-parser.d.ts.map +1 -1
- package/dist/utils/testing/parsers/jest-lua-parser.js +85 -100
- package/dist/utils/testing/parsers/jest-lua-parser.js.map +1 -1
- package/dist/utils/testing/parsers/jest-lua-parser.test.js +359 -56
- package/dist/utils/testing/parsers/jest-lua-parser.test.js.map +1 -1
- package/dist/utils/testing/parsers/roblox-path-resolver.d.ts +23 -17
- package/dist/utils/testing/parsers/roblox-path-resolver.d.ts.map +1 -1
- package/dist/utils/testing/parsers/roblox-path-resolver.js +89 -54
- package/dist/utils/testing/parsers/roblox-path-resolver.js.map +1 -1
- package/dist/utils/testing/parsers/roblox-path-resolver.test.js +76 -36
- package/dist/utils/testing/parsers/roblox-path-resolver.test.js.map +1 -1
- package/dist/utils/testing/runner/combined-project-generator.d.ts.map +1 -1
- package/dist/utils/testing/runner/combined-project-generator.js +5 -6
- package/dist/utils/testing/runner/combined-project-generator.js.map +1 -1
- package/dist/utils/testing/runner/test-project-slug.d.ts +11 -0
- package/dist/utils/testing/runner/test-project-slug.d.ts.map +1 -0
- package/dist/utils/testing/runner/test-project-slug.js +11 -0
- package/dist/utils/testing/runner/test-project-slug.js.map +1 -0
- package/package.json +6 -6
- package/src/commands/tools-command/ci-post-test-results.ts +7 -2
- package/src/utils/batch/changed-packages-utils.ts +21 -12
- package/src/utils/testing/batch-run.e2e.test.ts +6 -2
- package/src/utils/testing/parsers/annotation-workspace.ts +74 -0
- package/src/utils/testing/parsers/index.ts +0 -1
- package/src/utils/testing/parsers/jest-lua-parser.test.ts +433 -65
- package/src/utils/testing/parsers/jest-lua-parser.ts +131 -109
- package/src/utils/testing/parsers/roblox-path-resolver.test.ts +144 -61
- package/src/utils/testing/parsers/roblox-path-resolver.ts +117 -56
- package/src/utils/testing/runner/combined-project-generator.ts +9 -13
- package/src/utils/testing/runner/test-project-slug.ts +18 -0
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -10,6 +10,11 @@ import {
|
|
|
10
10
|
toManifestPlaceInfo,
|
|
11
11
|
} from '@quenty/nevermore-deploy';
|
|
12
12
|
|
|
13
|
+
export interface WorkspacePackageInfo {
|
|
14
|
+
name: string;
|
|
15
|
+
path: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
13
18
|
export interface TargetPackage {
|
|
14
19
|
name: string;
|
|
15
20
|
path: string;
|
|
@@ -50,16 +55,19 @@ export interface BatchTarget {
|
|
|
50
55
|
export async function discoverAllTargetPackagesAsync(
|
|
51
56
|
targetName: string
|
|
52
57
|
): Promise<TargetPackage[]> {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
'--json',
|
|
56
|
-
'-r',
|
|
57
|
-
'--depth',
|
|
58
|
-
'-1',
|
|
59
|
-
]);
|
|
58
|
+
return filterByTargetAsync(await listWorkspacePackagesAsync(), targetName);
|
|
59
|
+
}
|
|
60
60
|
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
/** Every package in the pnpm workspace, with absolute paths. */
|
|
62
|
+
export async function listWorkspacePackagesAsync(
|
|
63
|
+
cwd?: string
|
|
64
|
+
): Promise<WorkspacePackageInfo[]> {
|
|
65
|
+
const { stdout } = await execa(
|
|
66
|
+
'pnpm',
|
|
67
|
+
['ls', '--json', '-r', '--depth', '-1'],
|
|
68
|
+
{ cwd }
|
|
69
|
+
);
|
|
70
|
+
return JSON.parse(stdout) as WorkspacePackageInfo[];
|
|
63
71
|
}
|
|
64
72
|
|
|
65
73
|
/**
|
|
@@ -92,7 +100,7 @@ export async function discoverChangedTargetPackagesAsync(
|
|
|
92
100
|
return [];
|
|
93
101
|
}
|
|
94
102
|
|
|
95
|
-
return
|
|
103
|
+
return filterByTargetAsync(packages, targetName);
|
|
96
104
|
}
|
|
97
105
|
|
|
98
106
|
/**
|
|
@@ -181,8 +189,9 @@ function _requireScriptTemplate(targets: BatchTarget[]): BatchTarget[] {
|
|
|
181
189
|
return withTemplate;
|
|
182
190
|
}
|
|
183
191
|
|
|
184
|
-
|
|
185
|
-
|
|
192
|
+
/** Keep the packages whose deploy config has `targetName`, with its places. */
|
|
193
|
+
export async function filterByTargetAsync(
|
|
194
|
+
packages: WorkspacePackageInfo[],
|
|
186
195
|
targetName: string
|
|
187
196
|
): Promise<TargetPackage[]> {
|
|
188
197
|
const results: TargetPackage[] = [];
|
|
@@ -485,8 +485,12 @@ describe('an aggregated batch run, end to end', () => {
|
|
|
485
485
|
'/tmp/batch-2.rbxl',
|
|
486
486
|
]);
|
|
487
487
|
expect(transport.runCount).toBe(2);
|
|
488
|
-
|
|
489
|
-
expect(
|
|
488
|
+
// The places run in parallel, so their scripts arrive in either order
|
|
489
|
+
expect(
|
|
490
|
+
transport.scriptContents.map((script) =>
|
|
491
|
+
script.includes('["alpha"]') ? 'alpha' : 'beta'
|
|
492
|
+
)
|
|
493
|
+
).toEqual(expect.arrayContaining(['alpha', 'beta']));
|
|
490
494
|
|
|
491
495
|
expect(alpha.success).toBe(true);
|
|
492
496
|
expect(alpha.testResults).toMatchObject({ passed: 68, total: 68 });
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import * as fs from 'fs/promises';
|
|
2
|
+
import * as path from 'path';
|
|
3
|
+
import {
|
|
4
|
+
filterByTargetAsync,
|
|
5
|
+
listWorkspacePackagesAsync,
|
|
6
|
+
} from '../../batch/changed-packages-utils.js';
|
|
7
|
+
import {
|
|
8
|
+
type TestRojoProject,
|
|
9
|
+
findTestProjectSlug,
|
|
10
|
+
} from '../runner/test-project-slug.js';
|
|
11
|
+
|
|
12
|
+
export interface AnnotationWorkspacePackage {
|
|
13
|
+
/** Repo-relative POSIX directory, e.g. `src/player-mock` */
|
|
14
|
+
dir: string;
|
|
15
|
+
/** Rojo project name, which the sourcemap uses */
|
|
16
|
+
projectName?: string;
|
|
17
|
+
/** Instance names the package gets in its test places */
|
|
18
|
+
testSlugs: string[];
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface AnnotationWorkspace {
|
|
22
|
+
packagesByName: Map<string, AnnotationWorkspacePackage>;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Index the pnpm workspace for mapping test output back to files. Returns
|
|
27
|
+
* `undefined` when the workspace can't be listed.
|
|
28
|
+
*/
|
|
29
|
+
export async function tryLoadAnnotationWorkspaceAsync(
|
|
30
|
+
repoRoot: string
|
|
31
|
+
): Promise<AnnotationWorkspace | undefined> {
|
|
32
|
+
let packages;
|
|
33
|
+
try {
|
|
34
|
+
packages = await listWorkspacePackagesAsync(repoRoot);
|
|
35
|
+
} catch {
|
|
36
|
+
return undefined;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const packagesByName = new Map<string, AnnotationWorkspacePackage>();
|
|
40
|
+
await Promise.all(
|
|
41
|
+
packages.map(async (pkg) => {
|
|
42
|
+
const project = await _tryReadJsonAsync<{ name?: string }>(
|
|
43
|
+
path.join(pkg.path, 'default.project.json')
|
|
44
|
+
);
|
|
45
|
+
packagesByName.set(pkg.name, {
|
|
46
|
+
dir: path.relative(repoRoot, pkg.path).replace(/\\/g, '/'),
|
|
47
|
+
projectName: project?.name,
|
|
48
|
+
testSlugs: [],
|
|
49
|
+
});
|
|
50
|
+
})
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
for (const testPackage of await filterByTargetAsync(packages, 'test')) {
|
|
54
|
+
const entry = packagesByName.get(testPackage.name);
|
|
55
|
+
if (!entry) continue;
|
|
56
|
+
for (const target of testPackage.activeTargets) {
|
|
57
|
+
const project = await _tryReadJsonAsync<TestRojoProject>(
|
|
58
|
+
path.resolve(testPackage.path, target.project)
|
|
59
|
+
);
|
|
60
|
+
const slug = project && findTestProjectSlug(project);
|
|
61
|
+
if (slug && !entry.testSlugs.includes(slug)) entry.testSlugs.push(slug);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return { packagesByName };
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
async function _tryReadJsonAsync<T>(filePath: string): Promise<T | undefined> {
|
|
69
|
+
try {
|
|
70
|
+
return JSON.parse(await fs.readFile(filePath, 'utf-8')) as T;
|
|
71
|
+
} catch {
|
|
72
|
+
return undefined;
|
|
73
|
+
}
|
|
74
|
+
}
|