@systemfsoftware/stryker-js-instrumenter 7.0.0 → 7.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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @systemfsoftware/stryker-js-instrumenter
2
2
 
3
+ ## 7.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Types that appear on the published CLI and instrumenter APIs are now exported.
8
+
3
9
  ## 7.0.0
4
10
 
5
11
  ### Major Changes
@@ -0,0 +1,163 @@
1
+ import * as S from "effect/Schema";
2
+ //#region src/Location.schema.d.ts
3
+ declare const PositionSchema: S.Struct<{
4
+ readonly line: S.Finite;
5
+ readonly column: S.Finite;
6
+ }>;
7
+ type Position = typeof PositionSchema.Type;
8
+ declare const LocationSchema: S.Struct<{
9
+ readonly start: S.Struct<{
10
+ readonly line: S.Finite;
11
+ readonly column: S.Finite;
12
+ }>;
13
+ readonly end: S.Struct<{
14
+ readonly line: S.Finite;
15
+ readonly column: S.Finite;
16
+ }>;
17
+ }>;
18
+ type Location = typeof LocationSchema.Type;
19
+ declare const OpenEndLocationSchema: S.Struct<{
20
+ readonly start: S.Struct<{
21
+ readonly line: S.Finite;
22
+ readonly column: S.Finite;
23
+ }>;
24
+ readonly end: S.optional<S.Struct<{
25
+ readonly line: S.Finite;
26
+ readonly column: S.Finite;
27
+ }>>;
28
+ }>;
29
+ type OpenEndLocation = typeof OpenEndLocationSchema.Type;
30
+ //#endregion
31
+ //#region src/Mutant.schema.d.ts
32
+ declare const MutantStatusSchema: S.Literals<readonly ["Killed", "Survived", "NoCoverage", "CompileError", "RuntimeError", "Timeout", "Ignored", "Pending"]>;
33
+ type MutantStatus = typeof MutantStatusSchema.Type;
34
+ declare const Mutant_base: S.Class<Mutant, S.TaggedStruct<"Mutant", {
35
+ readonly id: S.NonEmptyString;
36
+ readonly fileName: S.NonEmptyString;
37
+ readonly mutatorName: S.NonEmptyString;
38
+ readonly replacement: S.String;
39
+ readonly location: S.Struct<{
40
+ readonly start: S.Struct<{
41
+ readonly line: S.Finite;
42
+ readonly column: S.Finite;
43
+ }>;
44
+ readonly end: S.Struct<{
45
+ readonly line: S.Finite;
46
+ readonly column: S.Finite;
47
+ }>;
48
+ }>;
49
+ readonly status: S.optional<S.Literals<readonly ["Killed", "Survived", "NoCoverage", "CompileError", "RuntimeError", "Timeout", "Ignored", "Pending"]>>;
50
+ readonly statusReason: S.optional<S.String>;
51
+ readonly coveredBy: S.optional<S.$Array<S.String>>;
52
+ readonly static: S.optional<S.Boolean>;
53
+ readonly testsCompleted: S.optional<S.Finite>;
54
+ readonly description: S.optional<S.String>;
55
+ }>, {}>;
56
+ declare class Mutant extends Mutant_base {}
57
+ declare const RunOptionsFields: {
58
+ timeout: S.Finite;
59
+ disableBail: S.Boolean;
60
+ };
61
+ declare const MutantActivationSchema: S.Literals<readonly ["runtime", "static"]>;
62
+ type MutantActivation = typeof MutantActivationSchema.Type;
63
+ declare const MutantRunOptionsSchema: S.Struct<{
64
+ readonly timeout: S.Finite;
65
+ readonly disableBail: S.Boolean;
66
+ readonly activeMutant: typeof Mutant;
67
+ readonly sandboxFileName: S.String;
68
+ readonly mutantActivation: S.Literals<readonly ["runtime", "static"]>;
69
+ readonly reloadEnvironment: S.Boolean;
70
+ readonly testFilter: S.optionalKey<S.$Array<S.String>>;
71
+ readonly hitLimit: S.optionalKey<S.Finite>;
72
+ }>;
73
+ //#endregion
74
+ //#region src/Mutant.d.ts
75
+ interface MutantCoverage {
76
+ readonly perTest: Record<string, Record<string, number>>;
77
+ readonly static: Record<string, number>;
78
+ }
79
+ type CoverageData = Record<string, number>;
80
+ type CoveragePerTestId = Record<string, CoverageData>;
81
+ interface Coverage {
82
+ readonly static: CoverageData;
83
+ readonly perTest: CoveragePerTestId;
84
+ }
85
+ interface RunOptions {
86
+ readonly timeout: number;
87
+ readonly disableBail: boolean;
88
+ }
89
+ interface MutantRunOptions extends RunOptions {
90
+ readonly testFilter?: readonly string[];
91
+ readonly hitLimit?: number;
92
+ readonly activeMutant: Mutant;
93
+ readonly sandboxFileName: string;
94
+ readonly mutantActivation: MutantActivation;
95
+ readonly reloadEnvironment: boolean;
96
+ }
97
+ interface EarlyResultPlan {
98
+ readonly plan: 'EarlyResult';
99
+ readonly mutant: Mutant;
100
+ }
101
+ interface RunPlan {
102
+ readonly plan: 'Run';
103
+ readonly mutant: Mutant;
104
+ readonly runOptions: MutantRunOptions;
105
+ readonly netTime: number;
106
+ }
107
+ type TestPlan = EarlyResultPlan | RunPlan;
108
+ declare const isMutant: (value: unknown) => value is Mutant;
109
+ type MutantTestCoverage = Mutant & {
110
+ readonly coveredBy: ReadonlyArray<string> | undefined;
111
+ readonly static: boolean | undefined;
112
+ };
113
+ type RunMutantResult = Mutant & {
114
+ readonly status: MutantStatus;
115
+ readonly statusReason?: string | undefined;
116
+ readonly testsCompleted?: number | undefined;
117
+ readonly killedBy?: readonly string[] | undefined;
118
+ readonly coveredBy?: readonly string[] | undefined;
119
+ readonly static?: boolean | undefined;
120
+ };
121
+ declare const INSTRUMENTER_CONSTANTS: Readonly<{
122
+ NAMESPACE: '__stryker__';
123
+ MUTATION_COVERAGE_OBJECT: 'mutantCoverage';
124
+ ACTIVE_MUTANT: 'activeMutant';
125
+ CURRENT_TEST_ID: 'currentTestId';
126
+ HIT_COUNT: 'hitCount';
127
+ HIT_LIMIT: 'hitLimit';
128
+ ACTIVE_MUTANT_ENV_VARIABLE: '__STRYKER_ACTIVE_MUTANT__';
129
+ }>;
130
+ interface InstrumenterContext {
131
+ activeMutant?: string;
132
+ currentTestId?: string;
133
+ mutantCoverage?: MutantCoverage;
134
+ hitCount?: number;
135
+ hitLimit?: number;
136
+ }
137
+ declare function normalizeFileName(fileName: string): string;
138
+ interface ErrnoException extends Error {
139
+ code?: string;
140
+ errno?: number;
141
+ path?: string;
142
+ syscall?: string;
143
+ }
144
+ declare function isErrnoException(error: unknown): error is ErrnoException;
145
+ declare function errorToString(error: unknown): string;
146
+ declare const ERROR_CODES: Readonly<{
147
+ NoSuchFileOrDirectory: 'ENOENT';
148
+ }>;
149
+ interface MutationRange {
150
+ readonly start: Position;
151
+ readonly end: Position;
152
+ }
153
+ type MutateDescription = ReadonlyArray<MutationRange> | boolean;
154
+ interface FileDescription {
155
+ readonly mutate: MutateDescription;
156
+ }
157
+ type FileDescriptions = Record<string, FileDescription>;
158
+ type MutantRunPlan = RunPlan;
159
+ type MutantEarlyResultPlan = EarlyResultPlan;
160
+ type MutantTestPlan = TestPlan;
161
+ declare const causeText: (cause: unknown, depth: number) => string | undefined;
162
+ //#endregion
163
+ export { MutantActivationSchema as A, PositionSchema as B, causeText as C, normalizeFileName as D, isMutant as E, Location as F, LocationSchema as I, OpenEndLocation as L, MutantStatus as M, MutantStatusSchema as N, Mutant as O, RunOptionsFields as P, OpenEndLocationSchema as R, TestPlan as S, isErrnoException as T, MutateDescription as _, EarlyResultPlan as a, RunOptions as b, FileDescriptions as c, MutantCoverage as d, MutantEarlyResultPlan as f, MutantTestPlan as g, MutantTestCoverage as h, ERROR_CODES as i, MutantRunOptionsSchema as j, MutantActivation as k, INSTRUMENTER_CONSTANTS as l, MutantRunPlan as m, CoverageData as n, ErrnoException as o, MutantRunOptions as p, CoveragePerTestId as r, FileDescription as s, Coverage as t, InstrumenterContext as u, MutationRange as v, errorToString as w, RunPlan as x, RunMutantResult as y, Position as z };
@@ -0,0 +1,128 @@
1
+ import * as Predicate from "effect/Predicate";
2
+ import * as S from "effect/Schema";
3
+ import * as Match from "effect/Match";
4
+ import * as Option from "effect/Option";
5
+ //#region src/Location.schema.ts
6
+ const PositionSchema = S.Struct({
7
+ line: S.Finite,
8
+ column: S.Finite
9
+ });
10
+ const LocationSchema = S.Struct({
11
+ start: PositionSchema,
12
+ end: PositionSchema
13
+ });
14
+ const OpenEndLocationSchema = S.Struct({
15
+ start: PositionSchema,
16
+ end: S.optional(PositionSchema)
17
+ });
18
+ //#endregion
19
+ //#region src/Mutant.schema.ts
20
+ const MutantStatusSchema = S.Literals([
21
+ "Killed",
22
+ "Survived",
23
+ "NoCoverage",
24
+ "CompileError",
25
+ "RuntimeError",
26
+ "Timeout",
27
+ "Ignored",
28
+ "Pending"
29
+ ]);
30
+ var Mutant = class extends S.TaggedClass()("Mutant", {
31
+ id: S.NonEmptyString,
32
+ fileName: S.NonEmptyString,
33
+ mutatorName: S.NonEmptyString,
34
+ replacement: S.String,
35
+ location: LocationSchema,
36
+ status: S.optional(MutantStatusSchema),
37
+ statusReason: S.optional(S.String),
38
+ coveredBy: S.optional(S.Array(S.String)),
39
+ static: S.optional(S.Boolean),
40
+ testsCompleted: S.optional(S.Finite),
41
+ description: S.optional(S.String)
42
+ }) {};
43
+ const RunOptionsFields = {
44
+ timeout: S.Finite,
45
+ disableBail: S.Boolean
46
+ };
47
+ const MutantActivationSchema = S.Literals(["runtime", "static"]);
48
+ const MutantRunOptionsSchema = S.Struct({
49
+ ...RunOptionsFields,
50
+ activeMutant: Mutant,
51
+ sandboxFileName: S.String,
52
+ mutantActivation: MutantActivationSchema,
53
+ reloadEnvironment: S.Boolean,
54
+ testFilter: S.optionalKey(S.Array(S.String)),
55
+ hitLimit: S.optionalKey(S.Finite)
56
+ });
57
+ //#endregion
58
+ //#region src/Mutant.ts
59
+ const isMutant = (value) => S.is(Mutant)(value);
60
+ const INSTRUMENTER_CONSTANTS = Object.freeze({
61
+ NAMESPACE: "__stryker__",
62
+ MUTATION_COVERAGE_OBJECT: "mutantCoverage",
63
+ ACTIVE_MUTANT: "activeMutant",
64
+ CURRENT_TEST_ID: "currentTestId",
65
+ HIT_COUNT: "hitCount",
66
+ HIT_LIMIT: "hitLimit",
67
+ ACTIVE_MUTANT_ENV_VARIABLE: "__STRYKER_ACTIVE_MUTANT__"
68
+ });
69
+ function normalizeFileName(fileName) {
70
+ return fileName.replace(/\\/g, "/");
71
+ }
72
+ const hasText = (value) => Predicate.isString(value) && value.length > 0;
73
+ const textIfNonEmpty = (value) => Option.getOrUndefined(Option.filter(Option.fromUndefinedOr(value), hasText));
74
+ const fieldOf = (value, key) => Match.value(key in value).pipe(Match.when(true, () => {
75
+ return Reflect.get(value, key);
76
+ }), Match.orElse(() => void 0));
77
+ const hasStringCode = (error) => Match.value(fieldOf(error, "code")).pipe(Match.when(Match.string, () => true), Match.orElse(() => false));
78
+ function isErrnoException(error) {
79
+ return Match.value(error).pipe(Match.when(Match.instanceOf(Error), hasStringCode), Match.orElse(() => false));
80
+ }
81
+ const isEmptyNumber = (value) => Match.value(value).pipe(Match.when(0, () => true), Match.orElse(Number.isNaN));
82
+ const isEmptyError = (error) => Match.value(error).pipe(Match.when(Match.undefined, () => true), Match.when(Match.null, () => true), Match.when(Match.string, (text) => text.length === 0), Match.when(Match.number, isEmptyNumber), Match.when(Match.boolean, (value) => !value), Match.orElse(() => false));
83
+ const formatErrnoException = (error) => Match.value(error.stack).pipe(Match.when(hasText, (stack) => `${error.name}: ${error.code} (${error.syscall}) ${stack}`), Match.orElse(() => `${error.name}: ${error.code} (${error.syscall})`));
84
+ const formatError = (error) => Match.value(error.stack).pipe(Match.when(hasText, (stack) => `${error.name}: ${error.message}\n${stack}`), Match.orElse(() => `${error.name}: ${error.message}`));
85
+ const isJsonPrimitive = (value) => Match.value(value).pipe(Match.when(Match.number, () => true), Match.when(Match.boolean, () => true), Match.when(Match.bigint, () => true), Match.orElse(() => false));
86
+ const jsonText = (error) => {
87
+ try {
88
+ return textIfNonEmpty(JSON.stringify(error));
89
+ } catch {
90
+ return;
91
+ }
92
+ };
93
+ const isNonPlaceholderText = (text) => Match.value({
94
+ hasLength: text.length > 0,
95
+ isPlaceholder: text === "[object Object]"
96
+ }).pipe(Match.when({
97
+ hasLength: true,
98
+ isPlaceholder: false
99
+ }, () => true), Match.orElse(() => false));
100
+ const isUsableText = (value) => Match.value(value).pipe(Match.when(Match.string, isNonPlaceholderText), Match.orElse(() => false));
101
+ const usableText = (value) => Match.value(value).pipe(Match.when(isUsableText, (text) => text), Match.orElse(() => ""));
102
+ const objectToStringText = (value) => Match.value(fieldOf(value, "toString")).pipe(Match.when(Match.instanceOf(Function), (callable) => {
103
+ try {
104
+ return usableText(Reflect.apply(callable, value, []));
105
+ } catch {
106
+ return "";
107
+ }
108
+ }), Match.orElse(() => ""));
109
+ const isObjectType = (cause) => typeof cause === "object";
110
+ const toStringText = (error) => Match.value(error).pipe(Match.when(Match.null, () => ""), Match.when(isObjectType, (value) => objectToStringText(value)), Match.orElse(() => ""));
111
+ const stringifyRest = (error) => Match.value(jsonText(error)).pipe(Match.when(hasText, (json) => json), Match.orElse(() => toStringText(error)));
112
+ const stringifyNonError = (error) => Match.value(error).pipe(Match.when(Match.string, (text) => text), Match.when(isJsonPrimitive, (primitive) => JSON.stringify(primitive)), Match.orElse(() => stringifyRest(error)));
113
+ const errorText = (error) => Match.value(error).pipe(Match.when(isErrnoException, formatErrnoException), Match.orElse(() => formatError(error)));
114
+ function errorToString(error) {
115
+ return Match.value(error).pipe(Match.when(isEmptyError, () => ""), Match.when(Match.instanceOf(Error), errorText), Match.orElse(() => stringifyNonError(error)));
116
+ }
117
+ const ERROR_CODES = Object.freeze({ NoSuchFileOrDirectory: "ENOENT" });
118
+ const errorNameOf = (value) => Match.value(value).pipe(Match.when(Match.instanceOf(Error), (error) => textIfNonEmpty(error.name)), Match.orElse(() => void 0));
119
+ const tagOf = (value) => Match.value(textIfNonEmpty(fieldOf(value, "_tag"))).pipe(Match.when(hasText, (tag) => tag), Match.orElse(() => errorNameOf(value)));
120
+ const textWithNested = (own, nested) => Match.value(own).pipe(Match.when(hasText, (text) => appendNested(text, nested)), Match.orElse(() => nested));
121
+ const appendNested = (own, nested) => Match.value(nested).pipe(Match.when(hasText, (text) => `${own}: ${text}`), Match.orElse(() => own));
122
+ const errorMessage = (error) => Match.value(error.message.length > 0).pipe(Match.when(true, () => error.message), Match.orElse(() => tagOf(error)));
123
+ const errorMessageOrTag = (value) => Match.value(value).pipe(Match.when(Match.instanceOf(Error), errorMessage), Match.orElse(() => tagOf(value)));
124
+ const messageText = (value) => Match.value(textIfNonEmpty(fieldOf(value, "message"))).pipe(Match.when(hasText, (message) => message), Match.orElse(() => errorMessageOrTag(value)));
125
+ const ownCauseText = (value) => Match.value(textIfNonEmpty(fieldOf(value, "reason"))).pipe(Match.when(hasText, (reason) => reason), Match.orElse(() => messageText(value)));
126
+ const causeText = (cause, depth) => Match.value(cause).pipe(Match.when(() => depth > 4, () => void 0), Match.when(Match.undefined, () => void 0), Match.when(Match.null, () => void 0), Match.when(Match.string, textIfNonEmpty), Match.when(isObjectType, (value) => textWithNested(ownCauseText(value), causeText(fieldOf(value, "cause"), depth + 1))), Match.orElse(() => void 0));
127
+ //#endregion
128
+ export { isErrnoException as a, Mutant as c, MutantStatusSchema as d, RunOptionsFields as f, PositionSchema as h, errorToString as i, MutantActivationSchema as l, OpenEndLocationSchema as m, INSTRUMENTER_CONSTANTS as n, isMutant as o, LocationSchema as p, causeText as r, normalizeFileName as s, ERROR_CODES as t, MutantRunOptionsSchema as u };
package/dist/index.d.mts CHANGED
@@ -1,22 +1,73 @@
1
1
  import * as Effect from 'effect/Effect';
