@quenty/nevermore-cli 4.50.1 → 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.
Files changed (50) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/commands/batch-command/batch-bundle-command.d.ts +12 -0
  3. package/dist/commands/batch-command/batch-bundle-command.d.ts.map +1 -0
  4. package/dist/commands/batch-command/batch-bundle-command.js +96 -0
  5. package/dist/commands/batch-command/batch-bundle-command.js.map +1 -0
  6. package/dist/commands/batch-command/batch-test-command.d.ts +1 -0
  7. package/dist/commands/batch-command/batch-test-command.d.ts.map +1 -1
  8. package/dist/commands/batch-command/batch-test-command.js +103 -15
  9. package/dist/commands/batch-command/batch-test-command.js.map +1 -1
  10. package/dist/commands/batch-command/index.d.ts.map +1 -1
  11. package/dist/commands/batch-command/index.js +2 -0
  12. package/dist/commands/batch-command/index.js.map +1 -1
  13. package/dist/commands/tools-command/ci-post-test-results.d.ts +1 -0
  14. package/dist/commands/tools-command/ci-post-test-results.d.ts.map +1 -1
  15. package/dist/commands/tools-command/ci-post-test-results.js +6 -1
  16. package/dist/commands/tools-command/ci-post-test-results.js.map +1 -1
  17. package/dist/utils/job-context/batch-script-job-context.d.ts +12 -0
  18. package/dist/utils/job-context/batch-script-job-context.d.ts.map +1 -1
  19. package/dist/utils/job-context/batch-script-job-context.js +19 -0
  20. package/dist/utils/job-context/batch-script-job-context.js.map +1 -1
  21. package/dist/utils/sourcemap/sourcemap-loader.d.ts +3 -3
  22. package/dist/utils/sourcemap/sourcemap-loader.d.ts.map +1 -1
  23. package/dist/utils/sourcemap/sourcemap-loader.js +6 -7
  24. package/dist/utils/sourcemap/sourcemap-loader.js.map +1 -1
  25. package/dist/utils/testing/batch-run.e2e.test.js +36 -0
  26. package/dist/utils/testing/batch-run.e2e.test.js.map +1 -1
  27. package/dist/utils/testing/runner/prebuilt-batch-bundle.d.ts +26 -0
  28. package/dist/utils/testing/runner/prebuilt-batch-bundle.d.ts.map +1 -0
  29. package/dist/utils/testing/runner/prebuilt-batch-bundle.js +200 -0
  30. package/dist/utils/testing/runner/prebuilt-batch-bundle.js.map +1 -0
  31. package/dist/utils/testing/runner/prebuilt-batch-bundle.test.d.ts +2 -0
  32. package/dist/utils/testing/runner/prebuilt-batch-bundle.test.d.ts.map +1 -0
  33. package/dist/utils/testing/runner/prebuilt-batch-bundle.test.js +181 -0
  34. package/dist/utils/testing/runner/prebuilt-batch-bundle.test.js.map +1 -0
  35. package/dist/utils/testing/runner/test-runner.d.ts +8 -1
  36. package/dist/utils/testing/runner/test-runner.d.ts.map +1 -1
  37. package/dist/utils/testing/runner/test-runner.js +19 -6
  38. package/dist/utils/testing/runner/test-runner.js.map +1 -1
  39. package/package.json +7 -6
  40. package/src/commands/batch-command/batch-bundle-command.ts +140 -0
  41. package/src/commands/batch-command/batch-test-command.ts +156 -16
  42. package/src/commands/batch-command/index.ts +2 -0
  43. package/src/commands/tools-command/ci-post-test-results.ts +11 -1
  44. package/src/utils/job-context/batch-script-job-context.ts +34 -3
  45. package/src/utils/sourcemap/sourcemap-loader.ts +7 -9
  46. package/src/utils/testing/batch-run.e2e.test.ts +42 -0
  47. package/src/utils/testing/runner/prebuilt-batch-bundle.test.ts +252 -0
  48. package/src/utils/testing/runner/prebuilt-batch-bundle.ts +267 -0
  49. package/src/utils/testing/runner/test-runner.ts +43 -13
  50. package/tsconfig.tsbuildinfo +1 -1
