@quenty/nevermore-cli 4.50.0 → 4.51.0
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/batch-command/batch-bundle-command.d.ts +12 -0
- package/dist/commands/batch-command/batch-bundle-command.d.ts.map +1 -0
- package/dist/commands/batch-command/batch-bundle-command.js +96 -0
- package/dist/commands/batch-command/batch-bundle-command.js.map +1 -0
- package/dist/commands/batch-command/batch-test-command.d.ts +1 -0
- package/dist/commands/batch-command/batch-test-command.d.ts.map +1 -1
- package/dist/commands/batch-command/batch-test-command.js +103 -15
- package/dist/commands/batch-command/batch-test-command.js.map +1 -1
- package/dist/commands/batch-command/index.d.ts.map +1 -1
- package/dist/commands/batch-command/index.js +2 -0
- package/dist/commands/batch-command/index.js.map +1 -1
- package/dist/commands/tools-command/ci-post-test-results.d.ts +1 -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 +13 -4
- 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/job-context/batch-script-job-context.d.ts +12 -0
- package/dist/utils/job-context/batch-script-job-context.d.ts.map +1 -1
- package/dist/utils/job-context/batch-script-job-context.js +19 -0
- package/dist/utils/job-context/batch-script-job-context.js.map +1 -1
- package/dist/utils/sourcemap/sourcemap-loader.d.ts +3 -3
- package/dist/utils/sourcemap/sourcemap-loader.d.ts.map +1 -1
- package/dist/utils/sourcemap/sourcemap-loader.js +6 -7
- package/dist/utils/sourcemap/sourcemap-loader.js.map +1 -1
- package/dist/utils/testing/batch-run.e2e.test.js +36 -0
- 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/prebuilt-batch-bundle.d.ts +26 -0
- package/dist/utils/testing/runner/prebuilt-batch-bundle.d.ts.map +1 -0
- package/dist/utils/testing/runner/prebuilt-batch-bundle.js +200 -0
- package/dist/utils/testing/runner/prebuilt-batch-bundle.js.map +1 -0
- package/dist/utils/testing/runner/prebuilt-batch-bundle.test.d.ts +2 -0
- package/dist/utils/testing/runner/prebuilt-batch-bundle.test.d.ts.map +1 -0
- package/dist/utils/testing/runner/prebuilt-batch-bundle.test.js +181 -0
- package/dist/utils/testing/runner/prebuilt-batch-bundle.test.js.map +1 -0
- 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/dist/utils/testing/runner/test-runner.d.ts +8 -1
- package/dist/utils/testing/runner/test-runner.d.ts.map +1 -1
- package/dist/utils/testing/runner/test-runner.js +19 -6
- package/dist/utils/testing/runner/test-runner.js.map +1 -1
- package/package.json +7 -6
- package/src/commands/batch-command/batch-bundle-command.ts +140 -0
- package/src/commands/batch-command/batch-test-command.ts +156 -16
- package/src/commands/batch-command/index.ts +2 -0
- package/src/commands/tools-command/ci-post-test-results.ts +18 -3
- package/src/utils/batch/changed-packages-utils.ts +21 -12
- package/src/utils/job-context/batch-script-job-context.ts +34 -3
- package/src/utils/sourcemap/sourcemap-loader.ts +7 -9
- package/src/utils/testing/batch-run.e2e.test.ts +42 -0
- 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/prebuilt-batch-bundle.test.ts +252 -0
- package/src/utils/testing/runner/prebuilt-batch-bundle.ts +267 -0
- package/src/utils/testing/runner/test-project-slug.ts +18 -0
- package/src/utils/testing/runner/test-runner.ts +43 -13
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -142,6 +142,7 @@ class FakeTransport implements JobContext {
|
|
|
142
142
|
public scriptContent?: string;
|
|
143
143
|
public scriptContents: string[] = [];
|
|
144
144
|
public deployedPaths: string[] = [];
|
|
145
|
+
public deployedTargets: unknown[] = [];
|
|
145
146
|
public deployCount = 0;
|
|
146
147
|
public runCount = 0;
|
|
147
148
|
public messagesFor?: (script: string) => TaskLogMessage[];
|
|
@@ -160,6 +161,7 @@ class FakeTransport implements JobContext {
|
|
|
160
161
|
): Promise<Deployment> {
|
|
161
162
|
this.deployCount++;
|
|
162
163
|
this.deployedPaths.push(options.builtPlace.rbxlPath);
|
|
164
|
+
this.deployedTargets.push(options.builtPlace.target);
|
|
163
165
|
return {};
|
|
164
166
|
}
|
|
165
167
|
|
|
@@ -506,4 +508,44 @@ describe('an aggregated batch run, end to end', () => {
|
|
|
506
508
|
])
|
|
507
509
|
);
|
|
508
510
|
});
|
|
511
|
+
|
|
512
|
+
it('runs prebuilt places on the target it was given, without building', async () => {
|
|
513
|
+
const generate = vi.mocked(
|
|
514
|
+
(await import('./runner/combined-project-generator.js'))
|
|
515
|
+
.generateCombinedProjectAsync
|
|
516
|
+
);
|
|
517
|
+
generate.mockClear();
|
|
518
|
+
const { targets } = createBatch();
|
|
519
|
+
const transport = new FakeTransport(TASK_MESSAGES);
|
|
520
|
+
const cleanupAsync = vi.fn(async () => {});
|
|
521
|
+
const batch = new BatchScriptJobContext(transport, targets, {
|
|
522
|
+
repoRoot: '/repo',
|
|
523
|
+
batchPlaceId: 900,
|
|
524
|
+
batchUniverseId: 901,
|
|
525
|
+
prebuilt: {
|
|
526
|
+
chunks: [
|
|
527
|
+
{
|
|
528
|
+
rbxlPath: '/bundle/place-1.rbxl',
|
|
529
|
+
slugMap: SLUG_MAP,
|
|
530
|
+
sizeBytes: 1024,
|
|
531
|
+
},
|
|
532
|
+
],
|
|
533
|
+
buildContext: { cleanupAsync } as any,
|
|
534
|
+
},
|
|
535
|
+
});
|
|
536
|
+
|
|
537
|
+
const alpha = await runPackageAsync(batch, '@quenty/alpha');
|
|
538
|
+
const beta = await runPackageAsync(batch, '@quenty/beta');
|
|
539
|
+
|
|
540
|
+
expect(generate).not.toHaveBeenCalled();
|
|
541
|
+
expect(transport.deployedPaths).toEqual(['/bundle/place-1.rbxl']);
|
|
542
|
+
expect(transport.deployedTargets).toEqual([
|
|
543
|
+
{ placeId: 900, universeId: 901, project: '' },
|
|
544
|
+
]);
|
|
545
|
+
expect(alpha.success).toBe(true);
|
|
546
|
+
expect(beta.success).toBe(false);
|
|
547
|
+
|
|
548
|
+
await batch.disposeAsync();
|
|
549
|
+
expect(cleanupAsync).toHaveBeenCalledOnce();
|
|
550
|
+
});
|
|
509
551
|
});
|
|
@@ -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
|
+
}
|