@quenty/nevermore-cli 4.50.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.
Files changed (47) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/commands/tools-command/ci-post-test-results.d.ts.map +1 -1
  3. package/dist/commands/tools-command/ci-post-test-results.js +7 -3
  4. package/dist/commands/tools-command/ci-post-test-results.js.map +1 -1
  5. package/dist/utils/batch/changed-packages-utils.d.ts +8 -0
  6. package/dist/utils/batch/changed-packages-utils.d.ts.map +1 -1
  7. package/dist/utils/batch/changed-packages-utils.js +9 -11
  8. package/dist/utils/batch/changed-packages-utils.js.map +1 -1
  9. package/dist/utils/testing/parsers/annotation-workspace.d.ts +17 -0
  10. package/dist/utils/testing/parsers/annotation-workspace.d.ts.map +1 -0
  11. package/dist/utils/testing/parsers/annotation-workspace.js +47 -0
  12. package/dist/utils/testing/parsers/annotation-workspace.js.map +1 -0
  13. package/dist/utils/testing/parsers/index.d.ts +0 -1
  14. package/dist/utils/testing/parsers/index.d.ts.map +1 -1
  15. package/dist/utils/testing/parsers/index.js +0 -1
  16. package/dist/utils/testing/parsers/index.js.map +1 -1
  17. package/dist/utils/testing/parsers/jest-lua-parser.d.ts +14 -29
  18. package/dist/utils/testing/parsers/jest-lua-parser.d.ts.map +1 -1
  19. package/dist/utils/testing/parsers/jest-lua-parser.js +85 -100
  20. package/dist/utils/testing/parsers/jest-lua-parser.js.map +1 -1
  21. package/dist/utils/testing/parsers/jest-lua-parser.test.js +359 -56
  22. package/dist/utils/testing/parsers/jest-lua-parser.test.js.map +1 -1
  23. package/dist/utils/testing/parsers/roblox-path-resolver.d.ts +23 -17
  24. package/dist/utils/testing/parsers/roblox-path-resolver.d.ts.map +1 -1
  25. package/dist/utils/testing/parsers/roblox-path-resolver.js +89 -54
  26. package/dist/utils/testing/parsers/roblox-path-resolver.js.map +1 -1
  27. package/dist/utils/testing/parsers/roblox-path-resolver.test.js +76 -36
  28. package/dist/utils/testing/parsers/roblox-path-resolver.test.js.map +1 -1
  29. package/dist/utils/testing/runner/combined-project-generator.d.ts.map +1 -1
  30. package/dist/utils/testing/runner/combined-project-generator.js +5 -6
  31. package/dist/utils/testing/runner/combined-project-generator.js.map +1 -1
  32. package/dist/utils/testing/runner/test-project-slug.d.ts +11 -0
  33. package/dist/utils/testing/runner/test-project-slug.d.ts.map +1 -0
  34. package/dist/utils/testing/runner/test-project-slug.js +11 -0
  35. package/dist/utils/testing/runner/test-project-slug.js.map +1 -0
  36. package/package.json +6 -6
  37. package/src/commands/tools-command/ci-post-test-results.ts +7 -2
  38. package/src/utils/batch/changed-packages-utils.ts +21 -12
  39. package/src/utils/testing/parsers/annotation-workspace.ts +74 -0
  40. package/src/utils/testing/parsers/index.ts +0 -1
  41. package/src/utils/testing/parsers/jest-lua-parser.test.ts +433 -65
  42. package/src/utils/testing/parsers/jest-lua-parser.ts +131 -109
  43. package/src/utils/testing/parsers/roblox-path-resolver.test.ts +144 -61
  44. package/src/utils/testing/parsers/roblox-path-resolver.ts +117 -56
  45. package/src/utils/testing/runner/combined-project-generator.ts +9 -13
  46. package/src/utils/testing/runner/test-project-slug.ts +18 -0
  47. package/tsconfig.tsbuildinfo +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quenty/nevermore-cli",
3
- "version": "4.50.0",
3
+ "version": "4.50.1",
4
4
  "description": "CLI interface for Nevermore",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -25,11 +25,11 @@
