squally-reporter 0.5.0 → 0.5.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.
- package/dist/index.js +40 -2
- package/package.json +41 -41
package/dist/index.js
CHANGED
|
@@ -640,10 +640,45 @@ function confirmReasonMessage(reason) {
|
|
|
640
640
|
function artifactLabel(type) {
|
|
641
641
|
return type === "screenshot" ? "Screenshot" : "Trace";
|
|
642
642
|
}
|
|
643
|
+
/**
|
|
644
|
+
* Wait, WITHOUT letting the process die during the wait.
|
|
645
|
+
*
|
|
646
|
+
* The timer is deliberately NOT unref'd, and that is the whole content of this
|
|
647
|
+
* function. An unref'd timer does not hold Node's event loop open, so a promise
|
|
648
|
+
* that only an unref'd timer can resolve is a promise the process may never
|
|
649
|
+
* wait for: if nothing else is pending, Node treats the loop as empty and exits
|
|
650
|
+
* THERE, with whatever `process.exitCode` happens to be - which is 0.
|
|
651
|
+
*
|
|
652
|
+
* That shipped in 0.5.0 and made a FAILING test suite report a GREEN CI job:
|
|
653
|
+
*
|
|
654
|
+
* 0.4.0 await new Promise((resolve) => setTimeout(resolve, EXIT_DRAIN_MS));
|
|
655
|
+
* 0.5.0 await delay(EXIT_DRAIN_MS); // helper below, which unref'd
|
|
656
|
+
*
|
|
657
|
+
* Playwright computes the exit code only AFTER awaiting every reporter's
|
|
658
|
+
* onEnd - the runner multiplexer awaits `reporter.onEnd(result)` and the CLI
|
|
659
|
+
* then calls `gracefullyProcessExitDoNotHang(status === "passed" ? 0 : 1)`.
|
|
660
|
+
* Exiting during onEnd skips the line that would have set 1. Measured: the same
|
|
661
|
+
* 250 ms wait exits 0 when unref'd and 1 when not, on a suite with a failing
|
|
662
|
+
* test.
|
|
663
|
+
*
|
|
664
|
+
* EVERY caller is awaited from inside onEnd, directly or through
|
|
665
|
+
* drainAndComplete's retries, so every one of them needs this. There is no
|
|
666
|
+
* "this wait is unimportant" case: a wait nobody needs should not be awaited at
|
|
667
|
+
* all. The first fix for the bug above kept an opt-out for the retry backoffs
|
|
668
|
+
* and was still wrong - a server returning 503 on /complete reproduced the
|
|
669
|
+
* green-on-red exit through exactly that path (measured, 10.09.).
|
|
670
|
+
*
|
|
671
|
+
* Ref'ing costs nothing here: Playwright ends the process with `process.exit()`,
|
|
672
|
+
* which does not wait for pending timers, so a still-running backoff cannot
|
|
673
|
+
* delay anyone's CI.
|
|
674
|
+
*
|
|
675
|
+
* NOT to be confused with the two unref'd timers elsewhere in this file, both
|
|
676
|
+
* of which are correct: withDeadline's timer races a real promise, and the
|
|
677
|
+
* periodic flush timer is never awaited by anything.
|
|
678
|
+
*/
|
|
643
679
|
function delay(ms) {
|
|
644
680
|
return new Promise((resolve) => {
|
|
645
|
-
|
|
646
|
-
handle.unref();
|
|
681
|
+
setTimeout(resolve, ms);
|
|
647
682
|
});
|
|
648
683
|
}
|
|
649
684
|
// Retry-After per RFC 9110: either an integer number of seconds, or an
|
|
@@ -754,6 +789,9 @@ class SquallyReporter {
|
|
|
754
789
|
// See EXIT_DRAIN_MS - closing the dispatcher resolves before the
|
|
755
790
|
// underlying sockets are fully gone, and Playwright exits the process
|
|
756
791
|
// the moment onEnd() resolves.
|
|
792
|
+
// This wait exists precisely to keep the process alive while sockets
|
|
793
|
+
// finish closing - see delay(), and test/exit-code's failing-suite
|
|
794
|
+
// scenario, which is what catches it if the unref ever comes back.
|
|
757
795
|
await delay(EXIT_DRAIN_MS);
|
|
758
796
|
}
|
|
759
797
|
};
|
package/package.json
CHANGED
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "squally-reporter",
|
|
3
|
-
"version": "0.5.
|
|
4
|
-
"description": "Playwright reporter that sends test results to your Squally dashboard.",
|
|
5
|
-
"author": "Squally <squally.dev@gmail.com>",
|
|
6
|
-
"keywords": [
|
|
7
|
-
"playwright",
|
|
8
|
-
"playwright-reporter",
|
|
9
|
-
"flaky-tests",
|
|
10
|
-
"test-results",
|
|
11
|
-
"ci"
|
|
12
|
-
],
|
|
13
|
-
"main": "dist/index.js",
|
|
14
|
-
"types": "dist/index.d.ts",
|
|
15
|
-
"files": [
|
|
16
|
-
"dist"
|
|
17
|
-
],
|
|
18
|
-
"engines": {
|
|
19
|
-
"node": ">=22.19.0"
|
|
20
|
-
},
|
|
21
|
-
"scripts": {
|
|
22
|
-
"build": "tsc",
|
|
23
|
-
"prepublishOnly": "npm run build",
|
|
24
|
-
"prepare": "npm run build",
|
|
25
|
-
"test:unit": "node --test \"test/unit/**/*.test.js\"",
|
|
26
|
-
"test:exit-code": "node test/exit-code/run.mjs",
|
|
27
|
-
"test": "npm run build && npm run test:unit && npm run test:exit-code"
|
|
28
|
-
},
|
|
29
|
-
"peerDependencies": {
|
|
30
|
-
"@playwright/test": ">=1.30.0"
|
|
31
|
-
},
|
|
32
|
-
"devDependencies": {
|
|
33
|
-
"@playwright/test": "^1.48.0",
|
|
34
|
-
"@types/node": "^20.14.0",
|
|
35
|
-
"typescript": "^5.6.0"
|
|
36
|
-
},
|
|
37
|
-
"license": "MIT",
|
|
38
|
-
"dependencies": {
|
|
39
|
-
"undici": "^8.10.0"
|
|
40
|
-
}
|
|
41
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "squally-reporter",
|
|
3
|
+
"version": "0.5.1",
|
|
4
|
+
"description": "Playwright reporter that sends test results to your Squally dashboard.",
|
|
5
|
+
"author": "Squally <squally.dev@gmail.com>",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"playwright",
|
|
8
|
+
"playwright-reporter",
|
|
9
|
+
"flaky-tests",
|
|
10
|
+
"test-results",
|
|
11
|
+
"ci"
|
|
12
|
+
],
|
|
13
|
+
"main": "dist/index.js",
|
|
14
|
+
"types": "dist/index.d.ts",
|
|
15
|
+
"files": [
|
|
16
|
+
"dist"
|
|
17
|
+
],
|
|
18
|
+
"engines": {
|
|
19
|
+
"node": ">=22.19.0"
|
|
20
|
+
},
|
|
21
|
+
"scripts": {
|
|
22
|
+
"build": "tsc",
|
|
23
|
+
"prepublishOnly": "npm run build",
|
|
24
|
+
"prepare": "npm run build",
|
|
25
|
+
"test:unit": "node --test \"test/unit/**/*.test.js\"",
|
|
26
|
+
"test:exit-code": "node test/exit-code/run.mjs",
|
|
27
|
+
"test": "npm run build && npm run test:unit && npm run test:exit-code"
|
|
28
|
+
},
|
|
29
|
+
"peerDependencies": {
|
|
30
|
+
"@playwright/test": ">=1.30.0"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"@playwright/test": "^1.48.0",
|
|
34
|
+
"@types/node": "^20.14.0",
|
|
35
|
+
"typescript": "^5.6.0"
|
|
36
|
+
},
|
|
37
|
+
"license": "MIT",
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"undici": "^8.10.0"
|
|
40
|
+
}
|
|
41
|
+
}
|