@systemfsoftware/stryker-js-typescript-checker 1.4.1 → 3.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 +95 -0
- package/dist/index.d.mts +2 -119
- package/dist/index.mjs +825 -462
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,100 @@
|
|
|
1
1
|
# @systemfsoftware/stryker-js-typescript-checker
|
|
2
2
|
|
|
3
|
+
## 3.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
|
+
- A type error inside an installed dependency's declaration files no longer fails the run.
|
|
38
|
+
|
|
39
|
+
The checker exists to decide whether your source still compiles once a mutant is
|
|
40
|
+
applied. It was also reporting errors from `.d.ts` files inside installed packages —
|
|
41
|
+
most often a package whose optional peer dependency is not installed. No mutant
|
|
42
|
+
causes those, every mutant reports the same ones, and the checker cannot act on
|
|
43
|
+
them, so their only effect was to end the run before a single mutant was tested.
|
|
44
|
+
|
|
45
|
+
Library declaration files are now skipped, alongside the code-quality options the
|
|
46
|
+
checker already relaxes while mutating.
|
|
47
|
+
|
|
48
|
+
- An oversized message between the runner and a worker now fails the run with a
|
|
49
|
+
reason instead of exhausting memory. Each side of the connection reads frames
|
|
50
|
+
up to 16 MiB, which leaves headroom over the largest legitimate payload — a dry
|
|
51
|
+
run carrying per-test coverage — and a frame past the limit fails the calls
|
|
52
|
+
waiting on it rather than growing until the process dies.
|
|
53
|
+
|
|
54
|
+
- Updated dependencies:
|
|
55
|
+
- @systemfsoftware/effect-cell-types@5.0.0
|
|
56
|
+
|
|
57
|
+
## 2.0.0
|
|
58
|
+
|
|
59
|
+
### Major Changes
|
|
60
|
+
|
|
61
|
+
- The TypeScript compiler's methods return Effects instead of Promises, and the
|
|
62
|
+
compiler is acquired for the length of the check. An interrupted check now
|
|
63
|
+
releases the compiler instead of leaving it alive with the run's state still in
|
|
64
|
+
it.
|
|
65
|
+
|
|
66
|
+
Compiler failures are now a single tagged `CompilerFailed` error carrying a
|
|
67
|
+
`reason` — the compiler used before initialization, no projects found for the
|
|
68
|
+
tsconfig, an unknown file in the graph, or a project file missing from disk.
|
|
69
|
+
They were untagged `Error`s before, so anything catching them saw one
|
|
70
|
+
indistinguishable type.
|
|
71
|
+
|
|
72
|
+
Diagnostics and `tsconfig` resolution are unchanged.
|
|
73
|
+
|
|
74
|
+
### Patch Changes
|
|
75
|
+
|
|
76
|
+
- The shared helpers package is gone. Nothing installs it any more, and the
|
|
77
|
+
handful of helpers worth sharing now live in the plugin contract next to the
|
|
78
|
+
types they serve:
|
|
79
|
+
|
|
80
|
+
- `strykerReportBugUrl`, `normalizeFileName`, `propertyPath`, `errorToString`
|
|
81
|
+
and `isErrnoException` from `@systemfsoftware/stryker-js-plugin-api/core`
|
|
82
|
+
- `noopLogger` from `@systemfsoftware/stryker-js-plugin-api/logging`
|
|
83
|
+
- `testFilesProvided` from `@systemfsoftware/stryker-js-plugin-api/test-runner`
|
|
84
|
+
|
|
85
|
+
If you imported any of those, change the specifier. Everything else it exported
|
|
86
|
+
had no consumer and is removed: use `Predicate.isNotNullish` from Effect in place
|
|
87
|
+
of `notEmpty`, and `RegExp.escape` in place of `escapeRegExp`.
|
|
88
|
+
|
|
89
|
+
- These packages no longer install dependencies they never imported, so installing them pulls less into your tree.
|
|
90
|
+
|
|
91
|
+
`tslib` is gone from all six. The mutation runner additionally stops installing `lodash.groupby`, `semver` and `source-map`, and the command line interface stops installing `@effect/platform-node-shared`. Nothing exported changes.
|
|
92
|
+
|
|
93
|
+
- Published packages no longer carry build artifacts left over from earlier builds. One package was shipping about a megabyte of bundled test-runner internals this way.
|
|
94
|
+
|
|
95
|
+
- Updated dependencies:
|
|
96
|
+
- @systemfsoftware/stryker-js-plugin-api@3.0.0
|
|
97
|
+
|
|
3
98
|
## 1.4.1
|
|
4
99
|
|
|
5
100
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -1,122 +1,5 @@
|
|
|
1
|
-
import { PluginKind } from "@systemfsoftware/stryker-js-plugin-api/plugin";
|
|
2
|
-
import { CheckResult, Checker } from "@systemfsoftware/stryker-js-plugin-api/check";
|
|
3
|
-
import { Diagnostic } from "typescript/unstable/sync";
|
|
4
|
-
import { Mutant, StrykerOptions } from "@systemfsoftware/stryker-js-plugin-api/core";
|
|
5
|
-
import { Logger } from "@systemfsoftware/stryker-js-plugin-api/logging";
|
|
6
|
-
import { FileSystem, FileSystemEntries } from "typescript/unstable/fs";
|
|
7
|
-
//#region src/grouping/ts-file-node.d.ts
|
|
8
|
-
declare class TSFileNode {
|
|
9
|
-
fileName: string;
|
|
10
|
-
parents: TSFileNode[];
|
|
11
|
-
children: TSFileNode[];
|
|
12
|
-
constructor(fileName: string, parents: TSFileNode[], children: TSFileNode[]);
|
|
13
|
-
getAllParentReferencesIncludingSelf(allParentReferences?: Set<TSFileNode>): Set<TSFileNode>;
|
|
14
|
-
getAllChildReferencesIncludingSelf(allChildReferences?: Set<TSFileNode>): Set<TSFileNode>;
|
|
15
|
-
getMutantsWithReferenceToChildrenOrSelf(mutants: Mutant[], nodesChecked?: string[]): Mutant[];
|
|
16
|
-
}
|
|
17
|
-
//#endregion
|
|
18
|
-
//#region src/project/script-file.d.ts
|
|
19
|
-
declare class ScriptFile {
|
|
20
|
-
content: string;
|
|
21
|
-
fileName: string;
|
|
22
|
-
modifiedTime: Date;
|
|
23
|
-
private readonly originalContent;
|
|
24
|
-
constructor(content: string, fileName: string, modifiedTime?: Date);
|
|
25
|
-
write(content: string): void;
|
|
26
|
-
mutate(mutant: Pick<Mutant, 'location' | 'replacement'>): void;
|
|
27
|
-
private getOffset;
|
|
28
|
-
resetMutant(): void;
|
|
29
|
-
private touch;
|
|
30
|
-
}
|
|
31
|
-
//#endregion
|
|
32
|
-
//#region src/project/hybrid-file-system.d.ts
|
|
33
|
-
/**
|
|
34
|
-
* A very simple hybrid file system.
|
|
35
|
-
* * Readonly from disk
|
|
36
|
-
* * Writes in-memory
|
|
37
|
-
* * Hard caching
|
|
38
|
-
* * Ability to mutate one file
|
|
39
|
-
*/
|
|
40
|
-
declare class HybridFileSystem implements FileSystem {
|
|
41
|
-
private readonly files;
|
|
42
|
-
/**
|
|
43
|
-
* Map of absolute tsconfig file paths to their adjusted JSON content.
|
|
44
|
-
* This allows the TS7 API to read overridden compiler options.
|
|
45
|
-
*/
|
|
46
|
-
tsConfigOverrides: Map<string, string>;
|
|
47
|
-
readFile: (fileName: string) => string | null | undefined;
|
|
48
|
-
fileExists: (fileName: string) => boolean | undefined;
|
|
49
|
-
directoryExists: () => boolean | undefined;
|
|
50
|
-
getAccessibleEntries: () => FileSystemEntries | undefined;
|
|
51
|
-
realpath: () => string | undefined;
|
|
52
|
-
writeFile(fileName: string, data: string): void;
|
|
53
|
-
getFile(fileName: string): ScriptFile | undefined;
|
|
54
|
-
mutateFile(fileName: string, mutant: Parameters<ScriptFile['mutate']>[0]): void;
|
|
55
|
-
resetFile(fileName: string): void;
|
|
56
|
-
existsInMemory(fileName: string): boolean;
|
|
57
|
-
private fileNameIsBuildInfo;
|
|
58
|
-
}
|
|
59
|
-
//#endregion
|
|
60
|
-
//#region src/typescript-compiler.d.ts
|
|
61
|
-
interface ITypescriptCompiler {
|
|
62
|
-
init(): Promise<Diagnostic[]>;
|
|
63
|
-
check(mutants: Mutant[]): Promise<Diagnostic[]>;
|
|
64
|
-
}
|
|
65
|
-
interface IFileRelationCreator {
|
|
66
|
-
get nodes(): Map<string, TSFileNode>;
|
|
67
|
-
}
|
|
68
|
-
declare class TypescriptCompiler implements ITypescriptCompiler, IFileRelationCreator {
|
|
69
|
-
private readonly log;
|
|
70
|
-
private readonly options;
|
|
71
|
-
private readonly fs;
|
|
72
|
-
static inject: ["logger", "options", "fs"];
|
|
73
|
-
private readonly allTSConfigFiles;
|
|
74
|
-
private readonly tsconfigFile;
|
|
75
|
-
private api?;
|
|
76
|
-
private snapshot?;
|
|
77
|
-
private readonly sourceFiles;
|
|
78
|
-
private readonly _nodes;
|
|
79
|
-
private lastMutants;
|
|
80
|
-
private lastMutatedFileNames;
|
|
81
|
-
constructor(log: Logger, options: StrykerOptions, fs: HybridFileSystem);
|
|
82
|
-
init(): Promise<Diagnostic[]>;
|
|
83
|
-
check(mutants: Mutant[]): Promise<Diagnostic[]>;
|
|
84
|
-
get nodes(): Map<string, TSFileNode>;
|
|
85
|
-
close(): void;
|
|
86
|
-
getLineAndCharacterOfPosition(fileName: string, position: number): {
|
|
87
|
-
line: number;
|
|
88
|
-
character: number;
|
|
89
|
-
} | undefined;
|
|
90
|
-
private getPrograms;
|
|
91
|
-
private collectAllTSConfigFiles;
|
|
92
|
-
private buildDependencyGraph;
|
|
93
|
-
private extractImports;
|
|
94
|
-
private resolveModuleSpecifier;
|
|
95
|
-
private getResolutionCandidates;
|
|
96
|
-
private resolveTSInputFile;
|
|
97
|
-
private guardTSConfigFileExists;
|
|
98
|
-
}
|
|
99
|
-
//#endregion
|
|
100
|
-
//#region src/typescript-checker.d.ts
|
|
101
|
-
declare class TypescriptChecker implements Checker {
|
|
102
|
-
private readonly logger;
|
|
103
|
-
private readonly tsCompiler;
|
|
104
|
-
static inject: ["logger", "options", "tsCompiler"];
|
|
105
|
-
private readonly options;
|
|
106
|
-
constructor(logger: Logger, options: StrykerOptions, tsCompiler: TypescriptCompiler);
|
|
107
|
-
init(): Promise<void>;
|
|
108
|
-
check(mutants: Mutant[]): Promise<Record<string, CheckResult>>;
|
|
109
|
-
group(mutants: Mutant[]): Promise<string[][]>;
|
|
110
|
-
private checkErrors;
|
|
111
|
-
private createErrorText;
|
|
112
|
-
private formatDiagnostic;
|
|
113
|
-
}
|
|
114
|
-
//#endregion
|
|
115
1
|
//#region src/index.d.ts
|
|
116
|
-
declare const strykerPlugins: import("@systemfsoftware/stryker-js
|
|
117
|
-
declare const createTypescriptChecker: ((injector: import("@systemfsoftware/stryker-js-plugin-api/plugin").Injector<import("@systemfsoftware/stryker-js-plugin-api/plugin").PluginContext>) => TypescriptChecker) & {
|
|
118
|
-
inject: ["$injector"];
|
|
119
|
-
};
|
|
2
|
+
declare const strykerPlugins: import("@systemfsoftware/stryker-js/Plugin").PluginContribution<"Checker">[];
|
|
120
3
|
declare const strykerValidationSchema: Record<string, unknown>;
|
|
121
4
|
//#endregion
|
|
122
|
-
export {
|
|
5
|
+
export { strykerPlugins, strykerValidationSchema };
|