2
- import { FileDescription } from '@systemfsoftware/stryker-js-language';
3
- import { Mutant } from '@systemfsoftware/stryker-js-language';
4
2
  import * as S from 'effect/Schema';
5
3
  import { YieldableError } from 'effect/Cause';
6
4
 
5
+ export declare const causeText: (cause: unknown, depth: number) => string | undefined;
6
+
7
+ export declare interface Coverage {
8
+ readonly static: CoverageData;
9
+ readonly perTest: CoveragePerTestId;
10
+ }
11
+
12
+ export declare type CoverageData = Record<string, number>;
13
+
14
+ export declare type CoveragePerTestId = Record<string, CoverageData>;
15
+
7
16
  export declare const disableTypeChecks: (file: File_2) => Effect.Effect<File_2, InstrumentError>;
8
17
 
18
+ export declare interface EarlyResultPlan {
19
+ readonly plan: 'EarlyResult';
20
+ readonly mutant: Mutant;
21
+ }
22
+
23
+ export declare interface ErrnoException extends Error {
24
+ code?: string;
25
+ errno?: number;
26
+ path?: string;
27
+ syscall?: string;
28
+ }
29
+
30
+ export declare const ERROR_CODES: Readonly<{
31
+ NoSuchFileOrDirectory: 'ENOENT';
32
+ }>;
33
+
34
+ export declare function errorToString(error: unknown): string;
35
+
9
36
  declare interface File_2 extends FileDescription {
10
37
  name: string;
11
38
  content: string;
12
39
  }
