@systemfsoftware/stryker-js-cli 6.0.0 → 7.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.
@@ -1,10 +1,11 @@
1
1
  import * as Effect from "effect/Effect";
2
2
  import * as Layer from "effect/Layer";
3
+ import * as Option from "effect/Option";
3
4
  import * as NodeChildProcessSpawner from "@effect/platform-node-shared/NodeChildProcessSpawner";
4
5
  import { ChildProcessCrashedError, WorkerEntries, WorkerLauncher } from "@systemfsoftware/stryker-js-engine";
5
- import * as FileSystem from "effect/FileSystem";
6
6
  import * as Match from "effect/Match";
7
7
  import * as Path from "effect/Path";
8
+ import * as FileSystem from "effect/FileSystem";
8
9
  import { NodeFileSystem, NodePath, NodeSocket } from "@effect/platform-node";
9
10
  import { Module } from "@systemfsoftware/stryker-js/Module";
10
11
  import * as ChildProcess from "effect/unstable/process/ChildProcess";
@@ -12,13 +13,14 @@ import * as ChildProcessSpawner from "effect/unstable/process/ChildProcessSpawne
12
13
  import * as RpcClient from "effect/unstable/rpc/RpcClient";
13
14
  import * as RpcSerialization from "effect/unstable/rpc/RpcSerialization";
14
15
  //#region src/platform/node.ts
16
+ const EMPTY_PATHS = [];
15
17
  const makeModuleRequire = (nodeModule, filename) => {
16
18
  const requireFrom = nodeModule.createRequire(filename);
17
19
  const requireFn = (request) => requireFrom(request);
18
- requireFn.resolve = (request, options) => {
19
- if (options === void 0) return requireFrom.resolve(request);
20
- return requireFrom.resolve(request, { paths: [...options.paths ?? []] });
21
- };
20
+ requireFn.resolve = (request, options) => Option.match(Option.fromUndefinedOr(options), {
21
+ onNone: () => requireFrom.resolve(request),
22
+ onSome: (present) => requireFrom.resolve(request, { paths: [...Option.getOrElse(Option.fromNullishOr(present.paths), () => EMPTY_PATHS)] })
23
+ });
22
24
  return requireFn;
23
25
  };
