testit-adapter-jest 5.0.9 → 5.1.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/dist/testitEnvironment.js +23 -20
- package/package.json +2 -2
|
@@ -243,9 +243,9 @@ class TestItEnvironment extends jest_environment_node_1.default {
|
|
|
243
243
|
startedOn: test.startedAt ? new Date(test.startedAt) : undefined,
|
|
244
244
|
duration: test.duration ?? undefined,
|
|
245
245
|
traces: errorTraces,
|
|
246
|
-
attachments: this.additions.attachments,
|
|
246
|
+
attachments: [...this.additions.attachments],
|
|
247
247
|
message: this.additions.messages.join("\n").concat(errorMessage ?? ""),
|
|
248
|
-
links: this.additions.links,
|
|
248
|
+
links: [...this.additions.links],
|
|
249
249
|
};
|
|
250
250
|
if (this.importRealtime) {
|
|
251
251
|
this.realtimeSent.push({ autotest: autotestSnapshot, result });
|
|
@@ -261,6 +261,8 @@ class TestItEnvironment extends jest_environment_node_1.default {
|
|
|
261
261
|
catch (err) {
|
|
262
262
|
testit_js_commons_2.logger.error("Failed realtime send in Jest environment:", this.formatError(err));
|
|
263
263
|
}
|
|
264
|
+
// Keep sync-storage LastStatus fresh; otherwise Force Work X fires after ~60s.
|
|
265
|
+
await Promise.resolve(this.strategy.touchWorker?.()).catch(() => undefined);
|
|
264
266
|
}
|
|
265
267
|
else {
|
|
266
268
|
this.autotests.push(autotestSnapshot);
|
|
@@ -318,24 +320,20 @@ class TestItEnvironment extends jest_environment_node_1.default {
|
|
|
318
320
|
teardownSteps: teardownSteps.length,
|
|
319
321
|
testSteps: autotest.testSteps.length,
|
|
320
322
|
});
|
|
323
|
+
// Mutate the same AutotestResult instance that may be queued as deferred InProgress final.
|
|
324
|
+
// flushRealtimeTeardown patches teardownResults on this ref before strategy.teardown().
|
|
325
|
+
result.stepResults = autotest.testSteps;
|
|
326
|
+
result.setupResults = setupSteps;
|
|
327
|
+
result.teardownResults = teardownSteps;
|
|
328
|
+
result.parameters = autotest.parameters !== undefined ? (0, utils_1.mapParams)(autotest.parameters) : undefined;
|
|
321
329
|
const autotestPost = this.buildAutotestPost(autotest, setupSteps, teardownSteps);
|
|
330
|
+
// Avoid writing empty teardown to the Autotest card before afterAll is known —
|
|
331
|
+
// a full replace with [] would clear a previously uploaded afterAll until flush.
|
|
332
|
+
if (!includeAfterAll) {
|
|
333
|
+
autotestPost.teardown = undefined;
|
|
334
|
+
}
|
|
322
335
|
await this.strategy.loadAutotest(autotestPost, result.outcome);
|
|
323
|
-
await this.strategy.loadTestRun([
|
|
324
|
-
{
|
|
325
|
-
autoTestExternalId: autotestPost.externalId,
|
|
326
|
-
outcome: result.outcome,
|
|
327
|
-
startedOn: result.startedOn,
|
|
328
|
-
duration: result.duration,
|
|
329
|
-
attachments: result.attachments,
|
|
330
|
-
message: result.message,
|
|
331
|
-
links: result.links,
|
|
332
|
-
stepResults: autotest.testSteps,
|
|
333
|
-
traces: result.traces,
|
|
334
|
-
setupResults: setupSteps,
|
|
335
|
-
teardownResults: teardownSteps,
|
|
336
|
-
parameters: autotest.parameters !== undefined ? (0, utils_1.mapParams)(autotest.parameters) : undefined,
|
|
337
|
-
},
|
|
338
|
-
]);
|
|
336
|
+
await this.strategy.loadTestRun([result]);
|
|
339
337
|
}
|
|
340
338
|
/** afterAll hooks run after all tests; patch teardown when importRealtime is enabled. */
|
|
341
339
|
async flushRealtimeTeardown() {
|
|
@@ -351,10 +349,15 @@ class TestItEnvironment extends jest_environment_node_1.default {
|
|
|
351
349
|
tests: this.realtimeSent.length,
|
|
352
350
|
afterAllSteps: this.afterAllSteps.length,
|
|
353
351
|
});
|
|
352
|
+
// Patch shared result refs first so deferred final POST (strategy.teardown) includes afterAll.
|
|
353
|
+
for (const { autotest, result } of this.realtimeSent) {
|
|
354
|
+
result.setupResults = this.buildSetupSteps(autotest);
|
|
355
|
+
result.teardownResults = this.buildTeardownSteps(autotest, true);
|
|
356
|
+
}
|
|
354
357
|
for (const { autotest, result } of this.realtimeSent) {
|
|
355
358
|
try {
|
|
356
|
-
const setupSteps =
|
|
357
|
-
const teardownSteps =
|
|
359
|
+
const setupSteps = result.setupResults ?? [];
|
|
360
|
+
const teardownSteps = result.teardownResults ?? [];
|
|
358
361
|
if (setupSteps.length === 0 && teardownSteps.length === 0) {
|
|
359
362
|
continue;
|
|
360
363
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "testit-adapter-jest",
|
|
3
|
-
"version": "5.0
|
|
3
|
+
"version": "5.1.0",
|
|
4
4
|
"description": "Jest adapter for Test IT",
|
|
5
5
|
"main": "dist/testitEnvironment.js",
|
|
6
6
|
"scripts": {
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"license": "ISC",
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"debug": "^4.3.4",
|
|
19
|
-
"testit-js-commons": "5.0
|
|
19
|
+
"testit-js-commons": "5.1.0"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@types/debug": "^4.1.7",
|