13
40
  export { File_2 as File }
14
41
 
15
- export declare const instrument: (files: readonly File_2[], options: InstrumenterOptions, basePath?: string) => Effect.Effect<InstrumentResult$1, InstrumentError>;
42
+ export declare interface FileDescription {
43
+ readonly mutate: MutateDescription;
44
+ }
45
+
46
+ export declare type FileDescriptions = Record<string, FileDescription>;
47
+
48
+ export declare const instrument: (files: readonly File_2[], options: InstrumenterOptions, basePath?: string) => Effect.Effect<InstrumentResult, InstrumentError>;
49
+
50
+ export declare const INSTRUMENTER_CONSTANTS: Readonly<{
51
+ NAMESPACE: '__stryker__';
52
+ MUTATION_COVERAGE_OBJECT: 'mutantCoverage';
53
+ ACTIVE_MUTANT: 'activeMutant';
54
+ CURRENT_TEST_ID: 'currentTestId';
55
+ HIT_COUNT: 'hitCount';
56
+ HIT_LIMIT: 'hitLimit';
57
+ ACTIVE_MUTANT_ENV_VARIABLE: '__STRYKER_ACTIVE_MUTANT__';
58
+ }>;
59
+
60
+ export declare interface InstrumenterContext {
61
+ activeMutant?: string;
62
+ currentTestId?: string;
63
+ mutantCoverage?: MutantCoverage;
64
+ hitCount?: number;
65
+ hitLimit?: number;
66
+ }
16
67
 