25
25
  "Quenty"
26
26
  ],
27
27
  "dependencies": {
28
- "@quenty/cli-output-helpers": "1.19.0",
29
- "@quenty/nevermore-cli-helpers": "1.20.0",
28
+ "@quenty/cli-output-helpers": "1.19.1",
29
+ "@quenty/nevermore-cli-helpers": "1.20.1",
30
30
  "@quenty/nevermore-deploy": "1.1.1",
31
- "@quenty/nevermore-template-helpers": "1.21.0",
32
- "@quenty/studio-bridge": "0.22.0",
31
+ "@quenty/nevermore-template-helpers": "1.21.1",
32
+ "@quenty/studio-bridge": "0.22.1",
33
33
  "execa": "^9.6.1",
34
34
  "find-git-root": "^1.0.4",
35
35
  "inquirer": "^13.2.0",
@@ -60,5 +60,5 @@
60
60
  "engines": {
61
61
  "node": ">=16"
62
62
  },
63
- "gitHead": "8ccad9d519f633a4af6659664374605cf2df7ecf"
63
+ "gitHead": "e663d6c2e0577e2831040d2a922a3c636fb62007"
64
64
  }
@@ -2,6 +2,7 @@ import { CommandModule } from 'yargs';
2
2
  import { OutputHelper } from '@quenty/cli-output-helpers';
3
3
  import {
4
4
  type Diagnostic,
5
+ dedupeDiagnostics,
5
6
  emitAnnotations,
6
7
  writeAnnotationSummaryAsync,
7
8
  } from '@quenty/cli-output-helpers/reporting';
@@ -16,6 +17,7 @@ import {
16
17
  } from '../../utils/testing/reporting/index.js';
17
18
  import { parseJestLuaOutput } from '../../utils/testing/parsers/index.js';
18
19
  import { tryLoadSourcemapResolver } from '../../utils/sourcemap/index.js';
20
+ import { tryLoadAnnotationWorkspaceAsync } from '../../utils/testing/parsers/annotation-workspace.js';
19
21
 
20
22
  type ErrorReporter = Reporter & {
21
23
  setError(error: string): void;
@@ -99,14 +101,17 @@ export const ciPostTestResultsCommand: CommandModule<
99
101
 
100
102
  // Emit test failure annotations
101
103
  const sourcemapResolver = tryLoadSourcemapResolver(process.cwd());
102
- const allDiagnostics: Diagnostic[] = [];
104
+ const workspace = await tryLoadAnnotationWorkspaceAsync(process.cwd());
105
+ const parsedDiagnostics: Diagnostic[] = [];
103
106
  for (const failure of state.getFailures()) {
104
107
  const diagnostics = parseJestLuaOutput(failure.logs, {
105
108
  packageName: failure.packageName,
106
109
  sourcemapResolver,
110
+ workspace,
107
111
  });
108
- allDiagnostics.push(...diagnostics);
112
+ parsedDiagnostics.push(...diagnostics);
109
113
  }
114
+ const allDiagnostics = dedupeDiagnostics(parsedDiagnostics);
110
115
 
111
116
  if (allDiagnostics.length > 0) {
112
117
  OutputHelper.info(
@@ -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
- const { stdout } = await execa('pnpm', [
54
- 'ls',
55
- '--json',
56
- '-r',
57
- '--depth',
58
- '-1',
59
- ]);
58
+ return filterByTargetAsync(await listWorkspacePackagesAsync(), targetName);
59
+ }
60
60
 
61
- const packages = JSON.parse(stdout) as Array<{ name: string; path: string }>;
62
- return _filterByTargetAsync(packages, targetName);
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 _filterByTargetAsync(packages, targetName);
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
- async function _filterByTargetAsync(
185
- packages: Array<{ name: string; path: string }>,
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[] = [];
@@ -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
+ }
@@ -1,2 +1 @@
1
- export { resolveRobloxTestPath } from './roblox-path-resolver.js';
2
1
  export { parseJestLuaOutput } from './jest-lua-parser.js';