@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.
- package/CHANGELOG.md +6 -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 +6 -1
- package/dist/commands/tools-command/ci-post-test-results.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/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-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 +11 -1
- 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/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-runner.ts +43 -13
- 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 {
|
|
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
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
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
|
-
|
|
218
|
+
hasJestConfig;
|
|
189
219
|
|
|
190
220
|
const reasons = mergeFailureReasons(result.errorMessage, [
|
|
191
221
|
...(smokeTestedWithSpecs
|