@systemfsoftware/stryker-js-vitest-runner 2.0.2 → 2.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 +13 -0
- package/dist/index.mjs +43 -32
- package/package.json +4 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @systemfsoftware/stryker-js-vitest-runner
|
|
2
2
|
|
|
3
|
+
## 2.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Plugin code can now ask for the module-loader service instead of touching the host module API: it exposes the same `createRequire`/`isBuiltin` surface as the host module module, and the Node engine supplies it automatically. Plugins that declare their environment through the engine's plugin declaration get the service without extra wiring; upgrades should move the engine and its plugins in the same release.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Refreshed builds on the platform-services dependency graph; the packages no longer reach for host builtins directly. No CLI flags or option names change.
|
|
12
|
+
|
|
13
|
+
- Updated dependencies:
|
|
14
|
+
- @systemfsoftware/stryker-js@0.2.0
|
|
15
|
+
|
|
3
16
|
## 2.0.2
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
package/dist/index.mjs
CHANGED
|
@@ -2,12 +2,9 @@ import { RunConfiguration, SandboxDirectory, declarePlugin } from "@systemfsoftw
|
|
|
2
2
|
import * as Effect$1 from "effect/Effect";
|
|
3
3
|
import * as Layer from "effect/Layer";
|
|
4
4
|
import * as S from "effect/Schema";
|
|
5
|
-
import { createRequire } from "module";
|
|
6
|
-
import { pathToFileURL } from "node:url";
|
|
7
|
-
import path from "path";
|
|
8
|
-
import { fileURLToPath } from "url";
|
|
9
5
|
import { createVitest } from "vitest/node";
|
|
10
6
|
import { Cell, Workflow } from "@systemfsoftware/effect-cell-types";
|
|
7
|
+
import { Module } from "@systemfsoftware/stryker-js/Module";
|
|
11
8
|
import { INSTRUMENTER_CONSTANTS, errorToString, normalizeFileName } from "@systemfsoftware/stryker-js/Mutant";
|
|
12
9
|
import { TestRunner, TestRunnerFailed, testFilesProvided } from "@systemfsoftware/stryker-js/TestRunner";
|
|
13
10
|
import * as FileSystem from "effect/FileSystem";
|
|
@@ -608,27 +605,39 @@ const sandboxSelfPlugin = (aliases) => ({
|
|
|
608
605
|
for (const alias of aliases) if (alias.find.test(source)) return alias.replacement;
|
|
609
606
|
}
|
|
610
607
|
});
|
|
611
|
-
const
|
|
612
|
-
|
|
613
|
-
const resolveVitest =
|
|
614
|
-
|
|
615
|
-
const
|
|
616
|
-
const
|
|
617
|
-
const
|
|
608
|
+
const isRunnerTestSuite = (value) => typeof value === "object" && value !== null && "tasks" in value && Array.isArray(Reflect.get(value, "tasks"));
|
|
609
|
+
const STRYKER_SETUP_URL = new URL("./stryker-setup.mjs", import.meta.url);
|
|
610
|
+
const resolveVitest = (_dir) => Effect$1.gen(function* () {
|
|
611
|
+
const fallback = Effect$1.gen(function* () {
|
|
612
|
+
const pathService = yield* Path.Path;
|
|
613
|
+
const fs = yield* FileSystem.FileSystem;
|
|
614
|
+
const urlString = import.meta.resolve("vitest/package.json");
|
|
615
|
+
const packageJsonPath = yield* pathService.fromFileUrl(new URL(urlString));
|
|
616
|
+
const content = yield* fs.readFileString(packageJsonPath);
|
|
617
|
+
const parsed = JSON.parse(content);
|
|
618
|
+
const decoded = yield* S.decodeUnknownEffect(VitestPackageSchema)(parsed);
|
|
618
619
|
return {
|
|
619
|
-
createVitest
|
|
620
|
-
version:
|
|
620
|
+
createVitest,
|
|
621
|
+
version: decoded.version
|
|
621
622
|
};
|
|
622
|
-
}
|
|
623
|
-
|
|
623
|
+
}).pipe(Effect$1.orDie);
|
|
624
|
+
return yield* Effect$1.gen(function* () {
|
|
625
|
+
const module = yield* Module;
|
|
626
|
+
const pathService = yield* Path.Path;
|
|
627
|
+
const fs = yield* FileSystem.FileSystem;
|
|
628
|
+
const requireFromProject = module.createRequire(pathService.join(_dir, "package.json"));
|
|
629
|
+
const imported = requireFromProject("vitest/node");
|
|
630
|
+
const decodedNode = yield* S.decodeUnknownEffect(VitestNodeModuleSchema)(imported);
|
|
631
|
+
const packageJsonPath = requireFromProject.resolve("vitest/package.json");
|
|
632
|
+
const content = yield* fs.readFileString(packageJsonPath);
|
|
633
|
+
const parsed = JSON.parse(content);
|
|
634
|
+
const decodedPackage = yield* S.decodeUnknownEffect(VitestPackageSchema)(parsed);
|
|
624
635
|
return {
|
|
625
|
-
createVitest,
|
|
626
|
-
version:
|
|
636
|
+
createVitest: decodedNode.createVitest,
|
|
637
|
+
version: decodedPackage.version
|
|
627
638
|
};
|
|
628
|
-
}
|
|
629
|
-
};
|
|
630
|
-
const isRunnerTestSuite = (value) => typeof value === "object" && value !== null && "tasks" in value && Array.isArray(Reflect.get(value, "tasks"));
|
|
631
|
-
const STRYKER_SETUP = fileURLToPath(new URL("./stryker-setup.mjs", import.meta.url));
|
|
639
|
+
}).pipe(Effect$1.catchCause(() => fallback), Effect$1.catchDefect(() => fallback));
|
|
640
|
+
}).pipe(Effect$1.orDie);
|
|
632
641
|
const shouldUseSuiteMetaSecondArg = (version) => {
|
|
633
642
|
const parts = version.split(".");
|
|
634
643
|
const major = Number(parts[0] ?? "0");
|
|
@@ -704,6 +713,7 @@ const makeVitestRunnerLayer = (input) => Layer.effect(TestRunner, Effect$1.gen(f
|
|
|
704
713
|
});
|
|
705
714
|
const fsService = yield* FileSystem.FileSystem;
|
|
706
715
|
const pathService = yield* Path.Path;
|
|
716
|
+
const moduleService = yield* Module;
|
|
707
717
|
const getState = Ref.get(stateRef);
|
|
708
718
|
const requireCtx = Effect$1.gen(function* () {
|
|
709
719
|
const state = yield* getState;
|
|
@@ -739,20 +749,21 @@ const makeVitestRunnerLayer = (input) => Layer.effect(TestRunner, Effect$1.gen(f
|
|
|
739
749
|
...s,
|
|
740
750
|
localSetupFile
|
|
741
751
|
}));
|
|
742
|
-
yield*
|
|
752
|
+
const defaultSetupPath = yield* pathService.fromFileUrl(STRYKER_SETUP_URL).pipe(Effect$1.mapError((cause) => new TestRunnerFailed({
|
|
743
753
|
runnerName: "vitest",
|
|
744
754
|
phase: "init",
|
|
745
755
|
cause: errorToString(cause)
|
|
746
756
|
})));
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
757
|
+
yield* fsService.copyFile(input.setupFilePath ?? defaultSetupPath, localSetupFile).pipe(Effect$1.mapError((cause) => new TestRunnerFailed({
|
|
758
|
+
runnerName: "vitest",
|
|
759
|
+
phase: "init",
|
|
760
|
+
cause: errorToString(cause)
|
|
761
|
+
})));
|
|
762
|
+
const { createVitest, version } = yield* (input.resolveVitestFor ?? resolveVitest)(projectRoot).pipe(Effect$1.provideService(Module, moduleService), Effect$1.provideService(FileSystem.FileSystem, fsService), Effect$1.provideService(Path.Path, pathService), Effect$1.catchDefect((cause) => Effect$1.fail(new TestRunnerFailed({
|
|
763
|
+
runnerName: "vitest",
|
|
764
|
+
phase: "init",
|
|
765
|
+
cause: errorToString(cause)
|
|
766
|
+
}))));
|
|
756
767
|
const namespace = input.globalNamespace ?? INSTRUMENTER_CONSTANTS.NAMESPACE;
|
|
757
768
|
const scanDir = (() => {
|
|
758
769
|
if (typeof options.vitest.dir === "string") return pathService.resolve(projectRoot, options.vitest.dir);
|
|
@@ -803,7 +814,7 @@ const makeVitestRunnerLayer = (input) => Layer.effect(TestRunner, Effect$1.gen(f
|
|
|
803
814
|
return new TestRunnerFailed({
|
|
804
815
|
runnerName: "vitest",
|
|
805
816
|
phase: "init",
|
|
806
|
-
cause
|
|
817
|
+
cause: errorToString(cause)
|
|
807
818
|
});
|
|
808
819
|
})()));
|
|
809
820
|
const resetContext = Effect$1.gen(function* () {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@systemfsoftware/stryker-js-vitest-runner",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/systemfsoftware/systemfsoftware.git",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@systemfsoftware/effect-cell-types": "^5.0.2",
|
|
35
|
-
"@systemfsoftware/stryker-js": "^0.
|
|
35
|
+
"@systemfsoftware/stryker-js": "^0.2.0"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
38
|
"effect": "^4.0.0-rc.112",
|
|
@@ -50,9 +50,10 @@
|
|
|
50
50
|
"tsdown": "^0.22.14",
|
|
51
51
|
"typescript": "^7",
|
|
52
52
|
"vitest": "^4",
|
|
53
|
-
"@systemfsoftware/all": "^1.0
|
|
53
|
+
"@systemfsoftware/all": "^1.1.0",
|
|
54
54
|
"@systemfsoftware/effect-gherkin-spec": "^4.0.0",
|
|
55
55
|
"@systemfsoftware/oxlint-config": "^0.1.0",
|
|
56
|
+
"@systemfsoftware/stryker-js-platform-node": "^0.2.0",
|
|
56
57
|
"@systemfsoftware/tsconfig": "^1.3.3",
|
|
57
58
|
"@systemfsoftware/vitest-config": "^0.1.0"
|
|
58
59
|
},
|