@systemfsoftware/stryker-js-instrumenter 1.0.0 → 2.0.1

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,60 @@
1
1
  # @systemfsoftware/stryker-js-instrumenter
2
2
 
3
+ ## 2.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Peer Effect requirement advances to 4.0.0-rc.112. No API changes.
8
+
9
+ ## 2.0.0
10
+
11
+ ### Major Changes
12
+
13
+ - Three packages are renamed. `plugin-api` is now `@systemfsoftware/stryker-js`, the
14
+ language every plugin is written against. `mutation-run` is now
15
+ `@systemfsoftware/stryker-js-platform-node`, the Node host that runs a mutation
16
+ test. `mutation-report` is now `@systemfsoftware/stryker-js-html-reporter`.
17
+ Install the new names and change your imports.
18
+
19
+ Options types moved. `StrykerOptions`, `PartialStrykerOptions` and `LogLevel` are
20
+ imported from the `Schema` export; `Mutant`, `MutantStatus`, `Position` and
21
+ `Location` from the `Mutant` export. Point a config's `extends` at the language
22
+ package's `Schema` export.
23
+
24
+ `MutantStatus` accepts one spelling per outcome: `Killed`, `Survived`,
25
+ `NoCoverage`, `Timeout`, `CompileError`, `RuntimeError`, `Ignored` and `Pending`.
26
+ The lowercase and abbreviated forms — `killed`, `timedOut`, `noCoverage` and the
27
+ rest — are gone. A comparison against a removed spelling never matched the value
28
+ the reporter actually produced, so check any status comparison you wrote.
29
+
30
+ Statuses, plugin kinds, exit classes and AST formats are string literal unions
31
+ rather than enums, so read them as their string values. Member access such as
32
+ `ExitClass.VerdictFail` no longer resolves.
33
+
34
+ A plugin no longer receives a logger, and the logger port is gone. Plugins log
35
+ through Effect, and the host decides where that output goes.
36
+
37
+ The bundled base preset is gone. A config inherits from the language package's
38
+ `Schema` export and states the thresholds, reporters and plugins it wants; you no
39
+ longer silently inherit a package manager, a plugin list or a break threshold.
40
+
41
+ ### Patch Changes
42
+
43
+ - Selecting `workflow-make-boundary` keeps mutants inside `Workflow.make` decision bodies.
44
+
45
+ Ignore plugins are asked about each mutant, not about the file root with a subtree latch. An inverted selector that answers "ignore" for everything outside a make body therefore no longer ignores the make body itself. Inner mutants of declaration-style ignore plugins (`effect-schema-declarations`, Angular signal option objects) are still ignored.
46
+
47
+ - Instrumenting a file that calls a method named after an `Object.prototype`
48
+ member - `toString`, `valueOf`, `constructor` and the rest - no longer fails
49
+ with `Property name expected type of string but got function`. The method
50
+ mutator's replacement table answered such a lookup with the inherited function
51
+ rather than reporting no replacement, and a single `.toString()` call was enough
52
+ to stop the run. Those methods are now left alone, as they always should have
53
+ been.
54
+
55
+ - Updated dependencies:
56
+ - @systemfsoftware/effect-cell-types@5.0.0
57
+
3
58
  ## 1.0.0
4
59
 
5
60
  ### Major Changes
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @systemfsoftware/stryker-js-instrumenter
2
2
 
3
- A source-code fork of the upstream StrykerJS instrumenter package, pinned at 9.6.1.
3
+ Parses source files, applies their configured mutators, and produces the mutant set for a mutation run.
4
4
 
5
5
  ## Install
6
6
 
@@ -16,10 +16,6 @@ pnpm add @systemfsoftware/stryker-js-instrumenter
16
16
 
17
17
  The instrumenter is used internally by the Stryker mutation testing framework to instrument source files with mutant coverage and switching logic.
18
18
 