17
68
  export declare type InstrumenterOptions = typeof InstrumenterOptionsSchema.Type;
18
69
 
19
- declare const InstrumenterOptionsSchema: S.Struct<{
70
+ export declare const InstrumenterOptionsSchema: S.Struct<{
20
71
  readonly excludedMutations: S.$Array<S.String>;
21
72
  readonly ignorers: S.$Array<S.Unknown>;
22
73
  readonly noHeader: S.optional<S.Boolean>;
@@ -31,31 +82,154 @@ declare const InstrumentError_base: S.Class<InstrumentError, S.TaggedStruct<"Ins
31
82
  readonly cause: S.Defect;
32
83
  }>, YieldableError>;
33
84
 
34
- declare class InstrumentResult$1 extends InstrumentResult_base {}
35
-
36
85
  export declare interface InstrumentResult {
37
86
  files: readonly File_2[];
38
87
  mutants: readonly Mutant[];
39
88
  }
40
89
 
41
- declare const InstrumentResult_base: S.Class<InstrumentResult$1, S.TaggedStruct<"InstrumentResult", {
42
- readonly files: S.$Array<S.Struct<{
43
- readonly name: S.String;
44
- readonly content: S.String;
45
- readonly mutate: S.Union<readonly [S.Boolean, S.$Array<S.Struct<{
46
- readonly start: S.Struct<{
47
- readonly line: S.Finite;
48
- readonly column: S.Finite;
49
- }>;
50
- readonly end: S.Struct<{
51
- readonly line: S.Finite;
52
- readonly column: S.Finite;
53
- }>;
54
- }>>]>;
55
- }>>;
56
- readonly mutants: S.$Array<typeof Mutant>;
90
+ export declare function isErrnoException(error: unknown): error is ErrnoException;
91
+
92
+ export declare const isMutant: (value: unknown) => value is Mutant;
93
+
94
+ export declare type Location = typeof LocationSchema.Type;
95
+
96
+ export declare const LocationSchema: S.Struct<{
97
+ readonly start: S.Struct<{
98
+ readonly line: S.Finite;
99
+ readonly column: S.Finite;
100
+ }>;
101
+ readonly end: S.Struct<{
102
+ readonly line: S.Finite;
103
+ readonly column: S.Finite;
104
+ }>;
105
+ }>;
106
+
107
+ export declare class Mutant extends Mutant_base {}
108
+
109
+ declare const Mutant_base: S.Class<Mutant, S.TaggedStruct<"Mutant", {
110
+ readonly id: S.NonEmptyString;
111
+ readonly fileName: S.NonEmptyString;
112
+ readonly mutatorName: S.NonEmptyString;
113
+ readonly replacement: S.String;
114
+ readonly location: S.Struct<{
115
+ readonly start: S.Struct<{
116
+ readonly line: S.Finite;
117
+ readonly column: S.Finite;
118
+ }>;
119
+ readonly end: S.Struct<{
120
+ readonly line: S.Finite;
121
+ readonly column: S.Finite;
122
+ }>;
123
+ }>;
124
+ readonly status: S.optional<S.Literals<readonly ["Killed", "Survived", "NoCoverage", "CompileError", "RuntimeError", "Timeout", "Ignored", "Pending"]>>;
125
+ readonly statusReason: S.optional<S.String>;
126
+ readonly coveredBy: S.optional<S.$Array<S.String>>;
127
+ readonly static: S.optional<S.Boolean>;
128
+ readonly testsCompleted: S.optional<S.Finite>;
129
+ readonly description: S.optional<S.String>;
57
130
  }>, {}>;
58
131
 
132
+ export declare type MutantActivation = typeof MutantActivationSchema.Type;
133
+
134
+ export declare const MutantActivationSchema: S.Literals<readonly ["runtime", "static"]>;
135
+
136
+ export declare interface MutantCoverage {
137
+ readonly perTest: Record<string, Record<string, number>>;
138
+ readonly static: Record<string, number>;
139
+ }
140
+
141
+ export declare type MutantEarlyResultPlan = EarlyResultPlan;
142
+
143
+ export declare interface MutantRunOptions extends RunOptions {
144
+ readonly testFilter?: readonly string[];
145
+ readonly hitLimit?: number;
146
+ readonly activeMutant: Mutant;
147
+ readonly sandboxFileName: string;
148
+ readonly mutantActivation: MutantActivation;
149
+ readonly reloadEnvironment: boolean;
150
+ }
151
+
152
+ export declare const MutantRunOptionsSchema: S.Struct<{
153
+ readonly timeout: S.Finite;
154
+ readonly disableBail: S.Boolean;
155
+ readonly activeMutant: typeof Mutant;
156
+ readonly sandboxFileName: S.String;
157
+ readonly mutantActivation: S.Literals<readonly ["runtime", "static"]>;
158
+ readonly reloadEnvironment: S.Boolean;
159
+ readonly testFilter: S.optionalKey<S.$Array<S.String>>;
160
+ readonly hitLimit: S.optionalKey<S.Finite>;
161
+ }>;
162
+
163
+ export declare type MutantRunPlan = RunPlan;
164
+
165
+ export declare type MutantStatus = typeof MutantStatusSchema.Type;
166
+
167
+ export declare const MutantStatusSchema: S.Literals<readonly ["Killed", "Survived", "NoCoverage", "CompileError", "RuntimeError", "Timeout", "Ignored", "Pending"]>;
168
+
169
+ export declare type MutantTestCoverage = Mutant & {
170
+ readonly coveredBy: ReadonlyArray<string> | undefined;
171
+ readonly static: boolean | undefined;
172
+ };
173
+
174
+ export declare type MutantTestPlan = TestPlan;
175
+
176
+ export declare type MutateDescription = ReadonlyArray<MutationRange> | boolean;
177
+
178
+ export declare interface MutationRange {
179
+ readonly start: Position;
180
+ readonly end: Position;
181
+ }
182
+
183
+ export declare function normalizeFileName(fileName: string): string;
184
+
185
+ export declare type OpenEndLocation = typeof OpenEndLocationSchema.Type;
186
+
187
+ export declare const OpenEndLocationSchema: S.Struct<{
188
+ readonly start: S.Struct<{
189
+ readonly line: S.Finite;
190
+ readonly column: S.Finite;
191
+ }>;
192
+ readonly end: S.optional<S.Struct<{
193
+ readonly line: S.Finite;
194
+ readonly column: S.Finite;
195
+ }>>;
196
+ }>;
197
+
59
198
  export declare interface ParserOptions {}
60
199
 
200
+ export declare type Position = typeof PositionSchema.Type;
201
+
202
+ export declare const PositionSchema: S.Struct<{
203
+ readonly line: S.Finite;
204
+ readonly column: S.Finite;
205
+ }>;
206
+
207
+ export declare type RunMutantResult = Mutant & {
208
+ readonly status: MutantStatus;
209
+ readonly statusReason?: string | undefined;
210
+ readonly testsCompleted?: number | undefined;
211
+ readonly killedBy?: readonly string[] | undefined;
212
+ readonly coveredBy?: readonly string[] | undefined;
213
+ readonly static?: boolean | undefined;
214
+ };
215
+
216
+ export declare interface RunOptions {
217
+ readonly timeout: number;
218
+ readonly disableBail: boolean;
219
+ }
220
+
221
+ export declare const RunOptionsFields: {
222
+ timeout: S.Finite;
223
+ disableBail: S.Boolean;
224
+ };
225
+
226
+ export declare interface RunPlan {
227
+ readonly plan: 'Run';
228
+ readonly mutant: Mutant;
229
+ readonly runOptions: MutantRunOptions;
230
+ readonly netTime: number;
231
+ }
232
+
233
+ export declare type TestPlan = EarlyResultPlan | RunPlan;
234
+
61
235
  export { }
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { INSTRUMENTER_CONSTANTS, Mutant } from "@systemfsoftware/stryker-js-language";
1
+ import { a as isErrnoException, c as Mutant, d as MutantStatusSchema, f as RunOptionsFields, h as PositionSchema, i as errorToString, l as MutantActivationSchema, m as OpenEndLocationSchema, n as INSTRUMENTER_CONSTANTS, o as isMutant, p as LocationSchema, r as causeText, s as normalizeFileName, t as ERROR_CODES, u as MutantRunOptionsSchema } from "./Mutant-DnhV_fpo.mjs";
2
2
  import * as Effect from "effect/Effect";
3
3
  import * as Predicate from "effect/Predicate";
4
4
  import * as S from "effect/Schema";
@@ -18,13 +18,13 @@ var InstrumentError = class extends S.TaggedError("@systemfsoftware/stryker-js-i
18
18
  return this.message;
19
19
  }
20
20
  };
21
- const PositionSchema = S.Struct({
21
+ const PositionSchema$1 = S.Struct({
22
22
  line: S.Finite,
23
23
  column: S.Finite
24
24
  });
25
25
  const RangeSchema = S.Struct({
26
- start: PositionSchema,
27
- end: PositionSchema
26
+ start: PositionSchema$1,
27
+ end: PositionSchema$1
28
28
  });
29
29
  const MutateDescriptionSchema = S.Union([S.Boolean, S.Array(RangeSchema)]);
30
30
  const FileSchema = S.Struct({
@@ -33,7 +33,7 @@ const FileSchema = S.Struct({
33
33
  mutate: MutateDescriptionSchema
34
34
  });
35
35
  const IgnorerSchema = S.Unknown;
36
- S.Struct({
36
+ const InstrumenterOptionsSchema = S.Struct({
37
37
  excludedMutations: S.Array(S.String),
38
38
  ignorers: S.Array(IgnorerSchema),
39
39
  noHeader: S.optional(S.Boolean)
@@ -52,6 +52,9 @@ S.Literals([
52
52
  //#endregion
53
53
  //#region src/Syntax.ts
54
54
  /**
55
+ * Syntax — the instrumenter's AST shapes, location helpers and syntax utilities.
56
+ */
57
+ /**
55
58
  * Determines if a location (needle) is included in an other location (haystack)
56
59
  * @param haystack The range to look in
57
60
  * @param needle the range to search for
@@ -5126,4 +5129,4 @@ const instrument = (files, options, basePath) => Effect.gen(function* () {
5126
5129
  });
5127
5130
  });
5128
5131
  //#endregion
5129
- export { disableTypeChecks, instrument };
5132
+ export { ERROR_CODES, INSTRUMENTER_CONSTANTS, InstrumenterOptionsSchema, LocationSchema, Mutant, MutantActivationSchema, MutantRunOptionsSchema, MutantStatusSchema, OpenEndLocationSchema, PositionSchema, RunOptionsFields, causeText, disableTypeChecks, errorToString, instrument, isErrnoException, isMutant, normalizeFileName };
@@ -0,0 +1,2 @@
1
+ import { A as MutantActivationSchema, B as PositionSchema, C as causeText, D as normalizeFileName, E as isMutant, F as Location, I as LocationSchema, L as OpenEndLocation, M as MutantStatus, N as MutantStatusSchema, O as Mutant, P as RunOptionsFields, R as OpenEndLocationSchema, S as TestPlan, T as isErrnoException, _ as MutateDescription, a as EarlyResultPlan, b as RunOptions, c as FileDescriptions, d as MutantCoverage, f as MutantEarlyResultPlan, g as MutantTestPlan, h as MutantTestCoverage, i as ERROR_CODES, j as MutantRunOptionsSchema, k as MutantActivation, l as INSTRUMENTER_CONSTANTS, m as MutantRunPlan, n as CoverageData, o as ErrnoException, p as MutantRunOptions, r as CoveragePerTestId, s as FileDescription, t as Coverage, u as InstrumenterContext, v as MutationRange, w as errorToString, x as RunPlan, y as RunMutantResult, z as Position } from "./Mutant-BYxuyyRL.mjs";
2
+ export { type Coverage, type CoverageData, type CoveragePerTestId, ERROR_CODES, type EarlyResultPlan, type ErrnoException, type FileDescription, type FileDescriptions, INSTRUMENTER_CONSTANTS, type InstrumenterContext, type Location, LocationSchema, Mutant, type MutantActivation, MutantActivationSchema, type MutantCoverage, type MutantEarlyResultPlan, type MutantRunOptions, MutantRunOptionsSchema, type MutantRunPlan, type MutantStatus, MutantStatusSchema, type MutantTestCoverage, type MutantTestPlan, type MutateDescription, type MutationRange, type OpenEndLocation, OpenEndLocationSchema, type Position, PositionSchema, type RunMutantResult, type RunOptions, RunOptionsFields, type RunPlan, type TestPlan, causeText, errorToString, isErrnoException, isMutant, normalizeFileName };
@@ -0,0 +1,2 @@
1
+ import { a as isErrnoException, c as Mutant, d as MutantStatusSchema, f as RunOptionsFields, h as PositionSchema, i as errorToString, l as MutantActivationSchema, m as OpenEndLocationSchema, n as INSTRUMENTER_CONSTANTS, o as isMutant, p as LocationSchema, r as causeText, s as normalizeFileName, t as ERROR_CODES, u as MutantRunOptionsSchema } from "./Mutant-DnhV_fpo.mjs";
2
+ export { ERROR_CODES, INSTRUMENTER_CONSTANTS, LocationSchema, Mutant, MutantActivationSchema, MutantRunOptionsSchema, MutantStatusSchema, OpenEndLocationSchema, PositionSchema, RunOptionsFields, causeText, errorToString, isErrnoException, isMutant, normalizeFileName };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@systemfsoftware/stryker-js-instrumenter",
3
- "version": "7.0.0",
3
+ "version": "7.1.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/systemfsoftware/stryker-js-effect.git",
@@ -18,6 +18,10 @@
18
18
  "types": "./dist/index.d.mts",
19
19
  "default": "./dist/index.mjs"
20
20
  },
21
+ "./mutants": {
22
+ "types": "./dist/mutants.d.mts",
23
+ "default": "./dist/mutants.mjs"
24
+ },
21
25
  "./package.json": "./package.json"
22
26
  },
23
27
  "license": "Apache-2.0",
@@ -28,8 +32,7 @@
28
32
  "angular-html-parser": "~10.4.0",
29
33
  "effect": "4.0.0-rc.112",
30
34
  "oxc-parser": "^0.140.0",
31
- "oxc-walker": "^1",
32
- "@systemfsoftware/stryker-js-language": "^5.0.0"
35
+ "oxc-walker": "^1"
33
36
  },
34
37
  "devDependencies": {
35
38
  "@effect/tsgo": "^0.45.0",
@@ -45,9 +48,9 @@
45
48
  "tsdown": "^0.23.0",
46
49
  "typescript": "^7",
47
50
  "vitest": "^4",
48
- "@systemfsoftware/vitest-config": "^0.1.0",
49
51
  "@systemfsoftware/tsdown-config": "^0.1.0",
50
- "@systemfsoftware/stryker-ignorer-interface": "^0.1.0"
52
+ "@systemfsoftware/stryker-ignorer-interface": "^0.1.0",
53
+ "@systemfsoftware/vitest-config": "^0.1.0"
51
54
  },
52
55
  "engines": {
53
56
  "node": ">=20.0.0"