@hughescr/stryker-bun-runner 1.2.0 → 1.2.2
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/README.md +1 -0
- package/dist/coverage/preload-logic.js +2 -2
- package/dist/index.d.ts +110 -2
- package/dist/index.js +861 -648
- package/dist/templates/coverage-preload.ts +14 -28
- package/package.json +4 -1
|
@@ -81,39 +81,23 @@ function extractFilePrefix(bunMain: string): string {
|
|
|
81
81
|
|
|
82
82
|
if(syncPort && shouldCollectCoverage) {
|
|
83
83
|
try {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
ws.onmessage = (_event) => {
|
|
87
|
-
// Messages from the sync server are only 'ready' signals.
|
|
88
|
-
// No per-test relay needed — coverage keys are file-prefixed counters.
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
// Wait for ready signal
|
|
84
|
+
// Install the real 'ready' handler before yielding to the event loop so
|
|
85
|
+
// there is no window where an arriving message is silently dropped.
|
|
92
86
|
await new Promise<void>((resolve) => {
|
|
87
|
+
ws = new WebSocket(`ws://localhost:${syncPort}/sync`);
|
|
93
88
|
const timeout = setTimeout(() => {
|
|
94
89
|
console.warn('[Stryker] Timeout waiting for ready signal');
|
|
95
90
|
resolve();
|
|
96
|
-
},
|
|
97
|
-
|
|
98
|
-
const wsInstance = ws;
|
|
99
|
-
if(!wsInstance) {
|
|
100
|
-
clearTimeout(timeout);
|
|
101
|
-
resolve();
|
|
102
|
-
return;
|
|
103
|
-
}
|
|
91
|
+
}, 2000);
|
|
104
92
|
|
|
105
|
-
|
|
106
|
-
wsInstance.onmessage = (event) => {
|
|
93
|
+
ws.onmessage = (event) => {
|
|
107
94
|
if(event.data === 'ready') {
|
|
108
95
|
clearTimeout(timeout);
|
|
109
96
|
resolve();
|
|
110
97
|
}
|
|
111
|
-
if(originalOnMessage) {
|
|
112
|
-
originalOnMessage.call(wsInstance, event);
|
|
113
|
-
}
|
|
114
98
|
};
|
|
115
99
|
|
|
116
|
-
|
|
100
|
+
ws.onerror = () => {
|
|
117
101
|
clearTimeout(timeout);
|
|
118
102
|
console.warn('[Stryker] Failed to connect to sync server');
|
|
119
103
|
resolve();
|
|
@@ -125,23 +109,25 @@ if(syncPort && shouldCollectCoverage) {
|
|
|
125
109
|
} else if(syncPort && !shouldCollectCoverage) {
|
|
126
110
|
// No coverage collection, just wait for ready signal
|
|
127
111
|
try {
|
|
128
|
-
|
|
112
|
+
// Install the real 'ready' handler before yielding to the event loop so
|
|
113
|
+
// there is no window where an arriving message is silently dropped.
|
|
129
114
|
await new Promise<void>((resolve) => {
|
|
115
|
+
const wsLocal = new WebSocket(`ws://localhost:${syncPort}/sync`);
|
|
130
116
|
const timeout = setTimeout(() => {
|
|
131
|
-
|
|
117
|
+
wsLocal.close();
|
|
132
118
|
console.warn('[Stryker Sync] Timeout waiting for ready signal, proceeding anyway');
|
|
133
119
|
resolve();
|
|
134
|
-
},
|
|
120
|
+
}, 2000);
|
|
135
121
|
|
|
136
|
-
|
|
122
|
+
wsLocal.onmessage = (event) => {
|
|
137
123
|
if(event.data === 'ready') {
|
|
138
124
|
clearTimeout(timeout);
|
|
139
|
-
|
|
125
|
+
wsLocal.close();
|
|
140
126
|
resolve();
|
|
141
127
|
}
|
|
142
128
|
};
|
|
143
129
|
|
|
144
|
-
|
|
130
|
+
wsLocal.onerror = () => {
|
|
145
131
|
clearTimeout(timeout);
|
|
146
132
|
console.warn('[Stryker Sync] Failed to connect to sync server, proceeding anyway');
|
|
147
133
|
resolve();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hughescr/stryker-bun-runner",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.2",
|
|
4
4
|
"description": "Stryker test runner plugin for Bun with perTest coverage support",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"stryker",
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
},
|
|
20
20
|
"license": "Apache-2.0",
|
|
21
21
|
"author": "hughescr",
|
|
22
|
+
"sideEffects": false,
|
|
22
23
|
"type": "module",
|
|
23
24
|
"exports": {
|
|
24
25
|
".": {
|
|
@@ -57,6 +58,8 @@
|
|
|
57
58
|
"eslint": "10.2.1",
|
|
58
59
|
"eslint-formatter-overview": "2.0.0",
|
|
59
60
|
"eslint-formatter-unix": "9.0.1",
|
|
61
|
+
"eslint-plugin-import-x": "4.16.2",
|
|
62
|
+
"eslint-plugin-n": "17.24.0",
|
|
60
63
|
"typescript": "6.0.3"
|
|
61
64
|
},
|
|
62
65
|
"peerDependencies": {
|