24
26
  /**
@@ -1,10 +1,10 @@
1
- import { t as nodeModuleLayer } from "../node-D-ynY_kk.mjs";
1
+ import { t as nodeModuleLayer } from "../node-B7U4hEuW.mjs";
2
2
  import { n as workerSocketPath, t as launchWorker } from "../worker-runtime-CT5LMMgY.mjs";
3
3
  import * as Effect from "effect/Effect";
4
4
  import * as Layer from "effect/Layer";
5
- import * as FileSystem from "effect/FileSystem";
6
5
  import * as Option from "effect/Option";
7
6
  import * as Path from "effect/Path";
7
+ import * as FileSystem from "effect/FileSystem";
8
8
  import { NodeFileSystem, NodePath, NodeSocketServer } from "@effect/platform-node";
9
9
  import * as RpcSerialization from "effect/unstable/rpc/RpcSerialization";
10
10
  import { Checker, CheckerFailed } from "@systemfsoftware/stryker-js/Checker";
@@ -1,34 +1,45 @@
1
- import { t as nodeModuleLayer } from "../node-D-ynY_kk.mjs";
1
+ import { t as nodeModuleLayer } from "../node-B7U4hEuW.mjs";
2
2
  import { n as workerSocketPath, t as launchWorker } from "../worker-runtime-CT5LMMgY.mjs";
3
3
  import * as Effect from "effect/Effect";
4
4
  import * as Layer from "effect/Layer";
5
+ import * as Option from "effect/Option";
5
6
  import { errorToString } from "@systemfsoftware/stryker-js/Mutant";
6
7
  import * as Cause from "effect/Cause";
7
- import * as FileSystem from "effect/FileSystem";
8
8
  import * as Path from "effect/Path";
9
+ import * as FileSystem from "effect/FileSystem";
9
10
  import { NodeFileSystem, NodePath, NodeSocketServer } from "@effect/platform-node";
10
11
  import * as RpcSerialization from "effect/unstable/rpc/RpcSerialization";
11
12
  import { RunConfiguration, SandboxDirectory } from "@systemfsoftware/stryker-js/Plugin";
12
13
  import * as RpcServer from "effect/unstable/rpc/RpcServer";
13
14
  import { MutantCoverageSchema, TestRunnerRpcs, create, decodeWorkerOptions, loadPlugins } from "@systemfsoftware/stryker-js-engine/worker";
14
15
  import { TestRunner, TestRunnerFailed } from "@systemfsoftware/stryker-js/TestRunner";
15
- import { Schema } from "effect";
16
+ import { Match, Schema } from "effect";
16
17
  //#region src/workers/child-process-test-runner-worker.ts
17
- const withCoverage = (result, options) => Effect.gen(function* () {
18
+ const isCompleteDryRun = (result) => result.status === "complete";
19
+ const COVERAGE_SETTLED = [
20
+ (result) => result.status !== "complete",
21
+ (result) => Option.exists(Option.liftPredicate(result, isCompleteDryRun), (complete) => complete.mutantCoverage !== void 0),
22
+ (_result, options) => options.coverageAnalysis === "off"
23
+ ];
24
+ const coverageNeeded = (result, options) => !COVERAGE_SETTLED.some((settled) => settled(result, options));
25
+ const normalizeDryRun = (result) => {
18
26
  if (result.status === "error") return {
19
27
  ...result,
20
28
  errorMessage: errorToString(result.errorMessage)
21
29
  };
22
- if (result.status !== "complete") return result;
23
- if (result.mutantCoverage !== void 0) return result;
24
- if (options.coverageAnalysis === "off") return result;
30
+ return result;
31
+ };
32
+ const decodeCoverageInto = (result) => Effect.gen(function* () {
25
33
  const decoded = yield* Schema.decodeUnknownEffect(Schema.optional(MutantCoverageSchema))(globalThis.__mutantCoverage__).pipe(Effect.orElseSucceed(() => void 0));
26
- if (decoded === void 0) return result;
27
- return {
28
- ...result,
29
- mutantCoverage: decoded
30
- };
34
+ return Option.match(Option.liftPredicate(result, isCompleteDryRun), {
35
+ onNone: () => normalizeDryRun(result),
36
+ onSome: (complete) => Option.getOrElse(Option.map(Option.fromUndefinedOr(decoded), (coverage) => ({
37
+ ...complete,
38
+ mutantCoverage: coverage
39
+ })), () => complete)
40
+ });
31
41
  });
42
+ const withCoverage = (result, options) => Match.value(coverageNeeded(result, options)).pipe(Match.when(true, () => decodeCoverageInto(result)), Match.when(false, () => Effect.succeed(normalizeDryRun(result))), Match.exhaustive);
32
43
  const normalizeMutantRun = (result) => {
33
44
  if (result.status === "error") return {
34
45
  ...result,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@systemfsoftware/stryker-js-cli",
3
- "version": "6.0.0",
3
+ "version": "7.0.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/systemfsoftware/systemfsoftware.git",
@@ -14,37 +14,36 @@
14
14
  "dist"
15
15
  ],
16
16
  "dependencies": {
17
- "@effect/platform-node": "^4.0.0-rc.112",
18
- "@effect/platform-node-shared": "^4.0.0-rc.112",
17
+ "@effect/platform-node": "4.0.0-rc.112",
18
+ "@effect/platform-node-shared": "4.0.0-rc.112",
19
19
  "@noble/hashes": "1.8.0",
20
- "effect": "^4.0.0-rc.112",
21
- "@systemfsoftware/stryker-js": "^2.0.0",
22
- "@systemfsoftware/effect-cell-types": "^6.0.1",
23
- "@systemfsoftware/stryker-js-html-reporter": "^2.0.0",
24
- "@systemfsoftware/stryker-js-engine": "^1.0.0"
20
+ "effect": "4.0.0-rc.112",
21
+ "@systemfsoftware/effect-cell-types": "^7.0.0",
22
+ "@systemfsoftware/stryker-js-engine": "^2.0.1",
23
+ "@systemfsoftware/stryker-js": "^3.0.1",
24
+ "@systemfsoftware/stryker-js-html-reporter": "^3.0.1"
25
25
  },
26
26
  "devDependencies": {
27
27
  "@systemfsoftware/arethetypeswrong-cli": "^1.1.1",
28
28
  "@types/node": "^24",
29
29
  "@vitest/coverage-v8": "^4",
30
- "mutation-testing-report-schema": "3.7.3",
31
30
  "oxlint": "^1.77.0",
32
31
  "rimraf": "^6.1.3",
33
32
  "testcontainers": "^12.1.0",
34
33
  "tsdown": "^0.22.14",
35
34
  "vite-tsconfig-paths": "^6.1.1",
36
35
  "vitest": "^4",
37
- "@systemfsoftware/all": "^1.1.3",
36
+ "@systemfsoftware/all": "^2.0.0",
38
37
  "@systemfsoftware/effect-gherkin-spec": "^4.0.1",
39
- "@systemfsoftware/effect-schema-law": "^2.0.2",
40
- "@systemfsoftware/effect-schema-vite": "^2.0.3",
38
+ "@systemfsoftware/effect-schema-law": "^2.1.0",
39
+ "@systemfsoftware/effect-schema-vite": "^2.1.0",
41
40
  "@systemfsoftware/oxlint-config": "^0.1.0",
42
- "@systemfsoftware/stryker-js-typescript-checker": "^5.0.0",
43
- "@systemfsoftware/stryker-js-vitest-runner": "^4.0.0",
44
- "@systemfsoftware/stryker-plugins": "^3.0.0",
41
+ "@systemfsoftware/stryker-js-vitest-runner": "^4.0.2",
42
+ "@systemfsoftware/stryker-plugins": "^3.0.1",
43
+ "@systemfsoftware/stryker-test-contribution": "^2.0.1",
45
44
  "@systemfsoftware/tsconfig": "^1.3.3",
46
45
  "@systemfsoftware/vitest-config": "^0.1.0",
47
- "@systemfsoftware/stryker-test-contribution": "^2.0.0"
46
+ "@systemfsoftware/stryker-js-typescript-checker": "^5.0.2"
48
47
  },
49
48
  "engines": {
50
49
  "node": ">=20.0.0"