19
- ## API
20
-
21
- The public surface is generated from the source and versioned with the package: [`etc/stryker-js-instrumenter.api.md`](./etc/stryker-js-instrumenter.api.md).
22
-
23
19
  ## License
24
20
 
25
21
  Apache-2.0. Part of [systemfsoftware](https://github.com/systemfsoftware/systemfsoftware/tree/main/packages/testing/mutation/stryker-js/instrumenter#readme).
package/dist/index.d.mts CHANGED
@@ -1,70 +1,85 @@
1
- import { FileDescription, Mutant } from "@systemfsoftware/stryker-js-plugin-api/core";
1
+ import babel, { File as File$1, types } from "@babel/core";
2
+ import { Wire, Workflow } from "@systemfsoftware/effect-cell-types";
3
+ import { FileDescription, Mutant } from "@systemfsoftware/stryker-js/Mutant";
4
+ import * as Effect from "effect/Effect";
5
+ import "effect/Result";
2
6
  import * as S from "effect/Schema";
3
- import { types } from "@babel/core";
7
+ import { IgnorerService } from "@systemfsoftware/stryker-js/Ignorer";
4
8
  import "effect/Option";
5
- import { IgnorerService } from "@systemfsoftware/stryker-js-plugin-api/ignore";
6
- import * as Effect from "effect/Effect";
7
- //#region src/file.d.ts
8
- interface File extends FileDescription {
9
- name: string;
10
- content: string;
9
+ //#region src/Instrument.workflow.d.ts
10
+ declare const InstrumentError_base: S.Class<InstrumentError, S.TaggedStruct<"InstrumentError", {
11
+ readonly message: S.String;
12
+ readonly cause: S.Defect;
13
+ }>, import("effect/Cause").YieldableError>;
14
+ declare class InstrumentError extends InstrumentError_base {
15
+ get message(): string;
11
16
  }
17
+ declare const InstrumenterOptionsSchema: S.Struct<{
18
+ plugins: S.NullOr<S.$Array<S.Unknown & Wire.Mark> & Wire.Mark> & Wire.Mark;
19
+ excludedMutations: S.$Array<S.String & Wire.Mark> & Wire.Mark;
20
+ ignorers: S.$Array<S.Unknown & Wire.Mark> & Wire.Mark;
21
+ noHeader: S.optional<S.Boolean & Wire.Mark> & Wire.Mark;
22
+ }> & Wire.Mark;
23
+ type InstrumenterOptions = typeof InstrumenterOptionsSchema.Type;
24
+ declare const InstrumentResult_base: S.Class<InstrumentResult$1, S.TaggedStruct<"InstrumentResult", {
25
+ readonly files: S.$Array<S.Struct<{
26
+ readonly name: S.String;
27
+ readonly content: S.String;
28
+ readonly mutate: S.Union<readonly [S.Boolean, S.$Array<S.Struct<{
29
+ readonly start: S.Struct<{
30
+ readonly line: S.Finite;
31
+ readonly column: S.Finite;
32
+ }>;
33
+ readonly end: S.Struct<{
34
+ readonly line: S.Finite;
35
+ readonly column: S.Finite;
36
+ }>;
37
+ }>>]>;
38
+ }>>;
39
+ readonly mutants: S.$Array<typeof Mutant>;
40
+ }>, {}>;
41
+ declare class InstrumentResult$1 extends InstrumentResult_base {}
12
42
  //#endregion
13
- //#region src/parsers/parser-options.d.ts
43
+ //#region src/Parser.d.ts
14
44
  interface ParserOptions {
15
- plugins: unknown[] | null;
45
+ plugins: readonly unknown[] | null;
16
46
  }
17
47
  //#endregion
18
- //#region src/disable-type-checks.d.ts
19
- /**
20
- * Disables TypeScript type checking for a single file by inserting `// @ts-nocheck` commands.
21
- * It also does this for *.js files, as they can be type checked by typescript as well.
22
- * Other file types are silently ignored
23
- *
24
- * @see https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html#-ts-nocheck-in-typescript-files
25
- */
26
- declare function disableTypeChecks(file: File, options: ParserOptions): Promise<File>;
27
- //#endregion
28
- //#region src/frameworks/angular-ignorer.d.ts
29
- declare const angularIgnorer: IgnorerService;
30
- //#endregion
31
- //#region src/frameworks/index.d.ts
32
- declare const strykerPlugins: readonly unknown[];
33
- declare const frameworkPluginsFileUrl: string;
34
- //#endregion
35
- //#region src/instrument-result.d.ts
48
+ //#region src/Instrument.d.ts
49
+ interface File extends FileDescription {
50
+ name: string;
51
+ content: string;
52
+ }
36
53
  interface InstrumentResult {
37
54
  files: readonly File[];
38
55
  mutants: readonly Mutant[];
39
56
  }
57
+ declare function disableTypeChecks(file: File, options: ParserOptions): Promise<File>;
58
+ declare const instrument: (files: readonly File[], options: InstrumenterOptions) => Effect.Effect<InstrumentResult$1, InstrumentError>;
40
59
  //#endregion
41
- //#region src/mutators/mutator-options.d.ts
42
- interface MutatorOptions {
43
- excludedMutations: string[];
44
- noHeader?: boolean;
45
- }
46
- //#endregion
47
- //#region src/transformers/transformer-options.d.ts
48
- interface TransformerOptions extends MutatorOptions {
49
- ignorers: IgnorerService[];
50
- }
51
- //#endregion
52
- //#region src/instrumenter-options.d.ts
53
- interface InstrumenterOptions extends ParserOptions, TransformerOptions {}
54
- //#endregion
55
- //#region src/instrument-error.schema.d.ts
56
- declare const InstrumentError_base: S.Class<InstrumentError, S.TaggedStruct<"InstrumentError", {
57
- readonly message: S.String;
58
- readonly cause: S.Defect;
59
- }>, import("effect/Cause").YieldableError>;
60
- declare class InstrumentError extends InstrumentError_base {
61
- get message(): string;
60
+ //#region src/Transformer.d.ts
61
+ /**
62
+ * `@babel/core` exports its `File` class at runtime, but `@types/babel__core`
63
+ * omits it. The declaration lives in this module rather than an ambient
64
+ * `.d.ts` so it travels with the sources: a consumer that compiles this
65
+ * package from source (the workspace's `@systemfsoftware/source` condition,
66
+ * and api-extractor with it) reaches the augmentation through the import
67
+ * graph, which an unreferenced ambient file never joins.
68
+ */
69
+ declare module '@babel/core' {
70
+ class File {
71
+ constructor(options: {
72
+ filename?: string;
73
+ }, input: {
74
+ code: string;
75
+ ast: types.File;
76
+ inputMap?: unknown;
77
+ });
78
+ ast: types.File;
79
+ }
62
80
  }
81
+ declare const angularIgnorer: IgnorerService;
82
+ declare const strykerPlugins: readonly unknown[];
83
+ declare const frameworkPluginsFileUrl: string;
63
84
  //#endregion
64
- //#region src/instrumenter.d.ts
65
- declare const instrument: (files: readonly File[], options: InstrumenterOptions) => Effect.Effect<{
66
- files: File[];
67
- mutants: import("@systemfsoftware/stryker-js-plugin-api/core").Mutant[];
68
- }, InstrumentError, never>;
69
- //#endregion
70
- export { File, InstrumentResult, InstrumenterOptions, type ParserOptions, angularIgnorer, disableTypeChecks, frameworkPluginsFileUrl, instrument, strykerPlugins };
85
+ export { type File, type InstrumentResult, type InstrumenterOptions, type ParserOptions, angularIgnorer, disableTypeChecks, frameworkPluginsFileUrl, instrument, strykerPlugins };