@systemfsoftware/stryker-js 0.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/CHANGELOG.md +126 -0
- package/LICENSE +213 -0
- package/README.md +32 -0
- package/dist/Checker-Bq8NXD8d.mjs +25 -0
- package/dist/Checker-DYgIIEai.d.mts +40 -0
- package/dist/Checker.d.mts +2 -0
- package/dist/Checker.mjs +2 -0
- package/dist/Evaluator-DLVXUcVj.d.mts +19 -0
- package/dist/Evaluator.d.mts +3 -0
- package/dist/Evaluator.mjs +9 -0
- package/dist/ExitClass.d.mts +8 -0
- package/dist/ExitClass.mjs +34 -0
- package/dist/ExitClass.schema-BmCUn2Sm.d.mts +6 -0
- package/dist/Ignorer-BUY68FZQ.d.mts +21 -0
- package/dist/Ignorer.d.mts +2 -0
- package/dist/Ignorer.mjs +7 -0
- package/dist/Mutant-BPRJTF8f.d.mts +351 -0
- package/dist/Mutant.d.mts +2 -0
- package/dist/Mutant.mjs +114 -0
- package/dist/Mutant.schema-BTWhFTk4.mjs +34 -0
- package/dist/Plugin-Ceh1G8Dz.mjs +117 -0
- package/dist/Plugin-ZYNaWrl7.d.mts +134 -0
- package/dist/Plugin.d.mts +2 -0
- package/dist/Plugin.mjs +2 -0
- package/dist/Reporter-COVWW1my.mjs +33 -0
- package/dist/Reporter-eZ3M7lO6.d.mts +83 -0
- package/dist/Reporter.d.mts +2 -0
- package/dist/Reporter.mjs +2 -0
- package/dist/Run-BudLsVwF.d.mts +183 -0
- package/dist/Run-lXratlN7.mjs +225 -0
- package/dist/Run.d.mts +2 -0
- package/dist/Run.mjs +2 -0
- package/dist/Schema-C7nahULg.mjs +249 -0
- package/dist/Schema-Df2kA6F7.d.mts +159 -0
- package/dist/Schema.d.mts +2 -0
- package/dist/Schema.mjs +2 -0
- package/dist/TestRunner-DC9U8Unb.mjs +181 -0
- package/dist/TestRunner.d.mts +2 -0
- package/dist/TestRunner.mjs +2 -0
- package/dist/index.d.mts +8 -0
- package/dist/index.mjs +9 -0
- package/dist/output-file.d.mts +8 -0
- package/dist/output-file.mjs +8 -0
- package/dist/provided-options.d.mts +16 -0
- package/dist/provided-options.mjs +1 -0
- package/dist/rolldown-runtime-D7D4PA-g.mjs +13 -0
- package/package.json +70 -0
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
import * as Context from "effect/Context";
|
|
2
|
+
import * as S from "effect/Schema";
|
|
3
|
+
import * as schema from "mutation-testing-report-schema/api";
|
|
4
|
+
import * as Effect from "effect/Effect";
|
|
5
|
+
//#region src/Mutant.schema.d.ts
|
|
6
|
+
declare const PositionSchema: S.Struct<{
|
|
7
|
+
readonly line: S.Finite;
|
|
8
|
+
readonly column: S.Finite;
|
|
9
|
+
}>;
|
|
10
|
+
declare const LocationSchema: S.Struct<{
|
|
11
|
+
readonly start: S.Struct<{
|
|
12
|
+
readonly line: S.Finite;
|
|
13
|
+
readonly column: S.Finite;
|
|
14
|
+
}>;
|
|
15
|
+
readonly end: S.Struct<{
|
|
16
|
+
readonly line: S.Finite;
|
|
17
|
+
readonly column: S.Finite;
|
|
18
|
+
}>;
|
|
19
|
+
}>;
|
|
20
|
+
declare const Mutant_base: S.Class<Mutant, S.TaggedStruct<"Mutant", {
|
|
21
|
+
readonly id: S.String;
|
|
22
|
+
readonly fileName: S.String;
|
|
23
|
+
readonly mutatorName: S.String;
|
|
24
|
+
readonly replacement: S.String;
|
|
25
|
+
readonly location: S.Struct<{
|
|
26
|
+
readonly start: S.Struct<{
|
|
27
|
+
readonly line: S.Finite;
|
|
28
|
+
readonly column: S.Finite;
|
|
29
|
+
}>;
|
|
30
|
+
readonly end: S.Struct<{
|
|
31
|
+
readonly line: S.Finite;
|
|
32
|
+
readonly column: S.Finite;
|
|
33
|
+
}>;
|
|
34
|
+
}>;
|
|
35
|
+
readonly status: S.optional<S.Literals<readonly ["Killed", "Survived", "NoCoverage", "Timeout", "CompileError", "RuntimeError", "Ignored", "Pending"]>>;
|
|
36
|
+
readonly statusReason: S.optional<S.String>;
|
|
37
|
+
readonly coveredBy: S.optional<S.$Array<S.String>>;
|
|
38
|
+
readonly static: S.optional<S.Boolean>;
|
|
39
|
+
readonly testsCompleted: S.optional<S.Finite>;
|
|
40
|
+
readonly description: S.optional<S.String>;
|
|
41
|
+
}>, {}>;
|
|
42
|
+
declare class Mutant extends Mutant_base {}
|
|
43
|
+
type Position$1 = S.Schema.Type<typeof PositionSchema>;
|
|
44
|
+
type Location = S.Schema.Type<typeof LocationSchema>;
|
|
45
|
+
//#endregion
|
|
46
|
+
//#region src/TestRunner.schema.d.ts
|
|
47
|
+
declare const DryRunStatus: S.Literals<readonly ["complete", "error", "timeout"]>;
|
|
48
|
+
type DryRunStatus = typeof DryRunStatus.Type;
|
|
49
|
+
declare const TestStatus: S.Literals<readonly ["success", "failed", "skipped"]>;
|
|
50
|
+
type TestStatus = typeof TestStatus.Type;
|
|
51
|
+
declare const MutantRunStatus: S.Literals<readonly ["killed", "survived", "timeout", "error"]>;
|
|
52
|
+
type MutantRunStatus = typeof MutantRunStatus.Type;
|
|
53
|
+
declare const TestResultSchema: S.Union<readonly [S.Struct<{
|
|
54
|
+
readonly id: S.String;
|
|
55
|
+
readonly name: S.String;
|
|
56
|
+
readonly timeSpentMs: S.Finite;
|
|
57
|
+
readonly fileName: S.optionalKey<S.String>;
|
|
58
|
+
readonly startPosition: S.optionalKey<S.Struct<{
|
|
59
|
+
readonly line: S.Finite;
|
|
60
|
+
readonly column: S.Finite;
|
|
61
|
+
}>>;
|
|
62
|
+
readonly status: S.Literal<"failed">;
|
|
63
|
+
readonly failureMessage: S.String;
|
|
64
|
+
}>, S.Struct<{
|
|
65
|
+
readonly id: S.String;
|
|
66
|
+
readonly name: S.String;
|
|
67
|
+
readonly timeSpentMs: S.Finite;
|
|
68
|
+
readonly fileName: S.optionalKey<S.String>;
|
|
69
|
+
readonly startPosition: S.optionalKey<S.Struct<{
|
|
70
|
+
readonly line: S.Finite;
|
|
71
|
+
readonly column: S.Finite;
|
|
72
|
+
}>>;
|
|
73
|
+
readonly status: S.Literal<"skipped">;
|
|
74
|
+
}>, S.Struct<{
|
|
75
|
+
readonly id: S.String;
|
|
76
|
+
readonly name: S.String;
|
|
77
|
+
readonly timeSpentMs: S.Finite;
|
|
78
|
+
readonly fileName: S.optionalKey<S.String>;
|
|
79
|
+
readonly startPosition: S.optionalKey<S.Struct<{
|
|
80
|
+
readonly line: S.Finite;
|
|
81
|
+
readonly column: S.Finite;
|
|
82
|
+
}>>;
|
|
83
|
+
readonly status: S.Literal<"success">;
|
|
84
|
+
}>]>;
|
|
85
|
+
declare const MutantCoverageSchema: S.Struct<{
|
|
86
|
+
readonly perTest: S.$Record<S.String, S.$Record<S.String, S.Finite>>;
|
|
87
|
+
readonly static: S.$Record<S.String, S.Finite>;
|
|
88
|
+
}>;
|
|
89
|
+
declare const DryRunResultSchema: S.Union<readonly [S.Struct<{
|
|
90
|
+
readonly status: S.Literal<"complete">;
|
|
91
|
+
readonly tests: S.$Array<S.Union<readonly [S.Struct<{
|
|
92
|
+
readonly id: S.String;
|
|
93
|
+
readonly name: S.String;
|
|
94
|
+
readonly timeSpentMs: S.Finite;
|
|
95
|
+
readonly fileName: S.optionalKey<S.String>;
|
|
96
|
+
readonly startPosition: S.optionalKey<S.Struct<{
|
|
97
|
+
readonly line: S.Finite;
|
|
98
|
+
readonly column: S.Finite;
|
|
99
|
+
}>>;
|
|
100
|
+
readonly status: S.Literal<"failed">;
|
|
101
|
+
readonly failureMessage: S.String;
|
|
102
|
+
}>, S.Struct<{
|
|
103
|
+
readonly id: S.String;
|
|
104
|
+
readonly name: S.String;
|
|
105
|
+
readonly timeSpentMs: S.Finite;
|
|
106
|
+
readonly fileName: S.optionalKey<S.String>;
|
|
107
|
+
readonly startPosition: S.optionalKey<S.Struct<{
|
|
108
|
+
readonly line: S.Finite;
|
|
109
|
+
readonly column: S.Finite;
|
|
110
|
+
}>>;
|
|
111
|
+
readonly status: S.Literal<"skipped">;
|
|
112
|
+
}>, S.Struct<{
|
|
113
|
+
readonly id: S.String;
|
|
114
|
+
readonly name: S.String;
|
|
115
|
+
readonly timeSpentMs: S.Finite;
|
|
116
|
+
readonly fileName: S.optionalKey<S.String>;
|
|
117
|
+
readonly startPosition: S.optionalKey<S.Struct<{
|
|
118
|
+
readonly line: S.Finite;
|
|
119
|
+
readonly column: S.Finite;
|
|
120
|
+
}>>;
|
|
121
|
+
readonly status: S.Literal<"success">;
|
|
122
|
+
}>]>>;
|
|
123
|
+
readonly mutantCoverage: S.optionalKey<S.Struct<{
|
|
124
|
+
readonly perTest: S.$Record<S.String, S.$Record<S.String, S.Finite>>;
|
|
125
|
+
readonly static: S.$Record<S.String, S.Finite>;
|
|
126
|
+
}>>;
|
|
127
|
+
}>, S.Struct<{
|
|
128
|
+
readonly status: S.Literal<"timeout">;
|
|
129
|
+
readonly reason: S.optionalKey<S.String>;
|
|
130
|
+
}>, S.Struct<{
|
|
131
|
+
readonly status: S.Literal<"error">;
|
|
132
|
+
readonly errorMessage: S.String;
|
|
133
|
+
}>]>;
|
|
134
|
+
declare const MutantRunResultSchema: S.Union<readonly [S.Struct<{
|
|
135
|
+
readonly status: S.Literal<"killed">;
|
|
136
|
+
readonly killedBy: S.$Array<S.String>;
|
|
137
|
+
readonly failureMessage: S.String;
|
|
138
|
+
readonly nrOfTests: S.Finite;
|
|
139
|
+
}>, S.Struct<{
|
|
140
|
+
readonly status: S.Literal<"survived">;
|
|
141
|
+
readonly nrOfTests: S.Finite;
|
|
142
|
+
}>, S.Struct<{
|
|
143
|
+
readonly status: S.Literal<"timeout">;
|
|
144
|
+
readonly reason: S.optionalKey<S.String>;
|
|
145
|
+
}>, S.Struct<{
|
|
146
|
+
readonly status: S.Literal<"error">;
|
|
147
|
+
readonly errorMessage: S.String;
|
|
148
|
+
}>]>;
|
|
149
|
+
declare const CoverageAnalysisSchema: S.Literals<readonly ["off", "all", "perTest"]>;
|
|
150
|
+
declare const DryRunOptionsSchema: S.Struct<{
|
|
151
|
+
readonly timeout: S.Finite;
|
|
152
|
+
readonly disableBail: S.Boolean;
|
|
153
|
+
readonly coverageAnalysis: S.Literals<readonly ["off", "all", "perTest"]>;
|
|
154
|
+
readonly files: S.optionalKey<S.$Array<S.String>>;
|
|
155
|
+
readonly testFiles: S.optionalKey<S.$Array<S.String>>;
|
|
156
|
+
}>;
|
|
157
|
+
declare const MutantActivationSchema: S.Literals<readonly ["runtime", "static"]>;
|
|
158
|
+
declare const MutantRunOptionsSchema: S.Struct<{
|
|
159
|
+
readonly timeout: S.Finite;
|
|
160
|
+
readonly disableBail: S.Boolean;
|
|
161
|
+
readonly activeMutant: typeof Mutant;
|
|
162
|
+
readonly sandboxFileName: S.String;
|
|
163
|
+
readonly mutantActivation: S.Literals<readonly ["runtime", "static"]>;
|
|
164
|
+
readonly reloadEnvironment: S.Boolean;
|
|
165
|
+
readonly testFilter: S.optionalKey<S.$Array<S.String>>;
|
|
166
|
+
readonly hitLimit: S.optionalKey<S.Finite>;
|
|
167
|
+
}>;
|
|
168
|
+
declare const TestRunnerCapabilitiesSchema: S.Struct<{
|
|
169
|
+
readonly reloadEnvironment: S.Boolean;
|
|
170
|
+
}>;
|
|
171
|
+
declare const TestRunnerFailed_base: S.Class<TestRunnerFailed, S.TaggedStruct<"TestRunnerFailed", {
|
|
172
|
+
readonly cause: S.String;
|
|
173
|
+
readonly phase: S.Literals<readonly ["capabilities", "dispose", "dryRun", "init", "mutantRun"]>;
|
|
174
|
+
readonly runnerName: S.String;
|
|
175
|
+
}>, import("effect/Cause").YieldableError>;
|
|
176
|
+
declare class TestRunnerFailed extends TestRunnerFailed_base {}
|
|
177
|
+
declare namespace TestRunner_d_exports {
|
|
178
|
+
export { BaseTestResult, CompleteDryRunResult, CoverageAnalysis, CoverageAnalysisSchema, DryRunOptions, DryRunOptionsSchema, DryRunResult, DryRunResultSchema, DryRunStatus, ErrorDryRunResult, ErrorMutantRunResult, FailedTestResult, KilledMutantRunResult, MutantActivation, MutantActivationSchema, MutantCoverage$1 as MutantCoverage, MutantCoverageSchema, MutantRunOptions, MutantRunOptionsSchema, MutantRunResult, MutantRunResultSchema, MutantRunStatus, Position, RunOptions, SkippedTestResult, SuccessTestResult, SurvivedMutantRunResult, TestResult, TestResultSchema, TestRunner, TestRunnerCapabilities, TestRunnerCapabilitiesSchema, TestRunnerFailed, TestRunnerService, TestStatus, TimeoutDryRunResult, TimeoutMutantRunResult, testFilesProvided, toMutantRunResult };
|
|
179
|
+
}
|
|
180
|
+
interface Position {
|
|
181
|
+
readonly line: number;
|
|
182
|
+
readonly column: number;
|
|
183
|
+
}
|
|
184
|
+
interface BaseTestResult {
|
|
185
|
+
readonly id: string;
|
|
186
|
+
readonly name: string;
|
|
187
|
+
readonly timeSpentMs: number;
|
|
188
|
+
readonly fileName?: string;
|
|
189
|
+
readonly startPosition?: Position;
|
|
190
|
+
}
|
|
191
|
+
interface FailedTestResult extends BaseTestResult {
|
|
192
|
+
readonly status: 'failed';
|
|
193
|
+
readonly failureMessage: string;
|
|
194
|
+
}
|
|
195
|
+
interface SkippedTestResult extends BaseTestResult {
|
|
196
|
+
readonly status: 'skipped';
|
|
197
|
+
}
|
|
198
|
+
interface SuccessTestResult extends BaseTestResult {
|
|
199
|
+
readonly status: 'success';
|
|
200
|
+
}
|
|
201
|
+
type TestResult = FailedTestResult | SkippedTestResult | SuccessTestResult;
|
|
202
|
+
interface MutantCoverage$1 {
|
|
203
|
+
readonly perTest: Record<string, Record<string, number>>;
|
|
204
|
+
readonly static: Record<string, number>;
|
|
205
|
+
}
|
|
206
|
+
interface CompleteDryRunResult {
|
|
207
|
+
readonly tests: readonly TestResult[];
|
|
208
|
+
readonly mutantCoverage?: MutantCoverage$1;
|
|
209
|
+
readonly status: 'complete';
|
|
210
|
+
}
|
|
211
|
+
interface TimeoutDryRunResult {
|
|
212
|
+
readonly status: 'timeout';
|
|
213
|
+
readonly reason?: string;
|
|
214
|
+
}
|
|
215
|
+
interface ErrorDryRunResult {
|
|
216
|
+
readonly status: 'error';
|
|
217
|
+
readonly errorMessage: string;
|
|
218
|
+
}
|
|
219
|
+
type DryRunResult = CompleteDryRunResult | ErrorDryRunResult | TimeoutDryRunResult;
|
|
220
|
+
interface TimeoutMutantRunResult {
|
|
221
|
+
readonly status: 'timeout';
|
|
222
|
+
readonly reason?: string;
|
|
223
|
+
}
|
|
224
|
+
interface KilledMutantRunResult {
|
|
225
|
+
readonly status: 'killed';
|
|
226
|
+
readonly killedBy: readonly string[];
|
|
227
|
+
readonly failureMessage: string;
|
|
228
|
+
readonly nrOfTests: number;
|
|
229
|
+
}
|
|
230
|
+
interface SurvivedMutantRunResult {
|
|
231
|
+
readonly status: 'survived';
|
|
232
|
+
readonly nrOfTests: number;
|
|
233
|
+
}
|
|
234
|
+
interface ErrorMutantRunResult {
|
|
235
|
+
readonly status: 'error';
|
|
236
|
+
readonly errorMessage: string;
|
|
237
|
+
}
|
|
238
|
+
type MutantRunResult = ErrorMutantRunResult | KilledMutantRunResult | SurvivedMutantRunResult | TimeoutMutantRunResult;
|
|
239
|
+
type CoverageAnalysis = 'off' | 'all' | 'perTest';
|
|
240
|
+
interface RunOptions {
|
|
241
|
+
readonly timeout: number;
|
|
242
|
+
readonly disableBail: boolean;
|
|
243
|
+
}
|
|
244
|
+
interface DryRunOptions extends RunOptions {
|
|
245
|
+
readonly coverageAnalysis: CoverageAnalysis;
|
|
246
|
+
readonly files?: readonly string[];
|
|
247
|
+
readonly testFiles?: readonly string[];
|
|
248
|
+
}
|
|
249
|
+
type MutantActivation = 'runtime' | 'static';
|
|
250
|
+
interface MutantRunOptions extends RunOptions {
|
|
251
|
+
readonly testFilter?: readonly string[];
|
|
252
|
+
readonly hitLimit?: number;
|
|
253
|
+
readonly activeMutant: Mutant;
|
|
254
|
+
readonly sandboxFileName: string;
|
|
255
|
+
readonly mutantActivation: MutantActivation;
|
|
256
|
+
readonly reloadEnvironment: boolean;
|
|
257
|
+
}
|
|
258
|
+
interface TestRunnerCapabilities {
|
|
259
|
+
readonly reloadEnvironment: boolean;
|
|
260
|
+
}
|
|
261
|
+
declare function toMutantRunResult(dryRunResult: DryRunResult, reportAllKillers: boolean): MutantRunResult;
|
|
262
|
+
interface TestRunnerService {
|
|
263
|
+
readonly capabilities: Effect.Effect<TestRunnerCapabilities, TestRunnerFailed>;
|
|
264
|
+
readonly init: Effect.Effect<void, TestRunnerFailed>;
|
|
265
|
+
readonly dryRun: (options: DryRunOptions) => Effect.Effect<DryRunResult, TestRunnerFailed>;
|
|
266
|
+
readonly mutantRun: (options: MutantRunOptions) => Effect.Effect<MutantRunResult, TestRunnerFailed>;
|
|
267
|
+
readonly dispose: Effect.Effect<void, TestRunnerFailed>;
|
|
268
|
+
}
|
|
269
|
+
declare const TestRunner_base: Context.ServiceClass<TestRunner, "~@systemfsoftware/stryker-js/TestRunner", TestRunnerService>;
|
|
270
|
+
declare class TestRunner extends TestRunner_base {}
|
|
271
|
+
declare function testFilesProvided(options: {
|
|
272
|
+
readonly testFiles?: readonly string[];
|
|
273
|
+
}): boolean;
|
|
274
|
+
declare namespace Mutant_d_exports {
|
|
275
|
+
export { Coverage, CoverageData, CoveragePerTestId, ERROR_CODES, EarlyResultPlan, ErrnoException, FileDescription, FileDescriptions, INSTRUMENTER_CONSTANTS, InstrumenterContext, Location, LocationSchema, Mutant, MutantCoverage, MutantEarlyResultPlan, MutantResult, MutantRunPlan, MutantStatus, MutantTestCoverage, MutantTestPlan, MutateDescription, MutationRange, Position$1 as Position, PositionSchema, RunPlan, TestPlan, causeText, errorToString, isErrnoException, isMutant, normalizeFileName, schema };
|
|
276
|
+
}
|
|
277
|
+
type CoverageData = Record<string, number>;
|
|
278
|
+
type CoveragePerTestId = Record<string, CoverageData>;
|
|
279
|
+
interface Coverage {
|
|
280
|
+
readonly static: CoverageData;
|
|
281
|
+
readonly perTest: CoveragePerTestId;
|
|
282
|
+
}
|
|
283
|
+
type MutantStatus = 'Killed' | 'Survived' | 'NoCoverage' | 'Timeout' | 'CompileError' | 'RuntimeError' | 'Ignored' | 'Pending';
|
|
284
|
+
interface EarlyResultPlan {
|
|
285
|
+
readonly plan: 'EarlyResult';
|
|
286
|
+
readonly mutant: Mutant;
|
|
287
|
+
}
|
|
288
|
+
interface RunPlan {
|
|
289
|
+
readonly plan: 'Run';
|
|
290
|
+
readonly mutant: Mutant;
|
|
291
|
+
readonly runOptions: MutantRunOptions;
|
|
292
|
+
readonly netTime: number;
|
|
293
|
+
}
|
|
294
|
+
type TestPlan = EarlyResultPlan | RunPlan;
|
|
295
|
+
declare const isMutant: (value: unknown) => value is Mutant;
|
|
296
|
+
type MutantTestCoverage = Mutant & {
|
|
297
|
+
readonly coveredBy: ReadonlyArray<string> | undefined;
|
|
298
|
+
readonly static: boolean | undefined;
|
|
299
|
+
};
|
|
300
|
+
type MutantResult = Mutant & {
|
|
301
|
+
readonly status: MutantStatus;
|
|
302
|
+
readonly statusReason?: string | undefined;
|
|
303
|
+
readonly testsCompleted?: number | undefined;
|
|
304
|
+
readonly killedBy?: readonly string[] | undefined;
|
|
305
|
+
readonly coveredBy?: readonly string[] | undefined;
|
|
306
|
+
readonly static?: boolean | undefined;
|
|
307
|
+
};
|
|
308
|
+
declare const INSTRUMENTER_CONSTANTS: Readonly<{
|
|
309
|
+
NAMESPACE: '__stryker__';
|
|
310
|
+
MUTATION_COVERAGE_OBJECT: 'mutantCoverage';
|
|
311
|
+
ACTIVE_MUTANT: 'activeMutant';
|
|
312
|
+
CURRENT_TEST_ID: 'currentTestId';
|
|
313
|
+
HIT_COUNT: 'hitCount';
|
|
314
|
+
HIT_LIMIT: 'hitLimit';
|
|
315
|
+
ACTIVE_MUTANT_ENV_VARIABLE: '__STRYKER_ACTIVE_MUTANT__';
|
|
316
|
+
}>;
|
|
317
|
+
interface InstrumenterContext {
|
|
318
|
+
activeMutant?: string;
|
|
319
|
+
currentTestId?: string;
|
|
320
|
+
mutantCoverage?: MutantCoverage;
|
|
321
|
+
hitCount?: number;
|
|
322
|
+
hitLimit?: number;
|
|
323
|
+
}
|
|
324
|
+
type MutantCoverage = Coverage;
|
|
325
|
+
declare function normalizeFileName(fileName: string): string;
|
|
326
|
+
interface ErrnoException extends Error {
|
|
327
|
+
code?: string;
|
|
328
|
+
errno?: number;
|
|
329
|
+
path?: string;
|
|
330
|
+
syscall?: string;
|
|
331
|
+
}
|
|
332
|
+
declare function isErrnoException(error: unknown): error is ErrnoException;
|
|
333
|
+
declare function errorToString(error: unknown): string;
|
|
334
|
+
declare const ERROR_CODES: Readonly<{
|
|
335
|
+
NoSuchFileOrDirectory: 'ENOENT';
|
|
336
|
+
}>;
|
|
337
|
+
interface MutationRange {
|
|
338
|
+
readonly start: Position$1;
|
|
339
|
+
readonly end: Position$1;
|
|
340
|
+
}
|
|
341
|
+
type MutateDescription = ReadonlyArray<MutationRange> | boolean;
|
|
342
|
+
interface FileDescription {
|
|
343
|
+
readonly mutate: MutateDescription;
|
|
344
|
+
}
|
|
345
|
+
type FileDescriptions = Record<string, FileDescription>;
|
|
346
|
+
type MutantRunPlan = RunPlan;
|
|
347
|
+
type MutantEarlyResultPlan = EarlyResultPlan;
|
|
348
|
+
type MutantTestPlan = TestPlan;
|
|
349
|
+
declare const causeText: (cause: unknown, depth: number) => string | undefined;
|
|
350
|
+
//#endregion
|
|
351
|
+
export { TimeoutMutantRunResult as $, CompleteDryRunResult as A, MutantRunOptions as B, causeText as C, normalizeFileName as D, isMutant as E, ErrorMutantRunResult as F, SuccessTestResult as G, Position as H, FailedTestResult as I, TestRunner as J, SurvivedMutantRunResult as K, KilledMutantRunResult as L, DryRunOptions as M, DryRunResult as N, schema as O, ErrorDryRunResult as P, TimeoutDryRunResult as Q, MutantActivation as R, TestPlan as S, isErrnoException as T, RunOptions as U, MutantRunResult as V, SkippedTestResult as W, TestRunnerService as X, TestRunnerCapabilities as Y, TestRunner_d_exports as Z, MutantTestPlan as _, Mutant as _t, EarlyResultPlan as a, DryRunStatus as at, MutationRange as b, FileDescriptions as c, MutantRunOptionsSchema as ct, MutantCoverage as d, TestResultSchema as dt, testFilesProvided as et, MutantEarlyResultPlan as f, TestRunnerCapabilitiesSchema as ft, MutantTestCoverage as g, LocationSchema as gt, MutantStatus as h, Location as ht, ERROR_CODES as i, DryRunResultSchema as it, CoverageAnalysis as j, BaseTestResult as k, INSTRUMENTER_CONSTANTS as l, MutantRunResultSchema as lt, MutantRunPlan as m, TestStatus as mt, CoverageData as n, CoverageAnalysisSchema as nt, ErrnoException as o, MutantActivationSchema as ot, MutantResult as p, TestRunnerFailed as pt, TestResult as q, CoveragePerTestId as r, DryRunOptionsSchema as rt, FileDescription as s, MutantCoverageSchema as st, Coverage as t, toMutantRunResult as tt, InstrumenterContext as u, MutantRunStatus as ut, Mutant_d_exports as v, Position$1 as vt, errorToString as w, RunPlan as x, MutateDescription as y, PositionSchema as yt, MutantCoverage$1 as z };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { C as causeText, D as normalizeFileName, E as isMutant, O as schema, S as TestPlan, T as isErrnoException, _ as MutantTestPlan, _t as Mutant, a as EarlyResultPlan, b as MutationRange, c as FileDescriptions, d as MutantCoverage, f as MutantEarlyResultPlan, g as MutantTestCoverage, gt as LocationSchema, h as MutantStatus, ht as Location, i as ERROR_CODES, l as INSTRUMENTER_CONSTANTS, m as MutantRunPlan, n as CoverageData, o as ErrnoException, p as MutantResult, r as CoveragePerTestId, s as FileDescription, t as Coverage, u as InstrumenterContext, vt as Position, w as errorToString, x as RunPlan, y as MutateDescription, yt as PositionSchema } from "./Mutant-BPRJTF8f.mjs";
|
|
2
|
+
export { Coverage, CoverageData, CoveragePerTestId, ERROR_CODES, EarlyResultPlan, ErrnoException, FileDescription, FileDescriptions, INSTRUMENTER_CONSTANTS, InstrumenterContext, type Location, LocationSchema, Mutant, MutantCoverage, MutantEarlyResultPlan, MutantResult, MutantRunPlan, MutantStatus, MutantTestCoverage, MutantTestPlan, MutateDescription, MutationRange, type Position, PositionSchema, RunPlan, TestPlan, causeText, errorToString, isErrnoException, isMutant, normalizeFileName, schema };
|
package/dist/Mutant.mjs
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
|
|
2
|
+
import { n as Mutant, r as PositionSchema, t as LocationSchema } from "./Mutant.schema-BTWhFTk4.mjs";
|
|
3
|
+
import * as schema from "mutation-testing-report-schema/api";
|
|
4
|
+
//#region src/Mutant.ts
|
|
5
|
+
var Mutant_exports = /* @__PURE__ */ __exportAll({
|
|
6
|
+
ERROR_CODES: () => ERROR_CODES,
|
|
7
|
+
INSTRUMENTER_CONSTANTS: () => INSTRUMENTER_CONSTANTS,
|
|
8
|
+
LocationSchema: () => LocationSchema,
|
|
9
|
+
Mutant: () => Mutant,
|
|
10
|
+
PositionSchema: () => PositionSchema,
|
|
11
|
+
causeText: () => causeText,
|
|
12
|
+
errorToString: () => errorToString,
|
|
13
|
+
isErrnoException: () => isErrnoException,
|
|
14
|
+
isMutant: () => isMutant,
|
|
15
|
+
normalizeFileName: () => normalizeFileName,
|
|
16
|
+
schema: () => schema
|
|
17
|
+
});
|
|
18
|
+
const isMutant = (value) => value instanceof Mutant;
|
|
19
|
+
const INSTRUMENTER_CONSTANTS = Object.freeze({
|
|
20
|
+
NAMESPACE: "__stryker__",
|
|
21
|
+
MUTATION_COVERAGE_OBJECT: "mutantCoverage",
|
|
22
|
+
ACTIVE_MUTANT: "activeMutant",
|
|
23
|
+
CURRENT_TEST_ID: "currentTestId",
|
|
24
|
+
HIT_COUNT: "hitCount",
|
|
25
|
+
HIT_LIMIT: "hitLimit",
|
|
26
|
+
ACTIVE_MUTANT_ENV_VARIABLE: "__STRYKER_ACTIVE_MUTANT__"
|
|
27
|
+
});
|
|
28
|
+
function normalizeFileName(fileName) {
|
|
29
|
+
return fileName.replace(/\\/g, "/");
|
|
30
|
+
}
|
|
31
|
+
function isErrnoException(error) {
|
|
32
|
+
if (!(error instanceof Error)) return false;
|
|
33
|
+
if (!("code" in error)) return false;
|
|
34
|
+
return typeof Reflect.get(error, "code") === "string";
|
|
35
|
+
}
|
|
36
|
+
const isEmptyError = (error) => {
|
|
37
|
+
if (error === void 0 || error === null) return true;
|
|
38
|
+
if (typeof error === "string" && error.length === 0) return true;
|
|
39
|
+
if (error === 0 || error === false) return true;
|
|
40
|
+
if (typeof error === "number" && Number.isNaN(error)) return true;
|
|
41
|
+
return false;
|
|
42
|
+
};
|
|
43
|
+
const formatErrnoException = (error) => {
|
|
44
|
+
const stack = error.stack;
|
|
45
|
+
if (stack !== void 0 && stack.length > 0) return `${error.name}: ${error.code} (${error.syscall}) ${stack}`;
|
|
46
|
+
return `${error.name}: ${error.code} (${error.syscall})`;
|
|
47
|
+
};
|
|
48
|
+
const formatError = (error) => {
|
|
49
|
+
const message = `${error.name}: ${error.message}`;
|
|
50
|
+
if (error.stack !== void 0 && error.stack.length > 0) return `${message}\n${error.stack.toString()}`;
|
|
51
|
+
return message;
|
|
52
|
+
};
|
|
53
|
+
const stringifyNonError = (error) => {
|
|
54
|
+
if (typeof error === "string") return error;
|
|
55
|
+
if (typeof error === "number" || typeof error === "boolean" || typeof error === "bigint") return JSON.stringify(error);
|
|
56
|
+
try {
|
|
57
|
+
const json = JSON.stringify(error);
|
|
58
|
+
if (typeof json === "string" && json.length > 0) return json;
|
|
59
|
+
} catch {}
|
|
60
|
+
if (typeof error === "object" && error !== null && "toString" in error) {
|
|
61
|
+
const toStringValue = Reflect.get(error, "toString");
|
|
62
|
+
if (typeof toStringValue === "function") try {
|
|
63
|
+
const text = Reflect.apply(toStringValue, error, []);
|
|
64
|
+
if (typeof text === "string" && text.length > 0 && text !== "[object Object]") return text;
|
|
65
|
+
} catch {}
|
|
66
|
+
}
|
|
67
|
+
return "";
|
|
68
|
+
};
|
|
69
|
+
function errorToString(error) {
|
|
70
|
+
if (isEmptyError(error)) return "";
|
|
71
|
+
if (error instanceof Error) {
|
|
72
|
+
if (isErrnoException(error)) return formatErrnoException(error);
|
|
73
|
+
return formatError(error);
|
|
74
|
+
}
|
|
75
|
+
return stringifyNonError(error);
|
|
76
|
+
}
|
|
77
|
+
const ERROR_CODES = Object.freeze({ NoSuchFileOrDirectory: "ENOENT" });
|
|
78
|
+
const stringField = (value, key) => {
|
|
79
|
+
if (!(key in value)) return;
|
|
80
|
+
const field = Reflect.get(value, key);
|
|
81
|
+
if (typeof field === "string" && field.length > 0) return field;
|
|
82
|
+
};
|
|
83
|
+
const tagOf = (value) => {
|
|
84
|
+
let tag;
|
|
85
|
+
if ("_tag" in value) tag = Reflect.get(value, "_tag");
|
|
86
|
+
else tag = void 0;
|
|
87
|
+
if (typeof tag === "string" && tag.length > 0) return tag;
|
|
88
|
+
if (value instanceof Error && value.name.length > 0) return value.name;
|
|
89
|
+
};
|
|
90
|
+
const causeText = (cause, depth) => {
|
|
91
|
+
if (depth > 4 || cause === void 0 || cause === null) return;
|
|
92
|
+
if (typeof cause === "string") {
|
|
93
|
+
if (cause.length > 0) return cause;
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
if (typeof cause !== "object") return;
|
|
97
|
+
let own;
|
|
98
|
+
const reason = stringField(cause, "reason");
|
|
99
|
+
if (reason !== void 0) own = reason;
|
|
100
|
+
else {
|
|
101
|
+
const message = stringField(cause, "message");
|
|
102
|
+
if (message !== void 0) own = message;
|
|
103
|
+
else if (cause instanceof Error && cause.message.length > 0) own = cause.message;
|
|
104
|
+
else own = tagOf(cause);
|
|
105
|
+
}
|
|
106
|
+
let nested;
|
|
107
|
+
if ("cause" in cause) nested = causeText(Reflect.get(cause, "cause"), depth + 1);
|
|
108
|
+
else nested = void 0;
|
|
109
|
+
if (own === void 0) return nested;
|
|
110
|
+
if (nested === void 0) return own;
|
|
111
|
+
return `${own}: ${nested}`;
|
|
112
|
+
};
|
|
113
|
+
//#endregion
|
|
114
|
+
export { ERROR_CODES, INSTRUMENTER_CONSTANTS, LocationSchema, Mutant, PositionSchema, causeText, errorToString, isErrnoException, isMutant, normalizeFileName, schema, Mutant_exports as t };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import * as S from "effect/Schema";
|
|
2
|
+
//#region src/Mutant.schema.ts
|
|
3
|
+
const PositionSchema = S.Struct({
|
|
4
|
+
line: S.Finite,
|
|
5
|
+
column: S.Finite
|
|
6
|
+
});
|
|
7
|
+
const LocationSchema = S.Struct({
|
|
8
|
+
start: PositionSchema,
|
|
9
|
+
end: PositionSchema
|
|
10
|
+
});
|
|
11
|
+
var Mutant = class extends S.TaggedClass()("Mutant", {
|
|
12
|
+
id: S.String,
|
|
13
|
+
fileName: S.String,
|
|
14
|
+
mutatorName: S.String,
|
|
15
|
+
replacement: S.String,
|
|
16
|
+
location: LocationSchema,
|
|
17
|
+
status: S.optional(S.Literals([
|
|
18
|
+
"Killed",
|
|
19
|
+
"Survived",
|
|
20
|
+
"NoCoverage",
|
|
21
|
+
"Timeout",
|
|
22
|
+
"CompileError",
|
|
23
|
+
"RuntimeError",
|
|
24
|
+
"Ignored",
|
|
25
|
+
"Pending"
|
|
26
|
+
])),
|
|
27
|
+
statusReason: S.optional(S.String),
|
|
28
|
+
coveredBy: S.optional(S.Array(S.String)),
|
|
29
|
+
static: S.optional(S.Boolean),
|
|
30
|
+
testsCompleted: S.optional(S.Finite),
|
|
31
|
+
description: S.optional(S.String)
|
|
32
|
+
}) {};
|
|
33
|
+
//#endregion
|
|
34
|
+
export { Mutant as n, PositionSchema as r, LocationSchema as t };
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
|
|
2
|
+
import { t as Reporter } from "./Reporter-COVWW1my.mjs";
|
|
3
|
+
import * as Context from "effect/Context";
|
|
4
|
+
import * as S from "effect/Schema";
|
|
5
|
+
import * as Effect from "effect/Effect";
|
|
6
|
+
import * as Layer from "effect/Layer";
|
|
7
|
+
import * as MutableHashMap from "effect/MutableHashMap";
|
|
8
|
+
import * as Option from "effect/Option";
|
|
9
|
+
//#region src/Plugin.schema.ts
|
|
10
|
+
const PluginKind = S.Literals([
|
|
11
|
+
"Checker",
|
|
12
|
+
"TestRunner",
|
|
13
|
+
"Reporter",
|
|
14
|
+
"Ignore",
|
|
15
|
+
"Evaluator"
|
|
16
|
+
]);
|
|
17
|
+
var PluginContribution = class extends S.TaggedClass()("PluginContribution", {
|
|
18
|
+
kind: PluginKind,
|
|
19
|
+
name: S.String,
|
|
20
|
+
layer: S.Unknown
|
|
21
|
+
}) {};
|
|
22
|
+
var Shadowing = class extends S.TaggedClass()("Shadowing", {
|
|
23
|
+
kind: S.String,
|
|
24
|
+
name: S.String,
|
|
25
|
+
shadowedIndex: S.Finite,
|
|
26
|
+
winnerIndex: S.Finite
|
|
27
|
+
}) {};
|
|
28
|
+
//#endregion
|
|
29
|
+
//#region src/Plugin.ts
|
|
30
|
+
var Plugin_exports = /* @__PURE__ */ __exportAll({
|
|
31
|
+
PluginContribution: () => PluginContribution,
|
|
32
|
+
PluginKind: () => PluginKind,
|
|
33
|
+
RunConfiguration: () => RunConfiguration,
|
|
34
|
+
SandboxDirectory: () => SandboxDirectory,
|
|
35
|
+
Shadowing: () => Shadowing,
|
|
36
|
+
composePlugins: () => composePlugins,
|
|
37
|
+
declarePlugin: () => declarePlugin
|
|
38
|
+
});
|
|
39
|
+
var RunConfiguration = class extends Context.Service()("~@systemfsoftware/stryker-js/RunConfiguration") {};
|
|
40
|
+
var SandboxDirectory = class extends Context.Service()("~@systemfsoftware/stryker-js/SandboxDirectory") {};
|
|
41
|
+
function declarePlugin(kind, name, layer) {
|
|
42
|
+
return new PluginContribution({
|
|
43
|
+
kind,
|
|
44
|
+
name,
|
|
45
|
+
layer
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
function foldContributions(contributions) {
|
|
49
|
+
const resolved = MutableHashMap.empty();
|
|
50
|
+
const shadowings = [];
|
|
51
|
+
const lastSeen = MutableHashMap.empty();
|
|
52
|
+
for (const [index, contribution] of contributions.entries()) {
|
|
53
|
+
const key = `${contribution.kind}:${contribution.name}`;
|
|
54
|
+
const previous = MutableHashMap.get(lastSeen, key);
|
|
55
|
+
if (Option.isSome(previous)) shadowings.push(new Shadowing({
|
|
56
|
+
kind: String(contribution.kind),
|
|
57
|
+
name: contribution.name,
|
|
58
|
+
shadowedIndex: previous.value,
|
|
59
|
+
winnerIndex: index
|
|
60
|
+
}));
|
|
61
|
+
MutableHashMap.set(resolved, key, contribution);
|
|
62
|
+
MutableHashMap.set(lastSeen, key, index);
|
|
63
|
+
}
|
|
64
|
+
return {
|
|
65
|
+
resolved,
|
|
66
|
+
shadowings
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
function composePlugins(contributions) {
|
|
70
|
+
const { resolved, shadowings } = foldContributions(contributions);
|
|
71
|
+
const allResolved = Array.from(MutableHashMap.values(resolved));
|
|
72
|
+
const reporterContributions = allResolved.filter((c) => c.kind === "Reporter");
|
|
73
|
+
const nonReporterLayers = allResolved.filter((c) => c.kind !== "Reporter").map((contribution) => contribution.layer);
|
|
74
|
+
let broadcastLayer;
|
|
75
|
+
if (reporterContributions.length > 0) broadcastLayer = Layer.effect(Reporter, Effect.gen(function* () {
|
|
76
|
+
const config = yield* RunConfiguration;
|
|
77
|
+
const wantedNames = {};
|
|
78
|
+
for (const name of config.reporters) wantedNames[name.toLowerCase()] = true;
|
|
79
|
+
const selected = reporterContributions.filter((c) => c.name.toLowerCase() in wantedNames);
|
|
80
|
+
const sandboxOption = yield* Effect.serviceOption(SandboxDirectory);
|
|
81
|
+
const namedReporters = [];
|
|
82
|
+
for (const contribution of selected) {
|
|
83
|
+
let buildEffect = Layer.build(contribution.layer).pipe(Effect.provideService(RunConfiguration, config));
|
|
84
|
+
if (Option.isSome(sandboxOption)) buildEffect = buildEffect.pipe(Effect.provideService(SandboxDirectory, sandboxOption.value));
|
|
85
|
+
const ctx = yield* buildEffect;
|
|
86
|
+
const reporter = Context.get(ctx, Reporter);
|
|
87
|
+
namedReporters.push({
|
|
88
|
+
name: contribution.name,
|
|
89
|
+
reporter
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
const toEach = (event, call) => Effect.forEach(namedReporters, ({ name, reporter }) => call(reporter).pipe(Effect.catchCause((cause) => Effect.logWarning(`Reporter "${name}" failed handling ${event}`).pipe(Effect.annotateLogs("cause", cause)))), {
|
|
93
|
+
concurrency: "unbounded",
|
|
94
|
+
discard: true
|
|
95
|
+
});
|
|
96
|
+
return {
|
|
97
|
+
onDryRunCompleted: (event) => toEach("onDryRunCompleted", (r) => r.onDryRunCompleted(event)),
|
|
98
|
+
onMutationTestingPlanReady: (event) => toEach("onMutationTestingPlanReady", (r) => r.onMutationTestingPlanReady(event)),
|
|
99
|
+
onMutantTested: (result) => toEach("onMutantTested", (r) => r.onMutantTested(result)),
|
|
100
|
+
onMutationTestReportReady: (report, metrics) => toEach("onMutationTestReportReady", (r) => r.onMutationTestReportReady(report, metrics)),
|
|
101
|
+
wrapUp: toEach("wrapUp", (r) => r.wrapUp)
|
|
102
|
+
};
|
|
103
|
+
}));
|
|
104
|
+
const allLayers = [...nonReporterLayers];
|
|
105
|
+
if (broadcastLayer !== void 0) allLayers.push(broadcastLayer);
|
|
106
|
+
if (allLayers.length === 0) return {
|
|
107
|
+
layer: Option.none(),
|
|
108
|
+
shadowings
|
|
109
|
+
};
|
|
110
|
+
const merged = allLayers.reduce((acc, next) => Layer.merge(acc, next));
|
|
111
|
+
return {
|
|
112
|
+
layer: Option.some(merged),
|
|
113
|
+
shadowings
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
//#endregion
|
|
117
|
+
export { declarePlugin as a, Shadowing as c, composePlugins as i, RunConfiguration as n, PluginContribution as o, SandboxDirectory as r, PluginKind as s, Plugin_exports as t };
|