@systemfsoftware/stryker-js 10.1.1 → 10.2.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 +14 -0
- package/dist/{Run.schema-BsSOfQnD.d.mts → Run.schema-B-Pi3bCB.d.mts} +1 -1
- package/dist/{Run.schema-B_KpPeBA.mjs → Run.schema-Ba34IwAY.mjs} +688 -29
- package/dist/{compiler-Faeg70AC.mjs → compiler-BTpMWGqK.mjs} +1 -170
- package/dist/{compiler-Dc7TYMb_.mjs → compiler-CEwQzMxZ.mjs} +1 -170
- package/dist/config.d.mts +1 -1
- package/dist/dist-CjdAPjrJ.mjs +1430 -0
- package/dist/dist-Cpq7Esc3.mjs +17404 -0
- package/dist/dist-DsmXFb2_.mjs +17404 -0
- package/dist/events.d.mts +1 -1
- package/dist/events.mjs +1 -1
- package/dist/{index-CogNSD0V.d.mts → index-tt2EziOT.d.mts} +2 -0
- package/dist/index.d.mts +9 -26
- package/dist/index.mjs +2 -2
- package/dist/main.mjs +6800 -760
- package/dist/{mutation-test.cell-DS86DvC9.d.mts → mutation-test.cell-Dq23b2NP.d.mts} +3 -2
- package/dist/promises.d.mts +2 -2
- package/dist/promises.mjs +1 -1
- package/dist/sourcemap-codec-qFD3eFBj.mjs +186 -0
- package/dist/{src-BkTsNvl0.mjs → src-CcqEZJIY.mjs} +144 -93
- package/package.json +18 -9
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { B as ReporterFactory, Ct as RunMutantResult, K as StrykerOptions, P as PartialStrykerOptions, W as ReporterRpcs, X as TestResult, _ as ExitClass, at as WorkerPluginKind, ct as FileDescription, ft as Mutant, j as MutationTestResult, l as CompleteDryRunResult, lt as FileDescriptions, st as CoverageData, yt as MutateDescription } from "./index-
|
|
1
|
+
import { B as ReporterFactory, Ct as RunMutantResult, K as StrykerOptions, P as PartialStrykerOptions, W as ReporterRpcs, X as TestResult, _ as ExitClass, at as WorkerPluginKind, ct as FileDescription, ft as Mutant, j as MutationTestResult, l as CompleteDryRunResult, lt as FileDescriptions, st as CoverageData, yt as MutateDescription } from "./index-tt2EziOT.mjs";
|
|
2
2
|
import { r as ResolvedMode } from "./output-mode-CfGHDpi5.mjs";
|
|
3
|
-
import { _ as RunStarted, c as PhaseEntered, i as HelpRendered, l as PlanKnown, m as RunMutantTested, p as RunFailed, r as Heartbeat, x as VerdictReached } from "./Run.schema-
|
|
3
|
+
import { _ as RunStarted, c as PhaseEntered, i as HelpRendered, l as PlanKnown, m as RunMutantTested, p as RunFailed, r as Heartbeat, x as VerdictReached } from "./Run.schema-B-Pi3bCB.mjs";
|
|
4
4
|
import * as Effect$1 from "effect/Effect";
|
|
5
5
|
import * as FileSystem from "effect/FileSystem";
|
|
6
6
|
import * as Path from "effect/Path";
|
|
@@ -1595,6 +1595,7 @@ declare const forkOptionsSchema: S.StructWithRest<S.Struct<{
|
|
|
1595
1595
|
readonly mutate: S.withDecodingDefaultKey<S.$Array<S.String>, never>;
|
|
1596
1596
|
readonly mutator: S.withDecodingDefaultKey<S.Struct<{
|
|
1597
1597
|
readonly excludedMutations: S.withDecodingDefaultKey<S.$Array<S.String>, never>;
|
|
1598
|
+
readonly optInMutations: S.withDecodingDefaultKey<S.$Array<S.String>, never>;
|
|
1598
1599
|
}>, never>;
|
|
1599
1600
|
readonly packageManager: S.optional<S.Literals<readonly ["npm", "yarn", "pnpm"]>>;
|
|
1600
1601
|
readonly plugins: S.withDecodingDefaultKey<S.$Array<S.String>, never>;
|
package/dist/promises.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { P as PartialStrykerOptions } from "./index-
|
|
2
|
-
import { t as MutationTestDone } from "./mutation-test.cell-
|
|
1
|
+
import { P as PartialStrykerOptions } from "./index-tt2EziOT.mjs";
|
|
2
|
+
import { t as MutationTestDone } from "./mutation-test.cell-Dq23b2NP.mjs";
|
|
3
3
|
//#region src/promises/index.d.ts
|
|
4
4
|
export declare const run: (options: PartialStrykerOptions, targetMutatePatterns?: readonly string[]) => Promise<MutationTestDone>;
|
|
5
5
|
//#endregion
|
package/dist/promises.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as strykerCell } from "./src-
|
|
1
|
+
import { t as strykerCell } from "./src-CcqEZJIY.mjs";
|
|
2
2
|
import * as Layer from "effect/Layer";
|
|
3
3
|
import * as NodeFileSystem from "@effect/platform-node-shared/NodeFileSystem";
|
|
4
4
|
import * as NodePath from "@effect/platform-node-shared/NodePath";
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
//#region ../../node_modules/.pnpm/@jridgewell+sourcemap-codec@1.6.0/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs
|
|
2
|
+
var comma = ",".charCodeAt(0);
|
|
3
|
+
var semicolon = ";".charCodeAt(0);
|
|
4
|
+
var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
5
|
+
var intToChar = /* @__PURE__ */ new Uint8Array(64);
|
|
6
|
+
var charToInt = /* @__PURE__ */ new Uint8Array(128);
|
|
7
|
+
for (let i = 0; i < chars.length; i++) {
|
|
8
|
+
const c = chars.charCodeAt(i);
|
|
9
|
+
intToChar[i] = c;
|
|
10
|
+
charToInt[c] = i;
|
|
11
|
+
}
|
|
12
|
+
function decodeInteger(reader) {
|
|
13
|
+
let value = 0;
|
|
14
|
+
let shift = 0;
|
|
15
|
+
let integer = 0;
|
|
16
|
+
do {
|
|
17
|
+
integer = charToInt[reader.next()];
|
|
18
|
+
value |= (integer & 31) << shift;
|
|
19
|
+
shift += 5;
|
|
20
|
+
} while (integer & 32);
|
|
21
|
+
return value;
|
|
22
|
+
}
|
|
23
|
+
function decodeSign(num) {
|
|
24
|
+
return num & 1 ? -2147483648 | -(num >>> 1) : num >>> 1;
|
|
25
|
+
}
|
|
26
|
+
function encodeInteger(builder, num) {
|
|
27
|
+
do {
|
|
28
|
+
let clamped = num & 31;
|
|
29
|
+
num >>>= 5;
|
|
30
|
+
if (num > 0) clamped |= 32;
|
|
31
|
+
builder.write(intToChar[clamped]);
|
|
32
|
+
} while (num > 0);
|
|
33
|
+
}
|
|
34
|
+
function encodeSign(num) {
|
|
35
|
+
return num < 0 ? -num << 1 | 1 : num << 1;
|
|
36
|
+
}
|
|
37
|
+
function hasMoreVlq(reader, max) {
|
|
38
|
+
if (reader.pos >= max) return false;
|
|
39
|
+
return reader.peek() !== comma;
|
|
40
|
+
}
|
|
41
|
+
var bufLength = 16384;
|
|
42
|
+
var td = typeof TextDecoder !== "undefined" ? /* @__PURE__ */ new TextDecoder() : typeof Buffer !== "undefined" ? { decode(buf) {
|
|
43
|
+
return Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength).toString();
|
|
44
|
+
} } : { decode(buf) {
|
|
45
|
+
let out = "";
|
|
46
|
+
for (let i = 0; i < buf.length; i++) out += String.fromCharCode(buf[i]);
|
|
47
|
+
return out;
|
|
48
|
+
} };
|
|
49
|
+
var StringWriter = class {
|
|
50
|
+
constructor() {
|
|
51
|
+
this.pos = 0;
|
|
52
|
+
this.out = "";
|
|
53
|
+
this.buffer = new Uint8Array(bufLength);
|
|
54
|
+
}
|
|
55
|
+
write(v) {
|
|
56
|
+
const { buffer } = this;
|
|
57
|
+
buffer[this.pos++] = v;
|
|
58
|
+
if (this.pos === bufLength) {
|
|
59
|
+
this.out += td.decode(buffer);
|
|
60
|
+
this.pos = 0;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
flush() {
|
|
64
|
+
const { buffer, out, pos } = this;
|
|
65
|
+
return pos > 0 ? out + td.decode(buffer.subarray(0, pos)) : out;
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
var StringReader = class {
|
|
69
|
+
constructor(buffer) {
|
|
70
|
+
this.pos = 0;
|
|
71
|
+
this.buffer = buffer;
|
|
72
|
+
}
|
|
73
|
+
next() {
|
|
74
|
+
return this.buffer.charCodeAt(this.pos++);
|
|
75
|
+
}
|
|
76
|
+
peek() {
|
|
77
|
+
return this.buffer.charCodeAt(this.pos);
|
|
78
|
+
}
|
|
79
|
+
indexOf(char) {
|
|
80
|
+
const { buffer, pos } = this;
|
|
81
|
+
const idx = buffer.indexOf(char, pos);
|
|
82
|
+
return idx === -1 ? buffer.length : idx;
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
function encodeRangeMappings(decoded) {
|
|
86
|
+
if (decoded.length === 0) return "";
|
|
87
|
+
const writer = new StringWriter();
|
|
88
|
+
for (let i = 0; i < decoded.length; i++) {
|
|
89
|
+
const indices = decoded[i];
|
|
90
|
+
if (i > 0) writer.write(semicolon);
|
|
91
|
+
let index = 0;
|
|
92
|
+
for (let j = 0; j < indices.length; j++) {
|
|
93
|
+
const offset = indices[j];
|
|
94
|
+
encodeInteger(writer, offset - index);
|
|
95
|
+
index = offset;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return writer.flush();
|
|
99
|
+
}
|
|
100
|
+
function decode(mappings) {
|
|
101
|
+
const { length } = mappings;
|
|
102
|
+
const reader = new StringReader(mappings);
|
|
103
|
+
const decoded = [];
|
|
104
|
+
let genColumn = 0;
|
|
105
|
+
let sourcesIndex = 0;
|
|
106
|
+
let sourceLine = 0;
|
|
107
|
+
let sourceColumn = 0;
|
|
108
|
+
let namesIndex = 0;
|
|
109
|
+
do {
|
|
110
|
+
const semi = reader.indexOf(";");
|
|
111
|
+
const line = [];
|
|
112
|
+
let sorted = true;
|
|
113
|
+
let lastCol = 0;
|
|
114
|
+
genColumn = 0;
|
|
115
|
+
while (reader.pos < semi) {
|
|
116
|
+
let seg;
|
|
117
|
+
genColumn += decodeSign(decodeInteger(reader));
|
|
118
|
+
if (genColumn < lastCol) sorted = false;
|
|
119
|
+
lastCol = genColumn;
|
|
120
|
+
if (hasMoreVlq(reader, semi)) {
|
|
121
|
+
sourcesIndex += decodeSign(decodeInteger(reader));
|
|
122
|
+
sourceLine += decodeSign(decodeInteger(reader));
|
|
123
|
+
sourceColumn += decodeSign(decodeInteger(reader));
|
|
124
|
+
if (hasMoreVlq(reader, semi)) {
|
|
125
|
+
namesIndex += decodeSign(decodeInteger(reader));
|
|
126
|
+
seg = [
|
|
127
|
+
genColumn,
|
|
128
|
+
sourcesIndex,
|
|
129
|
+
sourceLine,
|
|
130
|
+
sourceColumn,
|
|
131
|
+
namesIndex
|
|
132
|
+
];
|
|
133
|
+
} else seg = [
|
|
134
|
+
genColumn,
|
|
135
|
+
sourcesIndex,
|
|
136
|
+
sourceLine,
|
|
137
|
+
sourceColumn
|
|
138
|
+
];
|
|
139
|
+
} else seg = [genColumn];
|
|
140
|
+
line.push(seg);
|
|
141
|
+
reader.pos++;
|
|
142
|
+
}
|
|
143
|
+
if (!sorted) sort(line);
|
|
144
|
+
decoded.push(line);
|
|
145
|
+
reader.pos = semi + 1;
|
|
146
|
+
} while (reader.pos <= length);
|
|
147
|
+
return decoded;
|
|
148
|
+
}
|
|
149
|
+
function sort(line) {
|
|
150
|
+
line.sort(sortComparator);
|
|
151
|
+
}
|
|
152
|
+
function sortComparator(a, b) {
|
|
153
|
+
return a[0] - b[0];
|
|
154
|
+
}
|
|
155
|
+
function encode(decoded) {
|
|
156
|
+
const writer = new StringWriter();
|
|
157
|
+
let sourcesIndex = 0;
|
|
158
|
+
let sourceLine = 0;
|
|
159
|
+
let sourceColumn = 0;
|
|
160
|
+
let namesIndex = 0;
|
|
161
|
+
for (let i = 0; i < decoded.length; i++) {
|
|
162
|
+
const line = decoded[i];
|
|
163
|
+
if (i > 0) writer.write(semicolon);
|
|
164
|
+
if (line.length === 0) continue;
|
|
165
|
+
let genColumn = 0;
|
|
166
|
+
for (let j = 0; j < line.length; j++) {
|
|
167
|
+
const segment = line[j];
|
|
168
|
+
if (j > 0) writer.write(comma);
|
|
169
|
+
encodeInteger(writer, encodeSign(segment[0] - genColumn));
|
|
170
|
+
genColumn = segment[0];
|
|
171
|
+
if (segment.length === 1) continue;
|
|
172
|
+
encodeInteger(writer, encodeSign(segment[1] - sourcesIndex));
|
|
173
|
+
encodeInteger(writer, encodeSign(segment[2] - sourceLine));
|
|
174
|
+
encodeInteger(writer, encodeSign(segment[3] - sourceColumn));
|
|
175
|
+
sourcesIndex = segment[1];
|
|
176
|
+
sourceLine = segment[2];
|
|
177
|
+
sourceColumn = segment[3];
|
|
178
|
+
if (segment.length === 4) continue;
|
|
179
|
+
encodeInteger(writer, encodeSign(segment[4] - namesIndex));
|
|
180
|
+
namesIndex = segment[4];
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
return writer.flush();
|
|
184
|
+
}
|
|
185
|
+
//#endregion
|
|
186
|
+
export { encode as n, encodeRangeMappings as r, decode as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as WorkerEntryUrl, F as MutationTestingPlanReady, G as TRACEPARENT_HEADER, I as NonNegativeInt, J as TestRunnerFailed, K as TRACESTATE_HEADER, L as PropagatedTrace, M as MutantTested, N as MutationTestReportReady, O as Metrics, P as MutationTestResultSchema, Q as WALL_CLOCK_TIMEOUT_REASON, S as CheckerMutantWire, T as DryRunCompleted, U as ReporterRpcs, V as ReporterFailed, W as StrykerOptionsSchema, X as TraceContextMiddleware, Y as TestRunnerRpcs, Z as TraceContextReference, _ as RunStarted, at as wallClockTimeoutStopsRun, c as PhaseEntered, ct as Mutant, et as WorkerPluginKind, f as RunEvent, ft as disableTypeChecks, ht as normalizeFileName$4, it as toMutantRunResult, k as MetricsResultSchema, l as PlanKnown, m as RunMutantTested, mt as instrument, n as StageError, nt as isCustomTestRunner, ot as INSTRUMENTER_CONSTANTS, pt as errorToString, r as Heartbeat, rt as parseTraceparent, t as PrepareError, tt as formatTraceparent, v as VerdictReached, w as CheckerRpcs } from "./Run.schema-
|
|
1
|
+
import { $ as WorkerEntryUrl, F as MutationTestingPlanReady, G as TRACEPARENT_HEADER, I as NonNegativeInt, J as TestRunnerFailed, K as TRACESTATE_HEADER, L as PropagatedTrace, M as MutantTested, N as MutationTestReportReady, O as Metrics, P as MutationTestResultSchema, Q as WALL_CLOCK_TIMEOUT_REASON, S as CheckerMutantWire, T as DryRunCompleted, U as ReporterRpcs, V as ReporterFailed, W as StrykerOptionsSchema, X as TraceContextMiddleware, Y as TestRunnerRpcs, Z as TraceContextReference, _ as RunStarted, at as wallClockTimeoutStopsRun, c as PhaseEntered, ct as Mutant, et as WorkerPluginKind, f as RunEvent, ft as disableTypeChecks, ht as normalizeFileName$4, it as toMutantRunResult, k as MetricsResultSchema, l as PlanKnown, m as RunMutantTested, mt as instrument, n as StageError, nt as isCustomTestRunner, ot as INSTRUMENTER_CONSTANTS, pt as errorToString, r as Heartbeat, rt as parseTraceparent, t as PrepareError, tt as formatTraceparent, v as VerdictReached, w as CheckerRpcs } from "./Run.schema-Ba34IwAY.mjs";
|
|
2
2
|
import { t as mergeConfig } from "./merge-config-CHZWyvVQ.mjs";
|
|
3
3
|
import * as Effect$1 from "effect/Effect";
|
|
4
4
|
import * as FileSystem from "effect/FileSystem";
|
|
@@ -46,12 +46,13 @@ import * as NodeChildProcessSpawner from "@effect/platform-node-shared/NodeChild
|
|
|
46
46
|
import * as NodeCrypto from "@effect/platform-node-shared/NodeCrypto";
|
|
47
47
|
import * as Crypto from "effect/Crypto";
|
|
48
48
|
import * as RpcClient from "effect/unstable/rpc/RpcClient";
|
|
49
|
+
import * as Semaphore from "effect/Semaphore";
|
|
50
|
+
import { activateSandbox, createHarnessApi, createRegistry, deactivateSandbox, drainRegistry, guardedExpect, guardedVi, installInterception, makeEffectMethods, nativeImport, uninstallInterception, writeGlobalState } from "@systemfsoftware/stryker-vm-harness";
|
|
49
51
|
import * as Schedule from "effect/Schedule";
|
|
50
52
|
import * as Data from "effect/Data";
|
|
51
53
|
import * as Equivalence from "effect/Equivalence";
|
|
52
54
|
import * as Metric from "effect/Metric";
|
|
53
55
|
import * as Pool from "effect/Pool";
|
|
54
|
-
import * as Semaphore from "effect/Semaphore";
|
|
55
56
|
import * as SchemaTransformation$1 from "effect/SchemaTransformation";
|
|
56
57
|
import { randomBytes } from "@noble/hashes/utils.js";
|
|
57
58
|
import * as Console from "effect/Console";
|
|
@@ -1091,46 +1092,37 @@ const vmRunnerName = "vm";
|
|
|
1091
1092
|
const ALL_TESTS_NAME = "All tests";
|
|
1092
1093
|
const isVmRunner = (name) => typeof name === "string" && name.toLowerCase() === "vm";
|
|
1093
1094
|
const vmRunnerCapabilities = { reloadEnvironment: true };
|
|
1094
|
-
const FALLBACK_FILE_NAME = "stryker-vm-tests.js";
|
|
1095
1095
|
const errorText = (error) => Match.value(error).pipe(Match.when(Match.instanceOf(Error), (failure) => failure.message), Match.orElse((value) => String(value)));
|
|
1096
|
-
const
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
catch: (cause) => compileFailure(file, cause)
|
|
1105
|
-
}))));
|
|
1106
|
-
const fileName = Option.getOrElse(Option.fromUndefinedOr(testFiles.at(0)), () => FALLBACK_FILE_NAME);
|
|
1096
|
+
const isInitFailure = (error) => {
|
|
1097
|
+
if (error instanceof SyntaxError) return true;
|
|
1098
|
+
if (typeof error !== "object" || error === null) return false;
|
|
1099
|
+
if ("code" in error && error.code === "ERR_MODULE_NOT_FOUND") return true;
|
|
1100
|
+
return error instanceof Error && error.message.includes("[PARSE_ERROR]");
|
|
1101
|
+
};
|
|
1102
|
+
const runFailureFor = (file, cause) => {
|
|
1103
|
+
const fatal = isInitFailure(cause);
|
|
1107
1104
|
return {
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
catch: (cause) => compileFailure(fileName, cause)
|
|
1112
|
-
})
|
|
1113
|
-
};
|
|
1114
|
-
});
|
|
1115
|
-
const sandboxFor = (platform, fileName, activeMutantId) => {
|
|
1116
|
-
const namespace = hostStrykerNamespace();
|
|
1117
|
-
namespace[INSTRUMENTER_CONSTANTS.ACTIVE_MUTANT] = activeMutantId;
|
|
1118
|
-
const moduleExports = {};
|
|
1119
|
-
const moduleObj = { exports: moduleExports };
|
|
1120
|
-
const sandbox = {
|
|
1121
|
-
...globalThis,
|
|
1122
|
-
[INSTRUMENTER_CONSTANTS.NAMESPACE]: namespace,
|
|
1123
|
-
require: platform.module.createRequire(fileName),
|
|
1124
|
-
module: moduleObj,
|
|
1125
|
-
exports: moduleExports,
|
|
1126
|
-
__filename: fileName
|
|
1105
|
+
file,
|
|
1106
|
+
message: fatal ? `Could not load "${file}" for the in-memory runner: ${errorText(cause)}` : errorText(cause),
|
|
1107
|
+
fatal
|
|
1127
1108
|
};
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1109
|
+
};
|
|
1110
|
+
let saltCounter = 0;
|
|
1111
|
+
const isPlainObject = (value) => Predicate.isObject(value);
|
|
1112
|
+
const descriptorValue = (descriptor) => descriptor === void 0 ? void 0 : descriptor.value;
|
|
1113
|
+
const hostStrykerNamespace = () => {
|
|
1114
|
+
const current = descriptorValue(Object.getOwnPropertyDescriptor(globalThis, INSTRUMENTER_CONSTANTS.NAMESPACE));
|
|
1115
|
+
if (isPlainObject(current)) return current;
|
|
1116
|
+
const created = {};
|
|
1117
|
+
Object.defineProperty(globalThis, INSTRUMENTER_CONSTANTS.NAMESPACE, {
|
|
1118
|
+
configurable: true,
|
|
1119
|
+
enumerable: true,
|
|
1120
|
+
value: created,
|
|
1121
|
+
writable: true
|
|
1131
1122
|
});
|
|
1123
|
+
return created;
|
|
1132
1124
|
};
|
|
1133
|
-
const
|
|
1125
|
+
const monolithicResult = (failureMessage, timeSpentMs) => Match.value(failureMessage).pipe(Match.when(Match.string, (failure) => ({
|
|
1134
1126
|
status: "complete",
|
|
1135
1127
|
tests: [{
|
|
1136
1128
|
id: "all",
|
|
@@ -1148,68 +1140,123 @@ const resultFromRun = (failureMessage, timeSpentMs) => Match.value(failureMessag
|
|
|
1148
1140
|
timeSpentMs
|
|
1149
1141
|
}]
|
|
1150
1142
|
})));
|
|
1151
|
-
const
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
const
|
|
1157
|
-
const
|
|
1158
|
-
|
|
1159
|
-
const
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
writable: true
|
|
1165
|
-
});
|
|
1166
|
-
return created;
|
|
1143
|
+
const prefixOf = (file, pathToFileURL) => {
|
|
1144
|
+
const href = pathToFileURL(file).href;
|
|
1145
|
+
const lastSlash = href.lastIndexOf("/");
|
|
1146
|
+
return href.slice(0, lastSlash + 1);
|
|
1147
|
+
};
|
|
1148
|
+
const commonPrefixOf = (files, pathToFileURL) => {
|
|
1149
|
+
const dirs = files.map((file) => prefixOf(file, pathToFileURL));
|
|
1150
|
+
let prefix = dirs[0] ?? "";
|
|
1151
|
+
for (const dir of dirs.slice(1)) while (prefix !== "" && !dir.startsWith(prefix)) {
|
|
1152
|
+
const cut = prefix.lastIndexOf("/", prefix.length - 2);
|
|
1153
|
+
prefix = cut > 0 ? prefix.slice(0, cut + 1) : "";
|
|
1154
|
+
}
|
|
1155
|
+
return prefix;
|
|
1167
1156
|
};
|
|
1168
|
-
const
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1157
|
+
const serialRunGate = Semaphore.makeUnsafe(1);
|
|
1158
|
+
const runOnce = (platform, testFiles, timeoutMs, activeMutantId, sandboxWorkingDirectory) => Effect$1.gen(function* () {
|
|
1159
|
+
if (testFiles[0] === void 0) return monolithicResult(void 0, 0);
|
|
1160
|
+
const registry = createRegistry();
|
|
1161
|
+
const api = createHarnessApi(registry);
|
|
1162
|
+
const namespace = hostStrykerNamespace();
|
|
1163
|
+
const previousActive = namespace[INSTRUMENTER_CONSTANTS.ACTIVE_MUTANT];
|
|
1164
|
+
namespace[INSTRUMENTER_CONSTANTS.ACTIVE_MUTANT] = activeMutantId;
|
|
1165
|
+
let armed = false;
|
|
1172
1166
|
try {
|
|
1173
|
-
|
|
1167
|
+
const real = yield* Effect$1.tryPromise({
|
|
1168
|
+
try: () => import("./dist-DsmXFb2_.mjs"),
|
|
1169
|
+
catch: (cause) => TestRunnerFailed.make({
|
|
1170
|
+
runnerName: "vm",
|
|
1171
|
+
phase: "init",
|
|
1172
|
+
cause: cause instanceof Error ? cause.message : "the vitest module failed to load"
|
|
1173
|
+
})
|
|
1174
|
+
});
|
|
1175
|
+
const state = {
|
|
1176
|
+
api,
|
|
1177
|
+
expect: guardedExpect(real.expect),
|
|
1178
|
+
vi: guardedVi(real.vi),
|
|
1179
|
+
effectVitest: { it: makeEffectMethods({
|
|
1180
|
+
api: api.it,
|
|
1181
|
+
describe: api.describe,
|
|
1182
|
+
hooks: api.hooks,
|
|
1183
|
+
tests: registry.tests
|
|
1184
|
+
}) }
|
|
1185
|
+
};
|
|
1186
|
+
const prefix = sandboxWorkingDirectory !== void 0 ? `${platform.pathToFileURL(sandboxWorkingDirectory).href.replace(/\/?$/, "/")}` : commonPrefixOf(testFiles, platform.pathToFileURL);
|
|
1187
|
+
installInterception(platform.moduleBuiltin);
|
|
1188
|
+
activateSandbox(prefix);
|
|
1189
|
+
writeGlobalState(state);
|
|
1190
|
+
armed = true;
|
|
1191
|
+
let runFailure;
|
|
1192
|
+
const salt = saltCounter++;
|
|
1193
|
+
for (const file of testFiles) {
|
|
1194
|
+
registry.files.current = file;
|
|
1195
|
+
registry.frames.current = [];
|
|
1196
|
+
const url = `${platform.pathToFileURL(file).href}?salt=${salt}`;
|
|
1197
|
+
const outcome = yield* Effect$1.promise(() => nativeImport(url).then(() => void 0, (cause) => ({ cause })));
|
|
1198
|
+
if (outcome !== void 0) {
|
|
1199
|
+
const failure = runFailureFor(file, outcome.cause);
|
|
1200
|
+
if (failure.fatal) return yield* TestRunnerFailed.make({
|
|
1201
|
+
runnerName: "vm",
|
|
1202
|
+
phase: "init",
|
|
1203
|
+
cause: failure.message
|
|
1204
|
+
});
|
|
1205
|
+
runFailure ??= failure;
|
|
1206
|
+
}
|
|
1207
|
+
}
|
|
1208
|
+
const outcome = yield* Effect$1.promise(() => drainRegistry(registry, timeoutMs));
|
|
1209
|
+
if (outcome.kind === "timeout") return { status: "timeout" };
|
|
1210
|
+
const drainedElapsed = outcome.tests.reduce((total, test) => total + test.timeSpentMs, 0);
|
|
1211
|
+
if (registry.tests.length === 0) return monolithicResult(runFailure?.message, drainedElapsed);
|
|
1212
|
+
const tests = outcome.tests.map((test) => {
|
|
1213
|
+
const base = {
|
|
1214
|
+
id: `${test.file}#${test.fullName}`,
|
|
1215
|
+
name: test.fullName,
|
|
1216
|
+
timeSpentMs: test.timeSpentMs
|
|
1217
|
+
};
|
|
1218
|
+
if (test.status === "failed") return {
|
|
1219
|
+
...base,
|
|
1220
|
+
status: "failed",
|
|
1221
|
+
failureMessage: test.failureMessage ?? ""
|
|
1222
|
+
};
|
|
1223
|
+
return test.status === "skipped" ? {
|
|
1224
|
+
...base,
|
|
1225
|
+
status: "skipped"
|
|
1226
|
+
} : {
|
|
1227
|
+
...base,
|
|
1228
|
+
status: "success"
|
|
1229
|
+
};
|
|
1230
|
+
});
|
|
1231
|
+
if (runFailure !== void 0) tests.push({
|
|
1232
|
+
id: `${runFailure.file}#load error`,
|
|
1233
|
+
name: `${runFailure.file} (load error)`,
|
|
1234
|
+
status: "failed",
|
|
1235
|
+
failureMessage: runFailure.message,
|
|
1236
|
+
timeSpentMs: 0
|
|
1237
|
+
});
|
|
1238
|
+
return {
|
|
1239
|
+
status: "complete",
|
|
1240
|
+
tests
|
|
1241
|
+
};
|
|
1174
1242
|
} finally {
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
const context = platform.vm.createContext(sandboxFor(platform, compiled.fileName, activeMutantId));
|
|
1180
|
-
return withActiveMutant(activeMutantId, () => {
|
|
1181
|
-
try {
|
|
1182
|
-
compiled.script.runInContext(context);
|
|
1183
|
-
return;
|
|
1184
|
-
} catch (cause) {
|
|
1185
|
-
return errorText(cause);
|
|
1243
|
+
if (armed) {
|
|
1244
|
+
writeGlobalState(void 0);
|
|
1245
|
+
deactivateSandbox();
|
|
1246
|
+
uninstallInterception();
|
|
1186
1247
|
}
|
|
1187
|
-
|
|
1188
|
-
}
|
|
1189
|
-
const runOnce = (platform, compiled, activeMutantId) => Effect$1.gen(function* () {
|
|
1190
|
-
const startedAt = yield* Clock.currentTimeMillis;
|
|
1191
|
-
const failure = yield* runInFreshContext(platform, compiled, activeMutantId);
|
|
1192
|
-
const elapsedMs = (yield* Clock.currentTimeMillis) - startedAt;
|
|
1193
|
-
return resultFromRun(failure, elapsedMs);
|
|
1248
|
+
namespace[INSTRUMENTER_CONSTANTS.ACTIVE_MUTANT] = previousActive;
|
|
1249
|
+
}
|
|
1194
1250
|
});
|
|
1195
1251
|
const vmTestRunner = (config) => Effect$1.gen(function* () {
|
|
1196
1252
|
const platform = yield* VmRunner;
|
|
1197
|
-
const
|
|
1198
|
-
const compiled = yield* Ref.make(Option.none());
|
|
1199
|
-
const compiledTests = (testFiles) => Effect$1.gen(function* () {
|
|
1200
|
-
const cached = yield* Ref.get(compiled);
|
|
1201
|
-
if (Option.isSome(cached)) return cached.value;
|
|
1202
|
-
const tests = yield* compileTests(platform, fs, testFiles);
|
|
1203
|
-
yield* Ref.set(compiled, Option.some(tests));
|
|
1204
|
-
return tests;
|
|
1205
|
-
});
|
|
1206
|
-
const run = (testFiles, activeMutantId) => compiledTests(testFiles).pipe(Effect$1.flatMap((tests) => runOnce(platform, tests, activeMutantId)));
|
|
1253
|
+
const run = (testFiles, timeoutMs, activeMutantId) => serialRunGate.withPermits(1)(runOnce(platform, testFiles, timeoutMs, activeMutantId, config.sandboxWorkingDirectory));
|
|
1207
1254
|
const testFilesOf = (override) => Match.value(config.testFiles).pipe(Match.when((files) => files.length > 0, (files) => files), Match.orElse(() => override ?? []));
|
|
1208
1255
|
return {
|
|
1209
1256
|
capabilities: Effect$1.succeed(vmRunnerCapabilities),
|
|
1210
1257
|
init: Effect$1.void,
|
|
1211
|
-
dryRun: (options) => run(testFilesOf(options.testFiles), void 0),
|
|
1212
|
-
mutantRun: (options) => run(config.testFiles, options.activeMutant.id).pipe(Effect$1.map((result) => toMutantRunResult(result, true)), Effect$1.catchTag("TestRunnerFailed", (failure) => Effect$1.succeed(toMutantRunResult({
|
|
1258
|
+
dryRun: (options) => run(testFilesOf(options.testFiles), options.timeout, void 0),
|
|
1259
|
+
mutantRun: (options) => run(config.testFiles, options.timeout, String(options.activeMutant.id)).pipe(Effect$1.map((result) => toMutantRunResult(result, true)), Effect$1.catchTag("TestRunnerFailed", (failure) => Effect$1.succeed(toMutantRunResult({
|
|
1213
1260
|
status: "error",
|
|
1214
1261
|
errorMessage: failure.cause
|
|
1215
1262
|
}, true))))
|
|
@@ -1403,8 +1450,8 @@ const nodePlatformLayer = Layer.mergeAll(nodeWorkerLauncherLayer.pipe(Layer.prov
|
|
|
1403
1450
|
* runner has no fallback to fall back to.
|
|
1404
1451
|
*/
|
|
1405
1452
|
const nodeVmPlatformLayer = Layer.effect(VmRunner, Effect$1.sync(() => ({
|
|
1406
|
-
|
|
1407
|
-
|
|
1453
|
+
moduleBuiltin: globalThis.process.getBuiltinModule("node:module"),
|
|
1454
|
+
pathToFileURL: (path) => globalThis.process.getBuiltinModule("node:url").pathToFileURL(path)
|
|
1408
1455
|
})));
|
|
1409
1456
|
S.TaggedError()("CommandRunnerUnsupportedOption", { option: S.String });
|
|
1410
1457
|
S.Struct({
|
|
@@ -1682,7 +1729,10 @@ const commandRunner = (context, spawner) => {
|
|
|
1682
1729
|
};
|
|
1683
1730
|
return withRetry(withTimeout(base));
|
|
1684
1731
|
};
|
|
1685
|
-
const inProcessRunner = (context) => Match.value(context.options.testRunner).pipe(Match.when(isCommandRunner, () => Option.some(ChildProcessSpawner.ChildProcessSpawner.pipe(Effect$1.map((spawner) => commandRunner(context, spawner))))), Match.when(isVmRunner, () => Option.some(vmTestRunner({
|
|
1732
|
+
const inProcessRunner = (context) => Match.value(context.options.testRunner).pipe(Match.when(isCommandRunner, () => Option.some(ChildProcessSpawner.ChildProcessSpawner.pipe(Effect$1.map((spawner) => commandRunner(context, spawner))))), Match.when(isVmRunner, () => Option.some(vmTestRunner({
|
|
1733
|
+
testFiles: context.testFiles,
|
|
1734
|
+
sandboxWorkingDirectory: context.sandboxWorkingDirectory
|
|
1735
|
+
}).pipe(Effect$1.provide(nodeVmPlatformLayer)))), Match.orElse(() => Option.none()));
|
|
1686
1736
|
const buildTestRunner = (context, childProcessRunner) => Effect$1.gen(function* () {
|
|
1687
1737
|
const inProcess = inProcessRunner(context);
|
|
1688
1738
|
if (Option.isSome(inProcess)) return yield* inProcess.value;
|
|
@@ -2883,7 +2933,7 @@ const decide = (command) => Option.match(Option.fromUndefinedOr(command.report),
|
|
|
2883
2933
|
const admitIncrementalReport = Workflow.total(AdmitIncrementalReportCommand, (command) => Result.succeed(decide(command)));
|
|
2884
2934
|
//#endregion
|
|
2885
2935
|
//#region src/stryker-package.ts
|
|
2886
|
-
const strykerVersion = "10.
|
|
2936
|
+
const strykerVersion = "10.2.0";
|
|
2887
2937
|
//#endregion
|
|
2888
2938
|
//#region src/incremental-report.cell.ts
|
|
2889
2939
|
const parseAndDecodeIncrementalReport = S.decodeUnknownResult(S.fromJsonString(IncrementalReportSchema));
|
|
@@ -3983,7 +4033,8 @@ const instrumentCell = Sandwich.read((command) => Effect$1.gen(function* () {
|
|
|
3983
4033
|
})));
|
|
3984
4034
|
const instrumentResult = yield* instrument(filesToMutate, {
|
|
3985
4035
|
ignorers: [...command.ignorers],
|
|
3986
|
-
excludedMutations: [...command.options.mutator.excludedMutations]
|
|
4036
|
+
excludedMutations: [...command.options.mutator.excludedMutations],
|
|
4037
|
+
optInMutations: [...command.options.mutator.optInMutations]
|
|
3987
4038
|
}, env.basePath).pipe(Effect$1.mapError((cause) => StageError.make({
|
|
3988
4039
|
stage: "instrument",
|
|
3989
4040
|
reason: "Instrumenter failed",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@systemfsoftware/stryker-js",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.2.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/systemfsoftware/stryker-js-effect.git",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
},
|
|
21
21
|
"license": "Apache-2.0",
|
|
22
22
|
"engines": {
|
|
23
|
-
"node": ">=
|
|
23
|
+
"node": ">=24.13.1"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@effect/opentelemetry": "4.0.0-rc.116",
|
|
@@ -32,7 +32,8 @@
|
|
|
32
32
|
"@opentelemetry/exporter-trace-otlp-http": "^0.222.0",
|
|
33
33
|
"@opentelemetry/sdk-metrics": "^2.11.0",
|
|
34
34
|
"@opentelemetry/sdk-trace-base": "^2.2.0",
|
|
35
|
-
"@systemfsoftware/effect-cell-types": "^8.3.2"
|
|
35
|
+
"@systemfsoftware/effect-cell-types": "^8.3.2",
|
|
36
|
+
"@systemfsoftware/stryker-vm-harness": "^1.0.0"
|
|
36
37
|
},
|
|
37
38
|
"peerDependencies": {
|
|
38
39
|
"effect": "4.0.0-rc.116"
|
|
@@ -66,12 +67,12 @@
|
|
|
66
67
|
"tsdown": "^0.23.0",
|
|
67
68
|
"typescript": "^7",
|
|
68
69
|
"vitest": "^5",
|
|
69
|
-
"@systemfsoftware/stryker-ignorer-interface": "^0.1.1",
|
|
70
|
-
"@systemfsoftware/stryker-js-html-reporter": "^4.0.5",
|
|
71
70
|
"@systemfsoftware/stryker-config": "^0.1.0",
|
|
72
|
-
"@systemfsoftware/stryker-js-
|
|
73
|
-
"@systemfsoftware/stryker-js-
|
|
74
|
-
"@systemfsoftware/stryker-js-plugin-runtime": "^5.0.
|
|
71
|
+
"@systemfsoftware/stryker-js-html-reporter": "^4.0.5",
|
|
72
|
+
"@systemfsoftware/stryker-js-instrumenter": "^8.1.0",
|
|
73
|
+
"@systemfsoftware/stryker-js-plugin-runtime": "^5.0.4",
|
|
74
|
+
"@systemfsoftware/stryker-js-plugin-interface": "^7.3.0",
|
|
75
|
+
"@systemfsoftware/stryker-ignorer-interface": "^0.1.1",
|
|
75
76
|
"@systemfsoftware/vitest-config": "^0.1.0",
|
|
76
77
|
"@systemfsoftware/tsdown-config": "^0.1.0"
|
|
77
78
|
},
|
|
@@ -111,13 +112,21 @@
|
|
|
111
112
|
"angular-html-parser": "10.12.0",
|
|
112
113
|
"aria-query": "5.3.1",
|
|
113
114
|
"axobject-query": "4.1.0",
|
|
115
|
+
"chai": "6.2.2",
|
|
114
116
|
"esrap": "2.3.7",
|
|
117
|
+
"expect-type": "1.4.0",
|
|
115
118
|
"is-reference": "3.0.3",
|
|
116
119
|
"locate-character": "3.0.0",
|
|
117
|
-
"magic-string":
|
|
120
|
+
"magic-string": [
|
|
121
|
+
"0.30.21",
|
|
122
|
+
"1.4.1"
|
|
123
|
+
],
|
|
118
124
|
"oxc-parser": "0.150.0",
|
|
119
125
|
"oxc-walker": "1.1.1",
|
|
120
126
|
"svelte": "5.57.0",
|
|
127
|
+
"tinybench": "6.1.4",
|
|
128
|
+
"vite": "8.2.2",
|
|
129
|
+
"vitest": "5.0.1",
|
|
121
130
|
"zimmerframe": "1.1.5"
|
|
122
131
|
},
|
|
123
132
|
"scripts": {
|