@systemfsoftware/stryker-js-typescript-checker 7.0.2 → 7.0.3
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 +6 -0
- package/dist/main.mjs +195 -54
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @systemfsoftware/stryker-js-typescript-checker
|
|
2
2
|
|
|
3
|
+
## 7.0.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- A checker that fails now fails mutation testing with that checker's cause, instead of crashing with an empty error. The TypeScript checker type-checks each mutant, so compile errors appear in the report. Verdict counts are non-negative integers; `Metrics` is a class you can build from mutant statuses; a threshold `low` may not exceed `high`.
|
|
8
|
+
|
|
3
9
|
## 7.0.2
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
package/dist/main.mjs
CHANGED
|
@@ -8064,6 +8064,15 @@ const withSpan$1 = function() {
|
|
|
8064
8064
|
return (self, ...args) => useSpan$1(name, fnArg ? fnArg(...args) : options, (span) => withParentSpan(self, span, traceOptions));
|
|
8065
8065
|
};
|
|
8066
8066
|
/** @internal */
|
|
8067
|
+
const annotateCurrentSpan$1 = (...args) => withFiber$1((fiber) => {
|
|
8068
|
+
const span = fiber.currentSpanLocal;
|
|
8069
|
+
if (span) {
|
|
8070
|
+
if (args.length === 1) for (const [key, value] of Object.entries(args[0])) span.attribute(key, value);
|
|
8071
|
+
else span.attribute(args[0], args[1]);
|
|
8072
|
+
}
|
|
8073
|
+
return void_$3;
|
|
8074
|
+
});
|
|
8075
|
+
/** @internal */
|
|
8067
8076
|
const ClockRef = /*#__PURE__*/ Reference("effect/Clock", { defaultValue: () => new ClockImpl() });
|
|
8068
8077
|
const MAX_TIMER_MILLIS = 2 ** 31 - 1;
|
|
8069
8078
|
var ClockImpl = class {
|
|
@@ -13448,6 +13457,30 @@ const interruptible = interruptible$1;
|
|
|
13448
13457
|
*/
|
|
13449
13458
|
const forever = forever$1;
|
|
13450
13459
|
/**
|
|
13460
|
+
* Adds an annotation to the current span if available.
|
|
13461
|
+
*
|
|
13462
|
+
* **Example** (Annotating the current span)
|
|
13463
|
+
*
|
|
13464
|
+
* ```ts import.meta.vitest
|
|
13465
|
+
* import { Effect } from "effect"
|
|
13466
|
+
*
|
|
13467
|
+
* const program = Effect.gen(function*() {
|
|
13468
|
+
* yield* Effect.annotateCurrentSpan("userId", "123")
|
|
13469
|
+
* yield* Effect.annotateCurrentSpan({
|
|
13470
|
+
* operation: "user-lookup"
|
|
13471
|
+
* })
|
|
13472
|
+
* return "success"
|
|
13473
|
+
* })
|
|
13474
|
+
*
|
|
13475
|
+
* const traced = Effect.withSpan(program, "user-operation")
|
|
13476
|
+
* Effect.runSync(traced) // => "success"
|
|
13477
|
+
* ```
|
|
13478
|
+
*
|
|
13479
|
+
* @category tracing
|
|
13480
|
+
* @since 2.0.0
|
|
13481
|
+
*/
|
|
13482
|
+
const annotateCurrentSpan = annotateCurrentSpan$1;
|
|
13483
|
+
/**
|
|
13451
13484
|
* Create a new span for tracing, and automatically close it when the effect
|
|
13452
13485
|
* completes.
|
|
13453
13486
|
*
|
|
@@ -28486,26 +28519,86 @@ TaggedClass()("ClassifyExitDecision", {
|
|
|
28486
28519
|
highestClass: NullOr(ExitClass),
|
|
28487
28520
|
verdictClass: NullOr(ExitClass)
|
|
28488
28521
|
});
|
|
28522
|
+
Union([Literal("Killed"), Literal("Timeout")]);
|
|
28523
|
+
Union([Literal("Survived"), Literal("NoCoverage")]);
|
|
28524
|
+
Union([Literal("CompileError"), Literal("RuntimeError")]);
|
|
28525
|
+
Union([Literal("Ignored"), Literal("Pending")]);
|
|
28526
|
+
const NonNegativeInt = Int.pipe(check(isGreaterThanOrEqualTo(0)));
|
|
28527
|
+
const NonNegativeFinite = Finite.pipe(check(isGreaterThanOrEqualTo(0)));
|
|
28528
|
+
const Percentage = Finite.pipe(check(isBetween({
|
|
28529
|
+
minimum: 0,
|
|
28530
|
+
maximum: 100
|
|
28531
|
+
})));
|
|
28532
|
+
var Metrics = class Metrics extends Class("Metrics")({
|
|
28533
|
+
pending: NonNegativeInt,
|
|
28534
|
+
killed: NonNegativeInt,
|
|
28535
|
+
timeout: NonNegativeInt,
|
|
28536
|
+
survived: NonNegativeInt,
|
|
28537
|
+
noCoverage: NonNegativeInt,
|
|
28538
|
+
runtimeErrors: NonNegativeInt,
|
|
28539
|
+
compileErrors: NonNegativeInt,
|
|
28540
|
+
ignored: NonNegativeInt
|
|
28541
|
+
}) {
|
|
28542
|
+
get totalDetected() {
|
|
28543
|
+
return this.timeout + this.killed;
|
|
28544
|
+
}
|
|
28545
|
+
get totalUndetected() {
|
|
28546
|
+
return this.survived + this.noCoverage;
|
|
28547
|
+
}
|
|
28548
|
+
get totalCovered() {
|
|
28549
|
+
return this.totalDetected + this.survived;
|
|
28550
|
+
}
|
|
28551
|
+
get totalValid() {
|
|
28552
|
+
return this.totalUndetected + this.totalDetected;
|
|
28553
|
+
}
|
|
28554
|
+
get totalInvalid() {
|
|
28555
|
+
return this.runtimeErrors + this.compileErrors;
|
|
28556
|
+
}
|
|
28557
|
+
get totalMutants() {
|
|
28558
|
+
return this.totalValid + this.totalInvalid + this.ignored + this.pending;
|
|
28559
|
+
}
|
|
28560
|
+
get mutationScore() {
|
|
28561
|
+
if (this.totalValid === 0) return NaN;
|
|
28562
|
+
return Math.min(100, Math.max(0, this.totalDetected / this.totalValid * 100));
|
|
28563
|
+
}
|
|
28564
|
+
get mutationScoreBasedOnCoveredCode() {
|
|
28565
|
+
if (this.totalCovered === 0) return NaN;
|
|
28566
|
+
return Math.min(100, Math.max(0, this.totalDetected / this.totalCovered * 100));
|
|
28567
|
+
}
|
|
28568
|
+
static fromMutants(mutants) {
|
|
28569
|
+
const counts = emptyMetricCounts();
|
|
28570
|
+
for (const mutant of mutants) incrementMetricStatus(counts, mutant.status);
|
|
28571
|
+
return Metrics.make(counts);
|
|
28572
|
+
}
|
|
28573
|
+
};
|
|
28574
|
+
const emptyMetricCounts = () => ({
|
|
28575
|
+
pending: 0,
|
|
28576
|
+
killed: 0,
|
|
28577
|
+
timeout: 0,
|
|
28578
|
+
survived: 0,
|
|
28579
|
+
noCoverage: 0,
|
|
28580
|
+
runtimeErrors: 0,
|
|
28581
|
+
compileErrors: 0,
|
|
28582
|
+
ignored: 0
|
|
28583
|
+
});
|
|
28584
|
+
const METRIC_STATUS_KEYS = {
|
|
28585
|
+
Pending: "pending",
|
|
28586
|
+
Killed: "killed",
|
|
28587
|
+
Timeout: "timeout",
|
|
28588
|
+
Survived: "survived",
|
|
28589
|
+
NoCoverage: "noCoverage",
|
|
28590
|
+
RuntimeError: "runtimeErrors",
|
|
28591
|
+
CompileError: "compileErrors",
|
|
28592
|
+
Ignored: "ignored"
|
|
28593
|
+
};
|
|
28594
|
+
const incrementMetricStatus = (counts, status) => {
|
|
28595
|
+
const key = METRIC_STATUS_KEYS[status];
|
|
28596
|
+
if (key === void 0) return;
|
|
28597
|
+
counts[key] += 1;
|
|
28598
|
+
};
|
|
28489
28599
|
const MetricsResultSchema = Struct({
|
|
28490
28600
|
name: String$1,
|
|
28491
|
-
metrics:
|
|
28492
|
-
pending: Finite,
|
|
28493
|
-
killed: Finite,
|
|
28494
|
-
timeout: Finite,
|
|
28495
|
-
survived: Finite,
|
|
28496
|
-
noCoverage: Finite,
|
|
28497
|
-
runtimeErrors: Finite,
|
|
28498
|
-
compileErrors: Finite,
|
|
28499
|
-
ignored: Finite,
|
|
28500
|
-
totalDetected: Finite,
|
|
28501
|
-
totalUndetected: Finite,
|
|
28502
|
-
totalInvalid: Finite,
|
|
28503
|
-
totalValid: Finite,
|
|
28504
|
-
totalMutants: Finite,
|
|
28505
|
-
totalCovered: Finite,
|
|
28506
|
-
mutationScore: Finite,
|
|
28507
|
-
mutationScoreBasedOnCoveredCode: Finite
|
|
28508
|
-
}),
|
|
28601
|
+
metrics: Metrics,
|
|
28509
28602
|
childResults: ArraySchema(suspend(() => MetricsResultSchema))
|
|
28510
28603
|
}).annotate({ identifier: "MetricsResult" });
|
|
28511
28604
|
const FileResultDictionarySchema = Record(String$1, Struct({
|
|
@@ -28522,8 +28615,8 @@ const FileResultDictionarySchema = Record(String$1, Struct({
|
|
|
28522
28615
|
static: optional(Boolean$2),
|
|
28523
28616
|
coveredBy: optional(ArraySchema(String$1)),
|
|
28524
28617
|
killedBy: optional(ArraySchema(String$1)),
|
|
28525
|
-
testsCompleted: optional(
|
|
28526
|
-
duration: optional(
|
|
28618
|
+
testsCompleted: optional(NonNegativeInt),
|
|
28619
|
+
duration: optional(NonNegativeFinite)
|
|
28527
28620
|
}))
|
|
28528
28621
|
}));
|
|
28529
28622
|
const TestDefinitionSchema = Struct({
|
|
@@ -28536,9 +28629,23 @@ const TestFileDefinitionDictionarySchema = Record(String$1, Struct({
|
|
|
28536
28629
|
tests: ArraySchema(TestDefinitionSchema)
|
|
28537
28630
|
}));
|
|
28538
28631
|
const ThresholdsSchema = Struct({
|
|
28539
|
-
high:
|
|
28540
|
-
low:
|
|
28541
|
-
})
|
|
28632
|
+
high: Percentage,
|
|
28633
|
+
low: Percentage
|
|
28634
|
+
}).pipe(check(makeFilter((t) => t.low <= t.high, {
|
|
28635
|
+
expected: "thresholds where low <= high",
|
|
28636
|
+
arbitrary: { candidate: { make: (fc) => fc.tuple(fc.float({
|
|
28637
|
+
min: 0,
|
|
28638
|
+
max: 100,
|
|
28639
|
+
noNaN: true
|
|
28640
|
+
}), fc.float({
|
|
28641
|
+
min: 0,
|
|
28642
|
+
max: 100,
|
|
28643
|
+
noNaN: true
|
|
28644
|
+
})).map(([a, b]) => ({
|
|
28645
|
+
high: Math.max(a, b),
|
|
28646
|
+
low: Math.min(a, b)
|
|
28647
|
+
})) } }
|
|
28648
|
+
})));
|
|
28542
28649
|
const BrandingInformationSchema = Struct({
|
|
28543
28650
|
homepageUrl: String$1,
|
|
28544
28651
|
imageUrl: optional(String$1)
|
|
@@ -28666,23 +28773,23 @@ const ReporterEventKind = Literals([
|
|
|
28666
28773
|
"mutationTestReportReady"
|
|
28667
28774
|
]);
|
|
28668
28775
|
const RunTimingSchema = Struct({
|
|
28669
|
-
net:
|
|
28670
|
-
overhead:
|
|
28776
|
+
net: NonNegativeFinite,
|
|
28777
|
+
overhead: NonNegativeFinite
|
|
28671
28778
|
});
|
|
28672
28779
|
const ReporterPlanDescriptorSchema = Struct({
|
|
28673
28780
|
mutantId: String$1,
|
|
28674
28781
|
plan: Literals(["EarlyResult", "Run"]),
|
|
28675
|
-
netTime:
|
|
28782
|
+
netTime: NonNegativeFinite,
|
|
28676
28783
|
reloadEnvironment: Boolean$2
|
|
28677
28784
|
});
|
|
28678
28785
|
var DryRunCompleted = class extends TaggedClass()("dryRunCompleted", {
|
|
28679
28786
|
timing: RunTimingSchema,
|
|
28680
28787
|
capabilities: TestRunnerCapabilitiesSchema,
|
|
28681
|
-
testCount:
|
|
28788
|
+
testCount: NonNegativeInt,
|
|
28682
28789
|
tests: ArraySchema(TestResultSchema)
|
|
28683
28790
|
}) {};
|
|
28684
28791
|
var MutationTestingPlanReady = class extends TaggedClass()("mutationTestingPlanReady", {
|
|
28685
|
-
total:
|
|
28792
|
+
total: NonNegativeInt,
|
|
28686
28793
|
plans: ArraySchema(ReporterPlanDescriptorSchema)
|
|
28687
28794
|
}) {};
|
|
28688
28795
|
var MutantTested = class extends TaggedClass()("mutantTested", {
|
|
@@ -28692,8 +28799,8 @@ var MutantTested = class extends TaggedClass()("mutantTested", {
|
|
|
28692
28799
|
location: LocationSchema,
|
|
28693
28800
|
mutator: String$1,
|
|
28694
28801
|
replacement: NullOr(String$1),
|
|
28695
|
-
completed:
|
|
28696
|
-
total:
|
|
28802
|
+
completed: NonNegativeInt,
|
|
28803
|
+
total: NonNegativeInt
|
|
28697
28804
|
}) {};
|
|
28698
28805
|
var MutationTestReportReady = class extends TaggedClass()("mutationTestReportReady", {
|
|
28699
28806
|
report: MutationTestResultSchema,
|
|
@@ -28856,11 +28963,6 @@ const PackageManager = Literals([
|
|
|
28856
28963
|
"yarn",
|
|
28857
28964
|
"pnpm"
|
|
28858
28965
|
]);
|
|
28859
|
-
/** 0–100 percentage used by the mutation-score thresholds. */
|
|
28860
|
-
const Percentage = Finite.pipe(check(isBetween({
|
|
28861
|
-
minimum: 0,
|
|
28862
|
-
maximum: 100
|
|
28863
|
-
})));
|
|
28864
28966
|
const CommandRunnerOptionsSchema = openStruct({ command: defaulted(String$1, "npm test") });
|
|
28865
28967
|
const ClearTextReporterOptions = openStruct({
|
|
28866
28968
|
allowColor: defaulted(Boolean$2, true),
|
|
@@ -28878,7 +28980,26 @@ const MutationScoreThresholdsSchema = Struct({
|
|
|
28878
28980
|
high: defaulted(Percentage, 80),
|
|
28879
28981
|
low: defaulted(Percentage, 60),
|
|
28880
28982
|
break: defaulted(NullOr(Percentage), null)
|
|
28881
|
-
})
|
|
28983
|
+
}).pipe(check(makeFilter((t) => t.low <= t.high, {
|
|
28984
|
+
expected: "thresholds where low <= high",
|
|
28985
|
+
arbitrary: { candidate: { make: (fc) => fc.tuple(fc.float({
|
|
28986
|
+
min: 0,
|
|
28987
|
+
max: 100,
|
|
28988
|
+
noNaN: true
|
|
28989
|
+
}), fc.float({
|
|
28990
|
+
min: 0,
|
|
28991
|
+
max: 100,
|
|
28992
|
+
noNaN: true
|
|
28993
|
+
}), fc.option(fc.float({
|
|
28994
|
+
min: 0,
|
|
28995
|
+
max: 100,
|
|
28996
|
+
noNaN: true
|
|
28997
|
+
}), { nil: null })).map(([a, b, brk]) => ({
|
|
28998
|
+
high: Math.max(a, b),
|
|
28999
|
+
low: Math.min(a, b),
|
|
29000
|
+
break: brk
|
|
29001
|
+
})) } }
|
|
29002
|
+
})));
|
|
28882
29003
|
const MutatorDescriptor = Struct({ excludedMutations: defaulted(ArraySchema(String$1), []) });
|
|
28883
29004
|
const WarningOptions = openStruct({
|
|
28884
29005
|
unknownOptions: defaulted(Boolean$2, true),
|
|
@@ -52273,7 +52394,7 @@ function parseTsConfig(fileName, jsonText) {
|
|
|
52273
52394
|
}
|
|
52274
52395
|
/** Whether `--build` mode should be enabled based on `references` in the tsconfig. */
|
|
52275
52396
|
const determineBuildModeEnabled = (tsconfigFileName, fsService) => gen(function* () {
|
|
52276
|
-
const parsed = parseTsConfig(tsconfigFileName, yield* fsService.readFileString(tsconfigFileName));
|
|
52397
|
+
const parsed = parseTsConfig(tsconfigFileName, yield* fsService.readFileString(tsconfigFileName).pipe(orElseSucceed(() => "")));
|
|
52277
52398
|
return match$3(parsed, {
|
|
52278
52399
|
onFailure: () => false,
|
|
52279
52400
|
onSuccess: (config) => config.references !== void 0
|
|
@@ -52351,7 +52472,7 @@ const readTypescriptPackageVersion = (fsService, pathService) => gen(function* (
|
|
|
52351
52472
|
onSuccess: (value) => value
|
|
52352
52473
|
});
|
|
52353
52474
|
return getOrElse(flatMap$4(versionFieldOf(raw), (version) => liftPredicate(version, isString)), () => "");
|
|
52354
|
-
});
|
|
52475
|
+
}).pipe(orElseSucceed(() => ""));
|
|
52355
52476
|
const getTSVersion = (fsService, pathService) => gen(function* () {
|
|
52356
52477
|
if (cachedTSVersion !== void 0) return cachedTSVersion;
|
|
52357
52478
|
const version = yield* readTypescriptPackageVersion(fsService, pathService);
|
|
@@ -52436,7 +52557,7 @@ function resetScriptFile(file, now) {
|
|
|
52436
52557
|
function getOffset(file, pos) {
|
|
52437
52558
|
const lines = file.originalContent.split("\n");
|
|
52438
52559
|
const lineCount = Math.min(pos.line, lines.length);
|
|
52439
|
-
let offset = pos.column;
|
|
52560
|
+
let offset = Math.max(0, pos.column - 1);
|
|
52440
52561
|
lines.forEach((line, index) => {
|
|
52441
52562
|
if (index < lineCount) offset += line.length + 1;
|
|
52442
52563
|
});
|
|
@@ -52658,7 +52779,7 @@ function makeTypescriptCompiler(options, fs, fsService, pathService) {
|
|
|
52658
52779
|
}));
|
|
52659
52780
|
return succeed$1(projects.map((project) => project.program));
|
|
52660
52781
|
};
|
|
52661
|
-
const
|
|
52782
|
+
const getPrograms = () => gen(function* () {
|
|
52662
52783
|
const state = yield* get$1(stateRef);
|
|
52663
52784
|
const snapshot = yield* snapshotOf(state);
|
|
52664
52785
|
return yield* programsOf(snapshot, state.tsconfigFile);
|
|
@@ -52687,7 +52808,7 @@ function makeTypescriptCompiler(options, fs, fsService, pathService) {
|
|
|
52687
52808
|
const current = traversal.pending.pop();
|
|
52688
52809
|
if (!isUnprocessedTsConfigPath(current, traversal.processed)) return;
|
|
52689
52810
|
add(traversal.processed, current);
|
|
52690
|
-
const content = yield* fsService.readFileString(current);
|
|
52811
|
+
const content = yield* fsService.readFileString(current).pipe(mapError(() => TsConfigNotFoundError.make({ file: current })));
|
|
52691
52812
|
recordTsConfig(current, content, parseTsConfig(current, content), traversal);
|
|
52692
52813
|
});
|
|
52693
52814
|
const collectAllTSConfigFiles = (buildModeEnabled) => gen(function* () {
|
|
@@ -52892,15 +53013,20 @@ function makeTypescriptCompiler(options, fs, fsService, pathService) {
|
|
|
52892
53013
|
yield* buildFileNodes(state);
|
|
52893
53014
|
return state.nodes;
|
|
52894
53015
|
});
|
|
53016
|
+
const resolveFileName = (fileName) => normalizeFileName$1(pathService.resolve(fileName));
|
|
52895
53017
|
const resetMutatedFiles = (mutants) => gen(function* () {
|
|
52896
|
-
for (const mutant of mutants) yield* fs.resetFile(mutant.fileName);
|
|
53018
|
+
for (const mutant of mutants) yield* fs.resetFile(resolveFileName(mutant.fileName));
|
|
52897
53019
|
});
|
|
52898
53020
|
const applyMutant = (mutant) => gen(function* () {
|
|
52899
|
-
|
|
53021
|
+
const resolved = resolveFileName(mutant.fileName);
|
|
53022
|
+
if ((yield* fs.getFile(resolved)) === void 0) return yield* CompilerFailed.make({
|
|
52900
53023
|
reason: "file-not-in-project",
|
|
52901
53024
|
subject: mutant.fileName
|
|
52902
53025
|
});
|
|
52903
|
-
yield* fs.mutateFile(
|
|
53026
|
+
yield* fs.mutateFile(resolved, mutant).pipe(mapError(() => CompilerFailed.make({
|
|
53027
|
+
reason: "file-not-in-project",
|
|
53028
|
+
subject: mutant.fileName
|
|
53029
|
+
})));
|
|
52904
53030
|
});
|
|
52905
53031
|
const applyMutants = (mutants) => gen(function* () {
|
|
52906
53032
|
for (const mutant of mutants) yield* applyMutant(mutant);
|
|
@@ -52918,25 +53044,40 @@ function makeTypescriptCompiler(options, fs, fsService, pathService) {
|
|
|
52918
53044
|
snapshot: next
|
|
52919
53045
|
}));
|
|
52920
53046
|
});
|
|
53047
|
+
const refreshSnapshotIfOpen = (current, changedFiles) => {
|
|
53048
|
+
if (!hasOpenSnapshot(current)) return void_$1;
|
|
53049
|
+
return updateSnapshot(current, changedFiles);
|
|
53050
|
+
};
|
|
53051
|
+
const annotateDiagnosticSample = (diagnostics) => {
|
|
53052
|
+
if (diagnostics.length === 0) return void_$1;
|
|
53053
|
+
const summary = diagnostics.slice(0, 10).map((d) => `${d.fileName ?? "unknown"}:${d.code}: ${d.text}`).join("; ");
|
|
53054
|
+
return annotateCurrentSpan({ "typescript.diagnostics.sample": summary });
|
|
53055
|
+
};
|
|
52921
53056
|
const check = (mutants) => gen(function* () {
|
|
52922
53057
|
const state = yield* get$1(stateRef);
|
|
52923
53058
|
yield* resetMutatedFiles(state.lastMutants);
|
|
52924
53059
|
yield* applyMutants(mutants);
|
|
52925
|
-
const mutatedFileNames = Array.from(fromIterable(mutants.map((mutant) =>
|
|
53060
|
+
const mutatedFileNames = Array.from(fromIterable(mutants.map((mutant) => resolveFileName(mutant.fileName))));
|
|
52926
53061
|
const changedFiles = Array.from(fromIterable([...state.lastMutatedFileNames, ...mutatedFileNames]));
|
|
52927
53062
|
const current = yield* get$1(stateRef);
|
|
52928
|
-
|
|
53063
|
+
yield* refreshSnapshotIfOpen(current, changedFiles);
|
|
52929
53064
|
yield* update(stateRef, (prev) => ({
|
|
52930
53065
|
...prev,
|
|
52931
53066
|
lastMutants: [...mutants],
|
|
52932
53067
|
lastMutatedFileNames: mutatedFileNames
|
|
52933
53068
|
}));
|
|
52934
|
-
|
|
53069
|
+
const diagnostics = (yield* getPrograms()).flatMap((program) => [
|
|
52935
53070
|
...program.getConfigFileParsingDiagnostics(),
|
|
52936
53071
|
...program.getSemanticDiagnostics(),
|
|
52937
53072
|
...program.getProgramDiagnostics()
|
|
52938
53073
|
]).filter((diagnostic) => diagnostic.category === DiagnosticCategory.Error);
|
|
52939
|
-
|
|
53074
|
+
yield* annotateCurrentSpan({ "typescript.diagnostics.count": diagnostics.length });
|
|
53075
|
+
yield* annotateDiagnosticSample(diagnostics);
|
|
53076
|
+
return diagnostics;
|
|
53077
|
+
}).pipe(withSpan("typescript-checker.compiler.check", { attributes: {
|
|
53078
|
+
"stryker.mutants.count": mutants.length,
|
|
53079
|
+
"stryker.mutants.ids": mutants.map((m) => m.id).join(",")
|
|
53080
|
+
} }));
|
|
52940
53081
|
const init = gen(function* () {
|
|
52941
53082
|
yield* guardTSVersion(fsService, pathService);
|
|
52942
53083
|
const absoluteTsconfigFile = normalizeFileName$1(pathService.resolve(rawTsconfigFile));
|
|
@@ -52956,7 +53097,7 @@ function makeTypescriptCompiler(options, fs, fsService, pathService) {
|
|
|
52956
53097
|
api,
|
|
52957
53098
|
snapshot
|
|
52958
53099
|
}));
|
|
52959
|
-
const programs = yield*
|
|
53100
|
+
const programs = yield* getPrograms();
|
|
52960
53101
|
yield* buildDependencyGraph(programs);
|
|
52961
53102
|
return yield* check([]);
|
|
52962
53103
|
});
|
|
@@ -52971,12 +53112,12 @@ function makeTypescriptCompiler(options, fs, fsService, pathService) {
|
|
|
52971
53112
|
}));
|
|
52972
53113
|
});
|
|
52973
53114
|
const getLineAndCharacterOfPosition = (fileName, position) => gen(function* () {
|
|
52974
|
-
return (yield*
|
|
53115
|
+
return (yield* getPrograms().pipe(orElseSucceed(() => []))).map((program) => program.getSourceFile(fileName)).find((sourceFile) => sourceFile !== void 0)?.getLineAndCharacterOfPosition(position);
|
|
52975
53116
|
});
|
|
52976
53117
|
return {
|
|
52977
53118
|
init,
|
|
52978
53119
|
check,
|
|
52979
|
-
nodes: getNodesEffect,
|
|
53120
|
+
nodes: getNodesEffect.pipe(orDie),
|
|
52980
53121
|
close,
|
|
52981
53122
|
getLineAndCharacterOfPosition
|
|
52982
53123
|
};
|
|
@@ -52996,7 +53137,7 @@ const knownFileGroups = (mutants, nodes) => {
|
|
|
52996
53137
|
};
|
|
52997
53138
|
const groupMutants = (mutants, nodes, prioritizePerformanceOverAccuracy) => {
|
|
52998
53139
|
if (prioritizePerformanceOverAccuracy) return knownFileGroups(mutants, nodes);
|
|
52999
|
-
return
|
|
53140
|
+
return mutants.map((mutant) => [mutant.id]);
|
|
53000
53141
|
};
|
|
53001
53142
|
//#endregion
|
|
53002
53143
|
//#region src/Checker.ts
|
|
@@ -53040,14 +53181,14 @@ const makeCheckerService = ({ options, compiler }) => {
|
|
|
53040
53181
|
});
|
|
53041
53182
|
const formatDiagnostic = (error) => positionOf(error).pipe(map$2((position) => `${position}${severityOf(error.category)} TS${error.code}: ${error.text}`));
|
|
53042
53183
|
const createErrorText = (errors) => map$2(forEach$2(errors, formatDiagnostic), (parts) => parts.join("\n"));
|
|
53043
|
-
const soloRound = (mutant) => verify.run(CheckMutantsCommand.make({ mutants: [mutant] })).pipe(map$2((decision) => decision.results));
|
|
53184
|
+
const soloRound = (mutant) => verify.run(CheckMutantsCommand.make({ mutants: [mutant] })).pipe(withSpan("typescript-checker.soloRound", { attributes: { "stryker.mutant.id": mutant.id } }), map$2((decision) => decision.results));
|
|
53044
53185
|
const soloRounds = (decision) => value(decision).pipe(tag("CheckFinished", () => succeed$1([])), tag("RetestRequired", (retest) => verify.run(CheckMutantsCommand.make({ mutants: [] })).pipe(flatMap(() => forEach$2(retest.needsRetest, soloRound)))), exhaustive);
|
|
53045
53186
|
return {
|
|
53046
53187
|
init: compiler.init.pipe(mapError((cause) => refuse([], cause)), flatMap((errors) => {
|
|
53047
53188
|
if (errors.length === 0) return void_$1;
|
|
53048
53189
|
return createErrorText(errors).pipe(map$2((text) => refuse([], /* @__PURE__ */ new Error(`Typescript error(s) found in dry run compilation: ${text}`))), flatMap(fail));
|
|
53049
53190
|
})),
|
|
53050
|
-
check: (mutants) => verify.run(CheckMutantsCommand.make({ mutants: [...mutants] })).pipe(flatMap((first) => map$2(soloRounds(first), (rounds) => mergeAnswers([first.results, ...rounds])))),
|
|
53191
|
+
check: (mutants) => verify.run(CheckMutantsCommand.make({ mutants: [...mutants] })).pipe(flatMap((first) => map$2(soloRounds(first), (rounds) => mergeAnswers([first.results, ...rounds]))), withSpan("typescript-checker.check", { attributes: { "stryker.mutants.count": mutants.length } })),
|
|
53051
53192
|
group: (mutants) => compiler.nodes.pipe(map$2((nodes) => groupMutants(mutants, nodes, getPrioritize(options))), mapError((cause) => refuse(mutants.map((mutant) => mutant.id), cause)))
|
|
53052
53193
|
};
|
|
53053
53194
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@systemfsoftware/stryker-js-typescript-checker",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.3",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/systemfsoftware/stryker-js-effect.git",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"effect": "4.0.0-rc.112",
|
|
31
31
|
"typescript": "^7",
|
|
32
32
|
"@systemfsoftware/stryker-js-instrumenter": "^8.0.0",
|
|
33
|
-
"@systemfsoftware/stryker-js-plugin-interface": "^7.
|
|
33
|
+
"@systemfsoftware/stryker-js-plugin-interface": "^7.1.0",
|
|
34
34
|
"@systemfsoftware/stryker-js-plugin-runtime": "^5.0.2"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
@@ -56,8 +56,8 @@
|
|
|
56
56
|
"rimraf": "^6.1.3",
|
|
57
57
|
"tsdown": "^0.23.0",
|
|
58
58
|
"vitest": "^4",
|
|
59
|
-
"@systemfsoftware/stryker-config": "^0.1.0",
|
|
60
59
|
"@systemfsoftware/tsdown-config": "^0.1.0",
|
|
60
|
+
"@systemfsoftware/stryker-config": "^0.1.0",
|
|
61
61
|
"@systemfsoftware/vitest-config": "^0.1.0"
|
|
62
62
|
},
|
|
63
63
|
"inlinedDependencies": {
|