@@ -2,7 +2,10 @@ import * as fs from 'fs/promises';
2
2
  import * as path from 'path';
3
3
  import { randomUUID } from 'crypto';
4
4
  import { type DeployTarget } from '@quenty/nevermore-deploy';
5
- import { type JobContext } from '../../job-context/job-context.js';
5
+ import {
6
+ type BuiltPlace,
7
+ type JobContext,
8
+ } from '../../job-context/job-context.js';
6
9
  import { type DeployOverrides } from '../../build/build.js';
7
10
  import {
8
11
  type ParsedTestCounts,
@@ -88,6 +91,12 @@ export interface SingleTestOptions {
88
91
  suppressCountsProvenance?: boolean;
89
92
  }
90
93
 
94
+ export interface PreparedTest {
95
+ builtPlace: BuiltPlace;
96
+ scriptContent: string;
97
+ hasJestConfig: boolean;
98
+ }
99
+
91
100
  /**
92
101
  * Build, deploy, and run a test for a single package using the provided
93
102
  * JobContext. The context determines the execution environment (cloud or local).
@@ -98,17 +107,15 @@ export async function runSingleTestAsync(
98
107
  context: JobContext,
99
108
  options: SingleTestOptions
100
109
  ): Promise<SingleTestResult> {
101
- const {
102
- packagePath,
103
- packageName,
104
- // 300s is the Open Cloud maximum. The old 120s default failed real suites
105
- // with no jest summary at all, so "--timeout 300" had become folklore
106
- // everyone had to know before their first useful run.
107
- timeoutMs = 300_000,
108
- scriptText,
109
- target,
110
- overrides,
111
- } = options;
110
+ const prepared = await prepareTestAsync(context, options);
111
+ return executePreparedTestAsync(context, prepared, options);
112
+ }
113
+
114
+ export async function prepareTestAsync(
115
+ context: JobContext,
116
+ options: SingleTestOptions
117
+ ): Promise<PreparedTest> {
118
+ const { packagePath, packageName, scriptText, target, overrides } = options;
112
119
 
113
120
  const sessionId = randomUUID();
114
121
  const builtPlace = await context.buildPlaceAsync({
@@ -140,6 +147,29 @@ export async function runSingleTestAsync(
140
147
  scriptText ??
141
148
  (await readTestScriptAsync(packagePath, builtPlace.target.scriptTemplate));
142
149
 
150
+ return {
151
+ builtPlace,
152
+ scriptContent,
153
+ hasJestConfig: await packageHasJestConfigAsync(packagePath),
154
+ };
155
+ }
156
+
157
+ export async function executePreparedTestAsync(
158
+ context: JobContext,
159
+ prepared: PreparedTest,
160
+ options: SingleTestOptions
161
+ ): Promise<SingleTestResult> {
162
+ const {
163
+ packagePath,
164
+ packageName,
165
+ // 300s is the Open Cloud maximum. The old 120s default failed real suites
166
+ // with no jest summary at all, so "--timeout 300" had become folklore
167
+ // everyone had to know before their first useful run.
168
+ timeoutMs = 300_000,
169
+ scriptText,
170
+ } = options;
171
+ const { builtPlace, scriptContent, hasJestConfig } = prepared;
172
+
143
173
  const deployment = await context.deployBuiltPlaceAsync({
144
174
  builtPlace,
145
175
  packageName,
@@ -185,7 +215,7 @@ export async function runSingleTestAsync(
185
215
  structured !== undefined &&
186
216
  !structured.ranJest &&
187
217
  scriptText === undefined &&
188
- (await packageHasJestConfigAsync(packagePath));
218
+ hasJestConfig;
189
219
 
190
220
  const reasons = mergeFailureReasons(result.errorMessage, [
191
221
  ...(smokeTestedWithSpecs