@systemfsoftware/stryker-js-instrumenter 1.0.0 → 2.0.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 +49 -0
- package/README.md +1 -5
- package/dist/index.d.mts +71 -56
- package/dist/index.mjs +1445 -1390
- package/package.json +8 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,54 @@
|
|
|
1
1
|
# @systemfsoftware/stryker-js-instrumenter
|
|
2
2
|
|
|
3
|
+
## 2.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- Three packages are renamed. `plugin-api` is now `@systemfsoftware/stryker-js`, the
|
|
8
|
+
language every plugin is written against. `mutation-run` is now
|
|
9
|
+
`@systemfsoftware/stryker-js-platform-node`, the Node host that runs a mutation
|
|
10
|
+
test. `mutation-report` is now `@systemfsoftware/stryker-js-html-reporter`.
|
|
11
|
+
Install the new names and change your imports.
|
|
12
|
+
|
|
13
|
+
Options types moved. `StrykerOptions`, `PartialStrykerOptions` and `LogLevel` are
|
|
14
|
+
imported from the `Schema` export; `Mutant`, `MutantStatus`, `Position` and
|
|
15
|
+
`Location` from the `Mutant` export. Point a config's `extends` at the language
|
|
16
|
+
package's `Schema` export.
|
|
17
|
+
|
|
18
|
+
`MutantStatus` accepts one spelling per outcome: `Killed`, `Survived`,
|
|
19
|
+
`NoCoverage`, `Timeout`, `CompileError`, `RuntimeError`, `Ignored` and `Pending`.
|
|
20
|
+
The lowercase and abbreviated forms — `killed`, `timedOut`, `noCoverage` and the
|
|
21
|
+
rest — are gone. A comparison against a removed spelling never matched the value
|
|
22
|
+
the reporter actually produced, so check any status comparison you wrote.
|
|
23
|
+
|
|
24
|
+
Statuses, plugin kinds, exit classes and AST formats are string literal unions
|
|
25
|
+
rather than enums, so read them as their string values. Member access such as
|
|
26
|
+
`ExitClass.VerdictFail` no longer resolves.
|
|
27
|
+
|
|
28
|
+
A plugin no longer receives a logger, and the logger port is gone. Plugins log
|
|
29
|
+
through Effect, and the host decides where that output goes.
|
|
30
|
+
|
|
31
|
+
The bundled base preset is gone. A config inherits from the language package's
|
|
32
|
+
`Schema` export and states the thresholds, reporters and plugins it wants; you no
|
|
33
|
+
longer silently inherit a package manager, a plugin list or a break threshold.
|
|
34
|
+
|
|
35
|
+
### Patch Changes
|
|
36
|
+
|
|
37
|
+
- Selecting `workflow-make-boundary` keeps mutants inside `Workflow.make` decision bodies.
|
|
38
|
+
|
|
39
|
+
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.
|
|
40
|
+
|
|
41
|
+
- Instrumenting a file that calls a method named after an `Object.prototype`
|
|
42
|
+
member - `toString`, `valueOf`, `constructor` and the rest - no longer fails
|
|
43
|
+
with `Property name expected type of string but got function`. The method
|
|
44
|
+
mutator's replacement table answered such a lookup with the inherited function
|
|
45
|
+
rather than reporting no replacement, and a single `.toString()` call was enough
|
|
46
|
+
to stop the run. Those methods are now left alone, as they always should have
|
|
47
|
+
been.
|
|
48
|
+
|
|
49
|
+
- Updated dependencies:
|
|
50
|
+
- @systemfsoftware/effect-cell-types@5.0.0
|
|
51
|
+
|
|
3
52
|
## 1.0.0
|
|
4
53
|
|
|
5
54
|
### Major Changes
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @systemfsoftware/stryker-js-instrumenter
|
|
2
2
|
|
|
3
|
-
|
|
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 {
|
|
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 {
|
|
7
|
+
import { IgnorerService } from "@systemfsoftware/stryker-js/Ignorer";
|
|
4
8
|
import "effect/Option";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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/
|
|
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/
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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/
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
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
|
-
|
|
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 };
|