@overkill-dev/stryker-runner 0.0.10 → 0.0.12
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/package.json +9 -6
- package/packages/stryker-runner/campaign-client.js +90 -0
- package/packages/stryker-runner/campaign-client.js.map +1 -0
- package/packages/stryker-runner/campaign-protocol.js +52 -0
- package/packages/stryker-runner/campaign-protocol.js.map +1 -0
- package/packages/stryker-runner/campaign-receiver.js +78 -0
- package/packages/stryker-runner/campaign-receiver.js.map +1 -0
- package/packages/stryker-runner/campaign-transport.js +77 -0
- package/packages/stryker-runner/campaign-transport.js.map +1 -0
- package/packages/stryker-runner/campaign-worker.js +134 -0
- package/packages/stryker-runner/campaign-worker.js.map +1 -0
- package/packages/stryker-runner/instrumentation-context.entry-point.js +133 -0
- package/packages/stryker-runner/instrumentation-context.entry-point.js.map +1 -0
- package/packages/stryker-runner/mutation-baseline.js +26 -0
- package/packages/stryker-runner/mutation-baseline.js.map +1 -0
- package/packages/stryker-runner/mutation-catalog.js +121 -0
- package/packages/stryker-runner/mutation-catalog.js.map +1 -0
- package/packages/stryker-runner/mutation-lifecycle.js +84 -0
- package/packages/stryker-runner/mutation-lifecycle.js.map +1 -0
- package/packages/stryker-runner/mutation-observation.js +49 -0
- package/packages/stryker-runner/mutation-observation.js.map +1 -0
- package/packages/stryker-runner/mutation-policy-resolver.js +1 -1
- package/packages/stryker-runner/mutation-policy-resolver.js.map +1 -1
- package/packages/stryker-runner/mutation-results.js +203 -0
- package/packages/stryker-runner/mutation-results.js.map +1 -0
- package/packages/stryker-runner/mutation-runner-execution.js +56 -0
- package/packages/stryker-runner/mutation-runner-execution.js.map +1 -0
- package/packages/stryker-runner/mutation-runner-invocations.js +62 -0
- package/packages/stryker-runner/mutation-runner-invocations.js.map +1 -0
- package/packages/stryker-runner/mutation-runner-lifecycle.js +130 -0
- package/packages/stryker-runner/mutation-runner-lifecycle.js.map +1 -0
- package/packages/stryker-runner/mutation-selection.js +66 -0
- package/packages/stryker-runner/mutation-selection.js.map +1 -0
- package/packages/stryker-runner/overkill-test-runner.js +31 -44
- package/packages/stryker-runner/overkill-test-runner.js.map +1 -1
- package/packages/stryker-runner/runner-options.d.ts +17 -1
- package/packages/stryker-runner/runner-options.d.ts.map +1 -1
- package/packages/stryker-runner/runner-options.js +13 -20
- package/packages/stryker-runner/runner-options.js.map +1 -1
- package/packages/stryker-runner/runner-settings-schema.js +21 -0
- package/packages/stryker-runner/runner-settings-schema.js.map +1 -0
- package/readme.md +47 -10
- package/{sbom.cdx.json → software-bill-of-materials.cyclonedx.json} +15 -15
- package/packages/stryker-runner/mutation-execution.js +0 -69
- package/packages/stryker-runner/mutation-execution.js.map +0 -1
- package/packages/stryker-runner/mutation-invocation-failure.js +0 -63
- package/packages/stryker-runner/mutation-invocation-failure.js.map +0 -1
- package/packages/stryker-runner/mutation-invocation-host.js +0 -53
- package/packages/stryker-runner/mutation-invocation-host.js.map +0 -1
- package/packages/stryker-runner/mutation-invocation-process.entry-point.js +0 -18
- package/packages/stryker-runner/mutation-invocation-process.entry-point.js.map +0 -1
- package/packages/stryker-runner/mutation-invocation-process.js +0 -63
- package/packages/stryker-runner/mutation-invocation-process.js.map +0 -1
- package/packages/stryker-runner/mutation-invocation-protocol.js +0 -35
- package/packages/stryker-runner/mutation-invocation-protocol.js.map +0 -1
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { DryRunStatus, MutantRunStatus } from '@stryker-mutator/api/test-runner';
|
|
2
|
+
import { mutationLifecycleInputSchema } from "./mutation-lifecycle.js";
|
|
3
|
+
import { dryMutationResult, mutantExecutionResult } from "./mutation-results.js";
|
|
4
|
+
import { mutantActivation, mutantSelection } from "./mutation-selection.js";
|
|
5
|
+
export function createMutationRunnerInvocations(baseline, ignoreStatic) {
|
|
6
|
+
return {
|
|
7
|
+
async dry(runner, input, remaining) {
|
|
8
|
+
runner.execution.admitEnvironment('dry', false);
|
|
9
|
+
const reply = await runner.execution.run(mutationLifecycleInputSchema.parse({
|
|
10
|
+
root: runner.root,
|
|
11
|
+
mode: 'dry',
|
|
12
|
+
activeMutant: null,
|
|
13
|
+
hitLimit: null,
|
|
14
|
+
coverage: input.coverageAnalysis,
|
|
15
|
+
baseline: null,
|
|
16
|
+
selected: null,
|
|
17
|
+
disableBail: input.disableBail,
|
|
18
|
+
files: input.testFiles ?? null
|
|
19
|
+
}), remaining);
|
|
20
|
+
const result = dryMutationResult(runner.root, reply, input.coverageAnalysis);
|
|
21
|
+
if (result.status === DryRunStatus.Complete) {
|
|
22
|
+
await baseline.publish(runner.client, reply);
|
|
23
|
+
}
|
|
24
|
+
return result;
|
|
25
|
+
},
|
|
26
|
+
async mutant(runner, input, remaining) {
|
|
27
|
+
const started = performance.now();
|
|
28
|
+
const campaign = await baseline.fetch(runner.client);
|
|
29
|
+
const mode = mutantActivation(input, runner.root, campaign, ignoreStatic);
|
|
30
|
+
const selected = mutantSelection(runner.root, campaign, input.testFilter ?? null);
|
|
31
|
+
const budget = remaining - (performance.now() - started);
|
|
32
|
+
if (budget <= 0) {
|
|
33
|
+
return {
|
|
34
|
+
status: MutantRunStatus.Timeout,
|
|
35
|
+
reason: 'Campaign baseline delivery exceeded the invocation deadline.'
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
runner.execution.admitEnvironment(mode, input.reloadEnvironment);
|
|
39
|
+
const reply = await runner.execution.run(mutationLifecycleInputSchema.parse({
|
|
40
|
+
root: runner.root,
|
|
41
|
+
mode,
|
|
42
|
+
activeMutant: input.activeMutant.id,
|
|
43
|
+
hitLimit: input.hitLimit ?? null,
|
|
44
|
+
coverage: 'off',
|
|
45
|
+
baseline: campaign.catalog,
|
|
46
|
+
selected: mode === 'static'
|
|
47
|
+
? campaign.catalog.map(function (entry) {
|
|
48
|
+
return entry.id;
|
|
49
|
+
})
|
|
50
|
+
: selected,
|
|
51
|
+
disableBail: input.disableBail,
|
|
52
|
+
files: Array.from(new Set(campaign
|
|
53
|
+
.catalog
|
|
54
|
+
.flatMap(function (entry) {
|
|
55
|
+
return entry.work.case.file === null ? [] : [entry.work.case.file];
|
|
56
|
+
})))
|
|
57
|
+
}), budget);
|
|
58
|
+
return mutantExecutionResult(runner.root, reply);
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=mutation-runner-invocations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mutation-runner-invocations.js","sourceRoot":"","sources":["../../../../../source/packages/stryker-runner/mutation-runner-invocations.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,YAAY,EACZ,eAAe,EAKlB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,4BAA4B,EAAE,MAAM,yBAAyB,CAAC;AACvE,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AACjF,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAgB5E,MAAM,UAAU,+BAA+B,CAC3C,QAA0B,EAC1B,YAAqB;IAErB,OAAO;QACH,KAAK,CAAC,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,SAAS;YAC9B,MAAM,CAAC,SAAS,CAAC,gBAAgB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;YAChD,MAAM,KAAK,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC,GAAG,CACpC,4BAA4B,CAAC,KAAK,CAAC;gBAC/B,IAAI,EAAE,MAAM,CAAC,IAAI;gBACjB,IAAI,EAAE,KAAK;gBACX,YAAY,EAAE,IAAI;gBAClB,QAAQ,EAAE,IAAI;gBACd,QAAQ,EAAE,KAAK,CAAC,gBAAgB;gBAChC,QAAQ,EAAE,IAAI;gBACd,QAAQ,EAAE,IAAI;gBACd,WAAW,EAAE,KAAK,CAAC,WAAW;gBAC9B,KAAK,EAAE,KAAK,CAAC,SAAS,IAAI,IAAI;aACjC,CAAC,EACF,SAAS,CACZ,C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Y,CAAC,EAAE;gBACnC,QAAQ,EAAE,KAAK,CAAC,QAAQ,IAAI,IAAI;gBAChC,QAAQ,EAAE,KAAK;gBACf,QAAQ,EAAE,QAAQ,CAAC,OAAO;gBAC1B,QAAQ,EAAE,IAAI,KAAK,QAAQ;oBACvB,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,KAAK;wBAClC,OAAO,KAAK,CAAC,EAAE,CAAC;oBACpB,CAAC,CAAC;oBACF,CAAC,CAAC,QAAQ;gBACd,WAAW,EAAE,KAAK,CAAC,WAAW;gBAC9B,KAAK,EAAE,KAAK,CAAC,IAAI,CACb,IAAI,GAAG,CAAC,QAAQ;qBACX,OAAO;qBACP,OAAO,CAAC,UAAU,KAAK;oBACpB,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAE,CAAC;gBACzE,CAAC,CAAC,CAAC,CACV;aACJ,CAAC,EACF,MAAM,CACT,CAAC;YACF,OAAO,qBAAqB,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QACrD,CAAC;KACJ,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { ConfigError, restoreRunExecutionFailure } from "@overkill-dev/run";
|
|
2
|
+
import { defaultCampaignEndpoint } from "./runner-options.js";
|
|
3
|
+
import { parseRunnerOptions } from "./runner-settings-schema.js";
|
|
4
|
+
import { assertExcludedAdapter, createMutationSandbox } from "./mutation-sandbox.js";
|
|
5
|
+
import { connectCampaign } from "./campaign-client.js";
|
|
6
|
+
import { campaignEndpointSchema } from "./campaign-protocol.js";
|
|
7
|
+
import { createMutationRunnerExecution } from "./mutation-runner-execution.js";
|
|
8
|
+
const originalRoot = process.cwd();
|
|
9
|
+
async function initializeRegisteredRunner(input) {
|
|
10
|
+
const { sandbox, settings, client, signal } = input;
|
|
11
|
+
await client.request({ kind: 'register', root: sandbox.root });
|
|
12
|
+
const response = await client.request({ kind: 'resolve-policy', sandbox, settings });
|
|
13
|
+
if (response.kind === 'failure') {
|
|
14
|
+
throw restoreRunExecutionFailure(response.failure);
|
|
15
|
+
}
|
|
16
|
+
if (response.kind !== 'policy') {
|
|
17
|
+
throw new Error('Campaign IPC did not return a frozen execution policy.');
|
|
18
|
+
}
|
|
19
|
+
const execution = createMutationRunnerExecution({
|
|
20
|
+
policy: response.policy,
|
|
21
|
+
seed: settings.seed,
|
|
22
|
+
freshState: settings.freshState,
|
|
23
|
+
client,
|
|
24
|
+
signal
|
|
25
|
+
});
|
|
26
|
+
return { execution, client, root: sandbox.root };
|
|
27
|
+
}
|
|
28
|
+
async function connectRegisteredCampaign(input) {
|
|
29
|
+
const endpoint = campaignEndpointSchema.parse(input.options.overkillCampaign ?? defaultCampaignEndpoint);
|
|
30
|
+
const client = await connectCampaign(endpoint, input.signal);
|
|
31
|
+
input.connected(client);
|
|
32
|
+
return client;
|
|
33
|
+
}
|
|
34
|
+
async function initializeRunner(input) {
|
|
35
|
+
const settings = parseRunnerOptions(input.options.overkill);
|
|
36
|
+
input.logger.info('Overkill campaign seed: %s', settings.seed);
|
|
37
|
+
const sandbox = await createMutationSandbox({ originalRoot, cwd: process.cwd(), fileDescriptions: input.files });
|
|
38
|
+
await assertExcludedAdapter(sandbox);
|
|
39
|
+
const client = await connectRegisteredCampaign(input);
|
|
40
|
+
try {
|
|
41
|
+
return await initializeRegisteredRunner({ sandbox, settings, client, signal: input.signal });
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
client.dispose();
|
|
45
|
+
throw error;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
async function disposeRunner(initialization) {
|
|
49
|
+
const settled = await Promise.allSettled(initialization === null ? [] : [initialization]);
|
|
50
|
+
const initialized = settled[0];
|
|
51
|
+
if (initialized?.status === 'fulfilled') {
|
|
52
|
+
try {
|
|
53
|
+
await initialized.value.execution.dispose();
|
|
54
|
+
}
|
|
55
|
+
finally {
|
|
56
|
+
initialized.value.client.dispose();
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
async function runBeforeDeadline(runner, invocation) {
|
|
61
|
+
const { timeout, started, run, expired } = invocation;
|
|
62
|
+
const remaining = timeout - (performance.now() - started);
|
|
63
|
+
if (remaining <= 0) {
|
|
64
|
+
return expired();
|
|
65
|
+
}
|
|
66
|
+
const result = await run(runner, remaining);
|
|
67
|
+
return result.status !== 'error' && performance.now() - started >= timeout ? expired() : result;
|
|
68
|
+
}
|
|
69
|
+
export function createMutationRunnerLifecycle(options, files, logger) {
|
|
70
|
+
const controller = new AbortController();
|
|
71
|
+
let initialization = null;
|
|
72
|
+
const ownership = {
|
|
73
|
+
active: new Set(),
|
|
74
|
+
disposed: new Set(),
|
|
75
|
+
clients: new Map(),
|
|
76
|
+
closing: new Map()
|
|
77
|
+
};
|
|
78
|
+
async function ready() {
|
|
79
|
+
if (ownership.disposed.has('runner')) {
|
|
80
|
+
throw new ConfigError('Stryker runner has been disposed.');
|
|
81
|
+
}
|
|
82
|
+
const initializing = initialization ??
|
|
83
|
+
initializeRunner({
|
|
84
|
+
options,
|
|
85
|
+
files,
|
|
86
|
+
logger,
|
|
87
|
+
signal: controller.signal,
|
|
88
|
+
connected(client) {
|
|
89
|
+
ownership.clients.set('connected', client);
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
initialization = initializing;
|
|
93
|
+
return await initializing;
|
|
94
|
+
}
|
|
95
|
+
async function closeRunner() {
|
|
96
|
+
ownership.disposed.add('runner');
|
|
97
|
+
const client = ownership.clients.get('connected');
|
|
98
|
+
if (client === undefined) {
|
|
99
|
+
controller.abort();
|
|
100
|
+
}
|
|
101
|
+
if (client !== undefined) {
|
|
102
|
+
await Promise.allSettled([client.request({ kind: 'release' })]);
|
|
103
|
+
}
|
|
104
|
+
controller.abort();
|
|
105
|
+
await disposeRunner(initialization);
|
|
106
|
+
}
|
|
107
|
+
return {
|
|
108
|
+
ready,
|
|
109
|
+
async invoke(timeout, run, expired) {
|
|
110
|
+
if (ownership.active.size > 0) {
|
|
111
|
+
throw new Error('A Stryker invocation is already running.');
|
|
112
|
+
}
|
|
113
|
+
const started = performance.now();
|
|
114
|
+
const invocation = Symbol('mutation-invocation');
|
|
115
|
+
ownership.active.add(invocation);
|
|
116
|
+
try {
|
|
117
|
+
return await runBeforeDeadline(await ready(), { timeout, started, run, expired });
|
|
118
|
+
}
|
|
119
|
+
finally {
|
|
120
|
+
ownership.active.delete(invocation);
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
async dispose() {
|
|
124
|
+
const closing = ownership.closing.get('shutdown') ?? closeRunner();
|
|
125
|
+
ownership.closing.set('shutdown', closing);
|
|
126
|
+
await closing;
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
//# sourceMappingURL=mutation-runner-lifecycle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mutation-runner-lifecycle.js","sourceRoot":"","sources":["../../../../../source/packages/stryker-runner/mutation-runner-lifecycle.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,0BAA0B,EAAE,MAAM,mBAA2B,CAAC;AACpF,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAA8B,MAAM,6BAA6B,CAAC;AAC7F,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAwB,MAAM,uBAAuB,CAAC;AAC3G,OAAO,EAAE,eAAe,EAAuB,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,6BAA6B,EAAgC,MAAM,gCAAgC,CAAC;AAE7G,MAAM,YAAY,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC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AAC,MAAM,CAAC,UAAU,CAAC,CAAC;YACxC,CAAC;QACL,CAAC;QACD,KAAK,CAAC,OAAO;YACT,MAAM,OAAO,GAAG,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,WAAW,EAAE,CAAC;YACnE,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;YAC3C,MAAM,OAAO,CAAC;QAClB,CAAC;KACJ,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { projectFile } from "./mutation-catalog.js";
|
|
2
|
+
function matchingTestIdentities(root, campaign, value) {
|
|
3
|
+
const exact = campaign.catalog.find(function matchesIdentity(entry) {
|
|
4
|
+
return entry.id === value;
|
|
5
|
+
});
|
|
6
|
+
if (exact !== undefined) {
|
|
7
|
+
return [exact.id];
|
|
8
|
+
}
|
|
9
|
+
const file = projectFile(root, value);
|
|
10
|
+
const matches = campaign.catalog.filter(function matchesTestOrFile(entry) {
|
|
11
|
+
return entry.work.case.file === file;
|
|
12
|
+
});
|
|
13
|
+
if (matches.length === 0) {
|
|
14
|
+
throw new Error('Stryker requested an unknown test identity or file.');
|
|
15
|
+
}
|
|
16
|
+
return matches.map(function testIdentity(entry) {
|
|
17
|
+
return entry.id;
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
export function mutantSelection(root, campaign, filter) {
|
|
21
|
+
if (filter === null) {
|
|
22
|
+
return campaign.catalog.map(function testIdentity(entry) {
|
|
23
|
+
return entry.id;
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
const ids = filter.flatMap(function expandTestOrFile(value) {
|
|
27
|
+
return matchingTestIdentities(root, campaign, value);
|
|
28
|
+
});
|
|
29
|
+
const selected = new Set(ids);
|
|
30
|
+
if (selected.size !== ids.length) {
|
|
31
|
+
throw new Error('Stryker requested a duplicate test identity.');
|
|
32
|
+
}
|
|
33
|
+
if (ids.length === 0) {
|
|
34
|
+
throw new Error('Stryker requested an empty mutant test selection.');
|
|
35
|
+
}
|
|
36
|
+
return ids;
|
|
37
|
+
}
|
|
38
|
+
function identifiesSandboxFile(root, campaign, value) {
|
|
39
|
+
if (campaign.catalog.some(function matchesIdentity(entry) {
|
|
40
|
+
return entry.id === value;
|
|
41
|
+
})) {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
const file = projectFile(root, value);
|
|
45
|
+
return campaign.catalog.some(function matchesCatalogFile(entry) {
|
|
46
|
+
return entry.work.case.file === file;
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
function includesSandboxFile(root, campaign, filter) {
|
|
50
|
+
return filter?.some(function isSandboxFile(value) {
|
|
51
|
+
return identifiesSandboxFile(root, campaign, value);
|
|
52
|
+
}) === true;
|
|
53
|
+
}
|
|
54
|
+
function coveredAtLoad(campaign, id) {
|
|
55
|
+
return (campaign.coverage.static[id] ?? 0) > 0;
|
|
56
|
+
}
|
|
57
|
+
export function mutantActivation(input, root, campaign, ignoreStatic) {
|
|
58
|
+
if (input.mutantActivation === 'static') {
|
|
59
|
+
return 'static';
|
|
60
|
+
}
|
|
61
|
+
if (ignoreStatic || !coveredAtLoad(campaign, input.activeMutant.id)) {
|
|
62
|
+
return 'runtime';
|
|
63
|
+
}
|
|
64
|
+
return includesSandboxFile(root, campaign, input.testFilter ?? null) ? 'static' : 'runtime';
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=mutation-selection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mutation-selection.js","sourceRoot":"","sources":["../../../../../source/packages/stryker-runner/mutation-selection.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAyB,MAAM,uBAAuB,CAAC;AAE3E,SAAS,sBAAsB,CAAC,IAAY,EAAE,QAA0B,EAAE,KAAa;IACnF,MAAM,KAAK,GAAG,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,eAAe,CAAC,KAAK;QAC9D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QAAQ,CAAC;IACpB,CAAC;IACD,IAAI,YAAY,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,KAAK,CAAC,YAAY,CAAC,EAAE,CAAC,EAAE,CAAC;QAClE,OAAO,SAAS,CAAC;IACrB,CAAC;IACD,OAAO,mBAAmB,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,CAAC,UAAU,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC;AAChG,CAAC"}
|
|
@@ -1,57 +1,44 @@
|
|
|
1
1
|
import { commonTokens, tokens } from '@stryker-mutator/api/plugin';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { assertExcludedAdapter, createMutationSandbox } from "./mutation-sandbox.js";
|
|
7
|
-
const originalRoot = process.cwd();
|
|
2
|
+
import { DryRunStatus, MutantRunStatus } from '@stryker-mutator/api/test-runner';
|
|
3
|
+
import { createMutationRunnerLifecycle } from "./mutation-runner-lifecycle.js";
|
|
4
|
+
import { createMutationBaseline } from "./mutation-baseline.js";
|
|
5
|
+
import { createMutationRunnerInvocations } from "./mutation-runner-invocations.js";
|
|
8
6
|
export function createOverkillTestRunner(options, fileDescriptions, logger) {
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
async function initializeExecution() {
|
|
12
|
-
const settings = parseRunnerOptions(options.overkill);
|
|
13
|
-
logger.info('Overkill campaign seed: %s', settings.seed);
|
|
14
|
-
const sandbox = await createMutationSandbox({ originalRoot, cwd: process.cwd(), fileDescriptions });
|
|
15
|
-
await assertExcludedAdapter(sandbox);
|
|
16
|
-
const policy = await initializeMutationPolicy({
|
|
17
|
-
cwd: sandbox.root,
|
|
18
|
-
sandbox,
|
|
19
|
-
settings,
|
|
20
|
-
signal: controller.signal
|
|
21
|
-
});
|
|
22
|
-
return createMutationExecution({
|
|
23
|
-
policy,
|
|
24
|
-
seed: { value: BigInt(settings.seed) },
|
|
25
|
-
freshState: settings.freshState
|
|
26
|
-
});
|
|
27
|
-
}
|
|
7
|
+
const lifecycle = createMutationRunnerLifecycle(options, fileDescriptions, logger);
|
|
8
|
+
const invocations = createMutationRunnerInvocations(createMutationBaseline(), options.ignoreStatic === true);
|
|
28
9
|
return {
|
|
29
|
-
capabilities() {
|
|
30
|
-
|
|
10
|
+
async capabilities() {
|
|
11
|
+
const runner = await lifecycle.ready();
|
|
12
|
+
return { reloadEnvironment: runner.execution.environmentLifetime === 'fresh' };
|
|
31
13
|
},
|
|
32
14
|
async init() {
|
|
33
|
-
|
|
34
|
-
throw new ConfigError('Stryker runner has been disposed.');
|
|
35
|
-
}
|
|
36
|
-
initialization = initialization ?? initializeExecution();
|
|
37
|
-
await initialization;
|
|
38
|
-
},
|
|
39
|
-
async dryRun() {
|
|
40
|
-
throw new Error('@overkill-dev/stryker-runner: dryRun() is not implemented.');
|
|
15
|
+
await lifecycle.ready();
|
|
41
16
|
},
|
|
42
|
-
async
|
|
43
|
-
|
|
17
|
+
async dryRun(input) {
|
|
18
|
+
try {
|
|
19
|
+
return await lifecycle.invoke(input.timeout, async function (runner, remaining) {
|
|
20
|
+
return await invocations.dry(runner, input, remaining);
|
|
21
|
+
}, function () {
|
|
22
|
+
return { status: DryRunStatus.Timeout, reason: 'Dry run exceeded its deadline.' };
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
catch (error) {
|
|
26
|
+
return { status: DryRunStatus.Error, errorMessage: String(error) };
|
|
27
|
+
}
|
|
44
28
|
},
|
|
45
|
-
async
|
|
46
|
-
controller.abort();
|
|
47
|
-
let execution = null;
|
|
29
|
+
async mutantRun(input) {
|
|
48
30
|
try {
|
|
49
|
-
|
|
31
|
+
return await lifecycle.invoke(input.timeout, async function (runner, remaining) {
|
|
32
|
+
return await invocations.mutant(runner, input, remaining);
|
|
33
|
+
}, function () {
|
|
34
|
+
return { status: MutantRunStatus.Timeout, reason: 'Mutant invocation exceeded its deadline.' };
|
|
35
|
+
});
|
|
50
36
|
}
|
|
51
|
-
catch {
|
|
37
|
+
catch (error) {
|
|
38
|
+
return { status: MutantRunStatus.Error, errorMessage: String(error) };
|
|
52
39
|
}
|
|
53
|
-
|
|
54
|
-
|
|
40
|
+
},
|
|
41
|
+
dispose: lifecycle.dispose
|
|
55
42
|
};
|
|
56
43
|
}
|
|
57
44
|
createOverkillTestRunner.inject = tokens(commonTokens.options, commonTokens.fileDescriptions, commonTokens.logger);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"overkill-test-runner.js","sourceRoot":"","sources":["../../../../../source/packages/stryker-runner/overkill-test-runner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"overkill-test-runner.js","sourceRoot":"","sources":["../../../../../source/packages/stryker-runner/overkill-test-runner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAGnE,OAAO,EAAE,YAAY,EAAE,eAAe,EAAmB,MAAM,kCAAkC,CAAC;AAClG,OAAO,EAAE,6BAA6B,EAAE,MAAM,gCAAgC,CAAC;AAC/E,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,+BAA+B,EAAE,MAAM,kCAAkC,CAAC;AAEnF,MAAM,UAAU,wBAAwB,CACpC,OAA0C,EAC1C,gBAAkC,EAClC,MAAsC;IAEtC,MAAM,SAAS,GAAG,6BAA6B,CAAC,OAAO,EAAE,gBAAgB,EAAE,MAAM,CAAC,CAAC;IACnF,MAAM,WAAW,GAAG,+BAA+B,CAAC,sBAAsB,EAAE,EAAE,OAAO,CAAC,YAAY,KAAK,IAAI,CAAC,CAAC;IAC7G,OAAO;QACH,KAAK,CAAC,YAAY;YACd,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,KAAK,EAAE,CAAC;YACvC,OAAO,EAAE,i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AO,EAAE,SAAS,CAAC,OAAO;KAC7B,CAAC;AACN,CAAC;AACD,wBAAwB,CAAC,MAAM,GAAG,MAAM,CAAC,YAAY,CAAC,OAAO,EAAE,YAAY,CAAC,gBAAgB,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC"}
|
|
@@ -2,6 +2,23 @@ import { z } from 'zod/v4';
|
|
|
2
2
|
export declare const strykerValidationSchema: {
|
|
3
3
|
type: "object";
|
|
4
4
|
properties: {
|
|
5
|
+
overkillCampaign: {
|
|
6
|
+
default?: Readonly<{
|
|
7
|
+
port: number;
|
|
8
|
+
token: string;
|
|
9
|
+
}>;
|
|
10
|
+
type: "object";
|
|
11
|
+
properties: {
|
|
12
|
+
port: {
|
|
13
|
+
type: "integer";
|
|
14
|
+
};
|
|
15
|
+
token: {
|
|
16
|
+
type: "string";
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
additionalProperties: boolean;
|
|
20
|
+
required: string[];
|
|
21
|
+
};
|
|
5
22
|
overkill: z.core.ZodStandardJSONSchemaPayload<z.ZodDefault<z.ZodObject<{
|
|
6
23
|
configPath: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
7
24
|
paths: z.ZodDefault<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
|
|
@@ -11,5 +28,4 @@ export declare const strykerValidationSchema: {
|
|
|
11
28
|
}, z.core.$strict>>>;
|
|
12
29
|
};
|
|
13
30
|
};
|
|
14
|
-
export {};
|
|
15
31
|
//# sourceMappingURL=runner-options.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runner-options.d.ts","sourceRoot":"","sources":["../../../../../source/packages/stryker-runner/runner-options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"runner-options.d.ts","sourceRoot":"","sources":["../../../../../source/packages/stryker-runner/runner-options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAO3B,eAAO,6BAO6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAYnC,CAAC"}
|
|
@@ -1,33 +1,26 @@
|
|
|
1
1
|
import { z } from 'zod/v4';
|
|
2
|
-
import { parse } from '@schema-hub/zod-error-formatter';
|
|
3
|
-
import { ConfigError } from "@overkill-dev/run";
|
|
4
2
|
import { createRandomRunSeed } from "@overkill-dev/run";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
configPath: z.string().regex(/\S/u, 'must not be blank').nullable().default(null),
|
|
9
|
-
paths: z.array(z.string().regex(/\S/u, 'must not be blank')).readonly().default([]),
|
|
10
|
-
profile: z.string().nullable().default(null),
|
|
11
|
-
freshState: z.boolean().default(false),
|
|
12
|
-
seed: seedSchema
|
|
13
|
-
});
|
|
14
|
-
const runnerOptionsSchema = workerOptionsSchema.readonly();
|
|
3
|
+
import { campaignReceiver } from "./campaign-receiver.js";
|
|
4
|
+
import { isStrykerWorker } from "./instrumentation-context.entry-point.js";
|
|
5
|
+
import { seedSchema, workerOptionsSchema } from "./runner-settings-schema.js";
|
|
15
6
|
const campaignSeed = createRandomRunSeed().toString();
|
|
7
|
+
export const defaultCampaignEndpoint = isStrykerWorker()
|
|
8
|
+
? null
|
|
9
|
+
: await campaignReceiver();
|
|
16
10
|
const campaignOptionsSchema = workerOptionsSchema
|
|
17
11
|
.extend({ seed: seedSchema.default(campaignSeed) })
|
|
18
12
|
.default({ configPath: null, paths: [], profile: null, freshState: false, seed: campaignSeed });
|
|
19
13
|
export const strykerValidationSchema = {
|
|
20
14
|
type: 'object',
|
|
21
15
|
properties: {
|
|
16
|
+
overkillCampaign: {
|
|
17
|
+
type: 'object',
|
|
18
|
+
properties: { port: { type: 'integer' }, token: { type: 'string' } },
|
|
19
|
+
additionalProperties: false,
|
|
20
|
+
required: ['port', 'token'],
|
|
21
|
+
...defaultCampaignEndpoint === null ? {} : { default: defaultCampaignEndpoint }
|
|
22
|
+
},
|
|
22
23
|
overkill: z.toJSONSchema(campaignOptionsSchema, { target: 'draft-7', io: 'input' })
|
|
23
24
|
}
|
|
24
25
|
};
|
|
25
|
-
export function parseRunnerOptions(value) {
|
|
26
|
-
try {
|
|
27
|
-
return parse(runnerOptionsSchema, value);
|
|
28
|
-
}
|
|
29
|
-
catch (error) {
|
|
30
|
-
throw new ConfigError(`Invalid overkill Stryker settings: ${String(error)}`, { cause: error });
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
26
|
//# sourceMappingURL=runner-options.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runner-options.js","sourceRoot":"","sources":["../../../../../source/packages/stryker-runner/runner-options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAC3B,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"runner-options.js","sourceRoot":"","sources":["../../../../../source/packages/stryker-runner/runner-options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAC3B,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAA2B,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAC3E,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAE9E,MAAM,YAAY,GAAG,mBAAmB,EAAE,CAAC,QAAQ,EAAE,CAAC;AACtD,MAAM,CAAC,MAAM,uBAAuB,GAAG,eAAe,EAAE;IACpD,CAAC,CAAC,IAAI;IACN,CAAC,CAAC,MAAM,gBAAgB,EAAE,CAAC;AAC/B,MAAM,qBAAqB,GAAG,mBAAmB;KAC5C,MAAM,CAAC,EAAE,IAAI,EAAE,UAAU,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,CAAC;KAClD,OAAO,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC,CAAC;AAEpG,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACnC,IAAI,EAAE,QAAiB;IACvB,UAAU,EAAE;QACR,gBAAgB,EAAE;YACd,IAAI,EAAE,QAAiB;YACvB,UAAU,EAAE,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,SAAkB,EAAE,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,QAAiB,EAAE,EAAE;YACtF,oBAAoB,EAAE,KAAK;YAC3B,QAAQ,EAAE,CAAE,MAAM,EAAE,OAAO,CAAE;YAC7B,GAAG,uBAAuB,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,uBAAuB,EAAE;SAClF;QACD,QAAQ,EAAE,CAAC,CAAC,YAAY,CAAC,qBAAqB,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC;KACtF;CACJ,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { z } from 'zod/v4';
|
|
2
|
+
import { parse } from '@schema-hub/zod-error-formatter';
|
|
3
|
+
import { ConfigError } from "@overkill-dev/run";
|
|
4
|
+
export const seedSchema = z.string().regex(/^(?:0|[1-9]\d*)$/u, 'must be a nonnegative decimal integer');
|
|
5
|
+
export const workerOptionsSchema = z.strictObject({
|
|
6
|
+
configPath: z.string().regex(/\S/u, 'must not be blank').nullable().default(null),
|
|
7
|
+
paths: z.array(z.string().regex(/\S/u, 'must not be blank')).readonly().default([]),
|
|
8
|
+
profile: z.string().nullable().default(null),
|
|
9
|
+
freshState: z.boolean().default(false),
|
|
10
|
+
seed: seedSchema
|
|
11
|
+
});
|
|
12
|
+
const runnerOptionsSchema = workerOptionsSchema.readonly();
|
|
13
|
+
export function parseRunnerOptions(value) {
|
|
14
|
+
try {
|
|
15
|
+
return parse(runnerOptionsSchema, value);
|
|
16
|
+
}
|
|
17
|
+
catch (error) {
|
|
18
|
+
throw new ConfigError(`Invalid overkill Stryker settings: ${String(error)}`, { cause: error });
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=runner-settings-schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runner-settings-schema.js","sourceRoot":"","sources":["../../../../../source/packages/stryker-runner/runner-settings-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAC3B,OAAO,EAAE,KAAK,EAAE,MAAM,iCAAiC,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAA8B,CAAC;AAE3D,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,mBAAmB,EAAE,uCAAuC,CAAC,CAAC;AACzG,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,YAAY,CAAC;IAC9C,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,KAAK,EAAE,mBAAmB,CAAC,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;IACjF,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,KAAK,EAAE,mBAAmB,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;IACnF,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;IAC5C,UAAU,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;IACtC,IAAI,EAAE,UAAU;CACnB,CAAC,CAAC;AACH,MAAM,mBAAmB,GAAG,mBAAmB,CAAC,QAAQ,EAAE,CAAC;AAE3D,MAAM,UAAU,kBAAkB,CAAC,KAAc;IAC7C,IAAI,CAAC;QACD,OAAO,KAAK,CAAC,mBAAmB,EAAE,KAAK,CAAC,CAAC;IAC7C,CAAC;IAAC,OAAO,KAAc,EAAE,CAAC;QACtB,MAAM,IAAI,WAAW,CAAC,sCAAsC,MAAM,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;IACnG,CAAC;AACL,CAAC"}
|
package/readme.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# `@overkill-dev/stryker-runner`
|
|
2
2
|
|
|
3
3
|
Optional first-party Stryker `TestRunner` plugin for Node microtest profiles.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
Supports dry runs, instrumented mutant coverage, filtered mutant runs, bail,
|
|
5
|
+
deadlines, and environment reload reporting with Stryker `10.0.0`.
|
|
6
|
+
Initialization freezes the mutation execution policy before importing tests.
|
|
7
7
|
|
|
8
8
|
```js
|
|
9
9
|
export default {
|
|
@@ -41,13 +41,14 @@ process usage policies, timeouts, and the configured process model are preserved
|
|
|
41
41
|
The original profile remains unchanged; the command records the override as
|
|
42
42
|
`request.execution: { mode: 'serial' }`.
|
|
43
43
|
|
|
44
|
-
Each plugin worker
|
|
45
|
-
process imports user configuration and its dependencies,
|
|
46
|
-
returns immutable policy data. It imports no tests or
|
|
47
|
-
terminated and reaped after success, failure, or disposal.
|
|
48
|
-
does not enter the plugin worker's execution graph during
|
|
44
|
+
Each plugin worker requests policy once from a fresh, unmutated process owned
|
|
45
|
+
by Stryker's main process. It imports user configuration and its dependencies,
|
|
46
|
+
discovers files, and returns immutable policy data. It imports no tests or
|
|
47
|
+
custom engines. It is terminated and reaped after success, failure, or disposal.
|
|
48
|
+
User configuration does not enter the plugin worker's execution graph during
|
|
49
|
+
initialization.
|
|
49
50
|
Repeated initialization shares one result, including failures. Replacement
|
|
50
|
-
workers resolve independently
|
|
51
|
+
workers resolve policy independently.
|
|
51
52
|
|
|
52
53
|
Stryker owns mutation selection. Exclude configuration, test definitions,
|
|
53
54
|
definition helpers such as macros and suite fragments, and adapter code through
|
|
@@ -82,7 +83,7 @@ execution, or resources fail even when test identities would remain unchanged.
|
|
|
82
83
|
Reporters, valid unrelated profiles, disabled coverage settings, and overridden
|
|
83
84
|
scheduling do not affect the comparison.
|
|
84
85
|
|
|
85
|
-
The
|
|
86
|
+
The execution session runs serial cases in the selected profile's process
|
|
86
87
|
model. `freshState` defaults to `false`: in-process execution retains its collected
|
|
87
88
|
plan and transitive module state inside Stryker's reusable plugin worker. Suites
|
|
88
89
|
must support repeated execution. Persistent memoization, singleton state, and
|
|
@@ -96,6 +97,42 @@ or external services. In-process permission enforcement remains best effort.
|
|
|
96
97
|
Supervised profiles already use one fresh restricted child per invocation;
|
|
97
98
|
`freshState` adds no extra host or stronger permissions there.
|
|
98
99
|
|
|
100
|
+
| Execution | `reloadEnvironment` |
|
|
101
|
+
| ---------------------- | ------------------- |
|
|
102
|
+
| Reused in-process ESM | `false` |
|
|
103
|
+
| Fresh in-process state | `true` |
|
|
104
|
+
| Supervised process | `true` |
|
|
105
|
+
|
|
106
|
+
Stryker replaces reused workers for requested reloads and static-mutant
|
|
107
|
+
transitions. Direct reload requests against an already loaded native ESM graph
|
|
108
|
+
return `Error`. Static activation precedes configuration revalidation and test
|
|
109
|
+
imports; runtime activation follows unmutated collection.
|
|
110
|
+
|
|
111
|
+
An automatic IPC receiver in Stryker's main process retains the original dry-run
|
|
112
|
+
catalog and coverage across workers and replacements. No additional dry run,
|
|
113
|
+
reporter, launcher, or disk manifest is required. Fresh invocation hosts and
|
|
114
|
+
supervised children belong to that main process. Worker disconnects cancel
|
|
115
|
+
their execution and reap the children. The receiver uses Stryker `10.0.0`'s
|
|
116
|
+
worker marker and generated schema defaults; its sockets do not keep Node alive.
|
|
117
|
+
|
|
118
|
+
Test IDs use structural work identities and project-relative paths. Every fresh
|
|
119
|
+
collection validates the complete eligible catalog, selection metadata, and
|
|
120
|
+
intentional skips before narrowing. Unknown IDs, catalog drift, unexpected
|
|
121
|
+
skips, and empty mutant filters return `Error`. The adapter expands Stryker's
|
|
122
|
+
sandbox file filters and preserves static activation for its static-mutant
|
|
123
|
+
planner path unless `ignoreStatic` requests runtime execution.
|
|
124
|
+
|
|
125
|
+
Counters retain their object identity across reused invocations. Test attribution
|
|
126
|
+
includes awaited cleanup. Infrastructure errors take precedence over timeouts
|
|
127
|
+
and confirmed kills; swallowed hit-limit exceptions still return `Timeout`.
|
|
128
|
+
Each invocation clears prior counters before collection. Activation, test identity,
|
|
129
|
+
hit-limit state, and the activation environment variable are cleared on exit,
|
|
130
|
+
including partial setup failures. Reset failures still attempt independent cleanup
|
|
131
|
+
and return `Error` if state cannot be cleared; retained runtime objects are never
|
|
132
|
+
replaced to recover. Detached result counters remain available after cleanup.
|
|
133
|
+
Ordinary reporters, records, duration history, V8 coverage, and artifact-file
|
|
134
|
+
persistence are disabled for these memory-only execution sessions.
|
|
135
|
+
|
|
99
136
|
Every invocation gets fresh scopes, observers, cleanup, and results. Failed
|
|
100
137
|
collection remains cached in reused mode; fresh mode can collect again on the
|
|
101
138
|
next invocation. Fresh hosts terminate before their invocation settles.
|