@fairfox/polly 0.91.0 → 0.92.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.
- package/dist/cli/polly.js +3 -3
- package/dist/cli/polly.js.map +3 -3
- package/dist/gallery/gallery.css +2 -2
- package/dist/gallery/gallery.js +248 -241
- package/dist/src/background/index.js +27 -11
- package/dist/src/background/index.js.map +2 -2
- package/dist/src/background/message-router.js +27 -11
- package/dist/src/background/message-router.js.map +2 -2
- package/dist/src/client/index.js +56 -56
- package/dist/src/client/index.js.map +4 -4
- package/dist/src/elysia/index.js +16 -7
- package/dist/src/elysia/index.js.map +4 -4
- package/dist/src/elysia/plugin.d.ts +4 -4
- package/dist/src/index.js +27 -11
- package/dist/src/index.js.map +2 -2
- package/dist/src/mesh.js +2 -2
- package/dist/src/mesh.js.map +3 -3
- package/dist/src/peer.js +6 -6
- package/dist/src/peer.js.map +3 -3
- package/dist/src/polly-ui/index.css +2 -2
- package/dist/src/polly-ui/markdown.js +1844 -1010
- package/dist/src/polly-ui/markdown.js.map +5 -5
- package/dist/src/polly-ui/styles.css +2 -2
- package/dist/src/shared/adapters/index.js +27 -11
- package/dist/src/shared/adapters/index.js.map +2 -2
- package/dist/src/shared/lib/context-helpers.js +27 -11
- package/dist/src/shared/lib/context-helpers.js.map +2 -2
- package/dist/src/shared/lib/message-bus.js +27 -11
- package/dist/src/shared/lib/message-bus.js.map +2 -2
- package/dist/src/shared/lib/resource.js +17 -1
- package/dist/src/shared/lib/resource.js.map +2 -2
- package/dist/src/shared/lib/state.js +17 -1
- package/dist/src/shared/lib/state.js.map +2 -2
- package/dist/src/shared/state/app-state.js +17 -1
- package/dist/src/shared/state/app-state.js.map +2 -2
- package/dist/tools/bdd/src/cli.js +20 -2
- package/dist/tools/bdd/src/cli.js.map +4 -4
- package/dist/tools/bdd/src/index.js +20 -2
- package/dist/tools/bdd/src/index.js.map +3 -3
- package/dist/tools/init/templates/pwa/package.json.template +2 -3
- package/dist/tools/mutate/src/args.d.ts +25 -3
- package/dist/tools/mutate/src/cli.js +3238 -312
- package/dist/tools/mutate/src/cli.js.map +32 -12
- package/dist/tools/mutate/src/config.d.ts +13 -2
- package/dist/tools/mutate/src/define.d.ts +76 -0
- package/dist/tools/mutate/src/engine/ast.d.ts +13 -0
- package/dist/tools/mutate/src/engine/baseline.d.ts +20 -0
- package/dist/tools/mutate/src/engine/cache.d.ts +32 -0
- package/dist/tools/mutate/src/engine/coverage.d.ts +60 -0
- package/dist/tools/mutate/src/engine/generate.d.ts +23 -0
- package/dist/tools/mutate/src/engine/graph.d.ts +11 -0
- package/dist/tools/mutate/src/engine/index.d.ts +16 -0
- package/dist/tools/mutate/src/engine/junit.d.ts +38 -0
- package/dist/tools/mutate/src/engine/operators.d.ts +14 -0
- package/dist/tools/mutate/src/engine/preload.d.ts +10 -0
- package/dist/tools/mutate/src/engine/preload.js +180 -0
- package/dist/tools/mutate/src/engine/preload.js.map +10 -0
- package/dist/tools/mutate/src/engine/probes.d.ts +12 -0
- package/dist/tools/mutate/src/engine/report-writer.d.ts +44 -0
- package/dist/tools/mutate/src/engine/runner.d.ts +31 -0
- package/dist/tools/mutate/src/engine/stray-writes.d.ts +25 -0
- package/dist/tools/mutate/src/engine/typecheck.d.ts +37 -0
- package/dist/tools/mutate/src/engine/types.d.ts +191 -0
- package/dist/tools/mutate/src/engine/verify-callsites.d.ts +9 -0
- package/dist/tools/mutate/src/engine/workdir.d.ts +16 -0
- package/dist/tools/mutate/src/engine-config.d.ts +7 -0
- package/dist/tools/mutate/src/index.d.ts +7 -3
- package/dist/tools/mutate/src/index.js +2821 -193
- package/dist/tools/mutate/src/index.js.map +26 -7
- package/dist/tools/mutate/src/ingest.d.ts +30 -1
- package/dist/tools/mutate/src/init.d.ts +2 -1
- package/dist/tools/mutate/src/migrate.d.ts +32 -0
- package/dist/tools/mutate/src/report.d.ts +3 -0
- package/dist/tools/mutate/src/run.d.ts +17 -8
- package/dist/tools/mutate/src/verify-matrix.d.ts +12 -15
- package/dist/tools/quality/src/cli.js +9 -9
- package/dist/tools/quality/src/cli.js.map +4 -4
- package/dist/tools/quality/src/index.js +9 -9
- package/dist/tools/quality/src/index.js.map +4 -4
- package/dist/tools/quality/src/no-tautology-ensures.d.ts +2 -2
- package/dist/tools/quality/src/plugins/import-checks.d.ts +1 -1
- package/dist/tools/test/src/adapters/index.js +3 -2
- package/dist/tools/test/src/adapters/index.js.map +3 -3
- package/dist/tools/test/src/coverage-policy/cli.d.ts +2 -2
- package/dist/tools/test/src/coverage-policy/cli.js +217 -17
- package/dist/tools/test/src/coverage-policy/cli.js.map +7 -5
- package/dist/tools/test/src/coverage-policy/index.d.ts +1 -1
- package/dist/tools/test/src/coverage-policy/index.js +213 -12
- package/dist/tools/test/src/coverage-policy/index.js.map +7 -5
- package/dist/tools/test/src/coverage-policy/mutate-targets.d.ts +29 -12
- package/dist/tools/test/src/e2e-mesh/index.js +6 -6
- package/dist/tools/test/src/e2e-mesh/index.js.map +4 -4
- package/dist/tools/test/src/e2e-relay/index.js +230 -226
- package/dist/tools/test/src/e2e-relay/index.js.map +7 -7
- package/dist/tools/test/src/index.js +3 -2
- package/dist/tools/test/src/index.js.map +3 -3
- package/dist/tools/test/src/visual/index.js +684 -511
- package/dist/tools/test/src/visual/index.js.map +11 -11
- package/dist/tools/verify/src/cli.js +17 -2
- package/dist/tools/verify/src/cli.js.map +4 -4
- package/dist/tools/verify/src/config.d.ts +1 -1
- package/dist/tools/verify/src/config.js +68 -3
- package/dist/tools/verify/src/config.js.map +4 -4
- package/dist/tools/verify/src/primitives/index.d.ts +34 -0
- package/dist/tools/visualize/src/cli.js +16 -1
- package/dist/tools/visualize/src/cli.js.map +3 -3
- package/package.json +29 -39
- package/dist/tools/verify/src/stryker/index.d.ts +0 -32
- package/dist/tools/verify/src/stryker/index.js +0 -86
- package/dist/tools/verify/src/stryker/index.js.map +0 -10
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Ingest a
|
|
2
|
+
* Ingest a mutation report (mutation-testing-report-schema) into a
|
|
3
3
|
* regenerable SQLite database holding the kill matrix.
|
|
4
4
|
*
|
|
5
5
|
* The tool consumes the *schema*, never a specific runner — so the same
|
|
@@ -16,6 +16,8 @@ export interface MutationReport {
|
|
|
16
16
|
testFiles?: Record<string, {
|
|
17
17
|
tests: TestDef[];
|
|
18
18
|
}>;
|
|
19
|
+
/** Written by the bun engine; absent from Stryker-era reports. */
|
|
20
|
+
contracts?: ReportContracts;
|
|
19
21
|
}
|
|
20
22
|
interface Mutant {
|
|
21
23
|
id: string;
|
|
@@ -29,6 +31,33 @@ interface Mutant {
|
|
|
29
31
|
};
|
|
30
32
|
killedBy?: string[];
|
|
31
33
|
coveredBy?: string[];
|
|
34
|
+
/** Contract ids (`<file>:<line>`) a killing test's failure named. */
|
|
35
|
+
killedByContract?: string[];
|
|
36
|
+
/** Every killer failed through a contract: no assertion caught the mutant. */
|
|
37
|
+
contractOnly?: boolean;
|
|
38
|
+
}
|
|
39
|
+
/** The engine's contracts block: how the run enforced requires/ensures, and what it found. */
|
|
40
|
+
export interface ReportContracts {
|
|
41
|
+
mode: "off" | "ensures" | "all";
|
|
42
|
+
runner: "bun-test" | "command";
|
|
43
|
+
sites: ContractSiteDef[];
|
|
44
|
+
violations: {
|
|
45
|
+
target: string;
|
|
46
|
+
test: string;
|
|
47
|
+
contracts: string[];
|
|
48
|
+
}[];
|
|
49
|
+
}
|
|
50
|
+
export interface ContractSiteDef {
|
|
51
|
+
/** `<file>:<line>`, what `killedByContract` holds. */
|
|
52
|
+
id: string;
|
|
53
|
+
file: string;
|
|
54
|
+
line: number;
|
|
55
|
+
primitive: "requires" | "ensures";
|
|
56
|
+
message?: string;
|
|
57
|
+
handler?: {
|
|
58
|
+
from: number;
|
|
59
|
+
to: number;
|
|
60
|
+
};
|
|
32
61
|
}
|
|
33
62
|
interface TestDef {
|
|
34
63
|
id: string;
|
|
@@ -2,7 +2,8 @@ export interface InitResult {
|
|
|
2
2
|
configPath: string;
|
|
3
3
|
/** false when a config already existed and --force was not passed. */
|
|
4
4
|
created: boolean;
|
|
5
|
-
|
|
5
|
+
/** Where `defineMutation` is imported from. */
|
|
6
|
+
specifier: string;
|
|
6
7
|
mutate: string[];
|
|
7
8
|
testGlob: string;
|
|
8
9
|
warnings: string[];
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type MutationConfig } from "./define.ts";
|
|
2
|
+
export interface Migration {
|
|
3
|
+
config: MutationConfig;
|
|
4
|
+
notes: string[];
|
|
5
|
+
}
|
|
6
|
+
/** `--preload <p>` / `--preload=<p>` values from the bun runner's `nodeArgs`, as written. */
|
|
7
|
+
export declare function preloadArgs(nodeArgs: string[]): string[];
|
|
8
|
+
/** A Stryker command string as argv; anything shell-shaped goes through `sh -c`. */
|
|
9
|
+
export declare function commandArgv(command: string): string[];
|
|
10
|
+
/** Map a parsed Stryker config to a `MutationConfig`, with a note per dropped key. */
|
|
11
|
+
export declare function strykerToMutation(raw: unknown, where: string): Migration;
|
|
12
|
+
export declare function readStrykerConfig(path: string): Promise<Migration>;
|
|
13
|
+
/**
|
|
14
|
+
* The specifier a config in `dir` imports `defineMutation` from: the package
|
|
15
|
+
* export when it resolves there, else this source tree's own module (polly's
|
|
16
|
+
* monorepo root has no `@fairfox/polly` in its node_modules).
|
|
17
|
+
*/
|
|
18
|
+
export declare function defineImportSpecifier(dir: string): string;
|
|
19
|
+
export declare function renderMutationConfig(config: MutationConfig, specifier: string): string;
|
|
20
|
+
export interface MigrateResult {
|
|
21
|
+
/** Where the config goes (next to the Stryker config). */
|
|
22
|
+
path: string;
|
|
23
|
+
source: string;
|
|
24
|
+
notes: string[];
|
|
25
|
+
/** false when `write` was off or a config was already there without `force`. */
|
|
26
|
+
written: boolean;
|
|
27
|
+
existed: boolean;
|
|
28
|
+
}
|
|
29
|
+
export declare function migrateConfig(strykerPath: string, opts?: {
|
|
30
|
+
write?: boolean;
|
|
31
|
+
force?: boolean;
|
|
32
|
+
}): Promise<MigrateResult>;
|
|
@@ -5,6 +5,9 @@
|
|
|
5
5
|
* redundancy tests/files whose every kill is also caught elsewhere
|
|
6
6
|
* theatre covered-but-survived — code a test runs but no test detects
|
|
7
7
|
* (the Survived status under coverageAnalysis "all")
|
|
8
|
+
* contracts (bun engine, contracts on) mutants only a requires/ensures
|
|
9
|
+
* caught, kills per contract, and contracts whose handler was
|
|
10
|
+
* exercised yet never fired — a contract without teeth
|
|
8
11
|
*
|
|
9
12
|
* Redundancy is reported at BOTH file and case level. Decisions are keyed at
|
|
10
13
|
* file level (stable identity); case level is the drill-down.
|
|
@@ -1,11 +1,20 @@
|
|
|
1
|
+
import type { MutateArgs } from "./args.ts";
|
|
1
2
|
import type { MutateConfig } from "./config.ts";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
import type { EngineResult } from "./engine/types.ts";
|
|
4
|
+
/** `--engine` survives for scripts that pass `--engine bun`; Stryker is gone. */
|
|
5
|
+
export declare function resolveEngine(args: MutateArgs): "bun";
|
|
6
|
+
/** The notice printed when the bun engine reads a Stryker config; null for polly.mutate.ts. */
|
|
7
|
+
export declare function deprecationNotice(cfg: MutateConfig): string | null;
|
|
8
|
+
/** `thresholds.break` failure line, or null when the score clears it (or none is set). */
|
|
9
|
+
export declare function thresholdFailure(score: number | null, cfg: MutateConfig): string | null;
|
|
10
|
+
/** Run the Bun-native engine and print a per-target summary. Returns the exit code. */
|
|
11
|
+
export declare function runBunEngine(cfg: MutateConfig, args: MutateArgs): Promise<number>;
|
|
6
12
|
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
13
|
+
* The block printed when a baseline failed through a contract: the unmutated
|
|
14
|
+
* code, under one of its own tests, falsified a requires/ensures. That is a
|
|
15
|
+
* finding about the test or the handler, not about any mutant, so the run
|
|
16
|
+
* stops instead of scoring the target.
|
|
10
17
|
*/
|
|
11
|
-
export declare function
|
|
18
|
+
export declare function contractViolationsBlock(result: EngineResult, cwd: string): string;
|
|
19
|
+
/** Build the useless-test report from an existing mutation.json (no engine run). */
|
|
20
|
+
export declare function reportFromFile(cfg: MutateConfig): Promise<string>;
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Verification artefact for the kill-matrix contract.
|
|
3
3
|
*
|
|
4
|
-
* The whole useless-test analysis rests on one fact:
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
4
|
+
* The whole useless-test analysis rests on one fact: matrix mode emits a
|
|
5
|
+
* COMPLETE kill matrix — every test that detects a mutant appears in killedBy,
|
|
6
|
+
* not just the first. That depends on Bun's junit output (engine/junit.ts). A
|
|
7
|
+
* Bun upgrade that changes it, or a `--bail` that creeps back into matrix runs,
|
|
8
|
+
* would silently collapse killedBy to one id each — a green board with the
|
|
9
|
+
* redundancy signal quietly dead (the classic trap).
|
|
10
10
|
*
|
|
11
11
|
* `verifyMatrix` runs the full contract and returns the result; `isMatrixComplete`
|
|
12
12
|
* is the side-effect-free gate the report path consults to decide whether the
|
|
13
13
|
* redundancy/subsumption sections are trustworthy. Run the CLI form after any
|
|
14
|
-
*
|
|
14
|
+
* Bun bump:
|
|
15
15
|
*
|
|
16
16
|
* polly mutate verify # uses the existing report
|
|
17
|
-
* polly mutate verify --run # runs
|
|
17
|
+
* polly mutate verify --run # runs the engine in matrix mode first
|
|
18
18
|
*/
|
|
19
19
|
import { type MutationReport } from "./ingest.ts";
|
|
20
20
|
export interface MatrixCheck {
|
|
@@ -28,7 +28,7 @@ export interface MatrixCheck {
|
|
|
28
28
|
/**
|
|
29
29
|
* Side-effect-free gate: is the kill matrix trustworthy for redundancy /
|
|
30
30
|
* subsumption analysis? True only when
|
|
31
|
-
* (a) some killed mutant has >1 killer — proof the no-bail
|
|
31
|
+
* (a) some killed mutant has >1 killer — proof the no-bail matrix run
|
|
32
32
|
* recorded EVERY killer, not just the first (verifyMatrix check #4), and
|
|
33
33
|
* (b) coverage was collected — not every mutant is NoCoverage, which would
|
|
34
34
|
* mean the coverage dump broke (verifyMatrix check #5).
|
|
@@ -37,13 +37,10 @@ export interface MatrixCheck {
|
|
|
37
37
|
*/
|
|
38
38
|
export declare function isMatrixComplete(report: MutationReport): boolean;
|
|
39
39
|
/**
|
|
40
|
-
* Run the full kill-matrix contract (all five checks)
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
* exit code.
|
|
40
|
+
* Run the full kill-matrix contract (all five checks) on a report. Returns the
|
|
41
|
+
* result rather than exiting, so callers decide what to do with it.
|
|
42
|
+
* `polly mutate verify --run` writes a fresh matrix-mode report first.
|
|
44
43
|
*/
|
|
45
44
|
export declare function verifyMatrix(opts?: {
|
|
46
45
|
reportPath?: string;
|
|
47
|
-
run?: boolean;
|
|
48
|
-
strykerConfig?: string;
|
|
49
46
|
}): Promise<MatrixCheck>;
|
|
@@ -2643,9 +2643,9 @@ var noRawHttp = {
|
|
|
2643
2643
|
return { ok: violations.length === 0, messages: violations };
|
|
2644
2644
|
}
|
|
2645
2645
|
};
|
|
2646
|
-
async function
|
|
2647
|
-
const proc = Bun.spawn(["
|
|
2648
|
-
cwd:
|
|
2646
|
+
async function runTypecheckFor(packagePath) {
|
|
2647
|
+
const proc = Bun.spawn(["bun", "--check"], {
|
|
2648
|
+
cwd: packagePath,
|
|
2649
2649
|
stdout: "pipe",
|
|
2650
2650
|
stderr: "pipe"
|
|
2651
2651
|
});
|
|
@@ -2668,7 +2668,7 @@ async function findWorkspaces(rootDir, patterns) {
|
|
|
2668
2668
|
}
|
|
2669
2669
|
var types = {
|
|
2670
2670
|
id: "polly:types",
|
|
2671
|
-
description: "Run `
|
|
2671
|
+
description: "Run `bun check` (tsc-compatible) against each workspace package in parallel",
|
|
2672
2672
|
filesRead: async () => {
|
|
2673
2673
|
return [];
|
|
2674
2674
|
},
|
|
@@ -2677,12 +2677,12 @@ var types = {
|
|
|
2677
2677
|
const packages = await findWorkspaces(rootDir, patterns);
|
|
2678
2678
|
if (packages.length === 0)
|
|
2679
2679
|
return { ok: true, messages: ["no workspace packages found"] };
|
|
2680
|
-
const results = await Promise.all(packages.map((p) =>
|
|
2680
|
+
const results = await Promise.all(packages.map((p) => runTypecheckFor(p)));
|
|
2681
2681
|
return aggregateTypesResults(packages, results, rootDir);
|
|
2682
2682
|
}
|
|
2683
2683
|
};
|
|
2684
|
-
function
|
|
2685
|
-
messages.push(`${relPkg}:
|
|
2684
|
+
function appendTypecheckFailure(messages, relPkg, output) {
|
|
2685
|
+
messages.push(`${relPkg}: bun check failed`);
|
|
2686
2686
|
const trimmed = output.trim();
|
|
2687
2687
|
if (!trimmed)
|
|
2688
2688
|
return;
|
|
@@ -2699,7 +2699,7 @@ function aggregateTypesResults(packages, results, rootDir) {
|
|
|
2699
2699
|
if (!pkg || !r || r.ok)
|
|
2700
2700
|
continue;
|
|
2701
2701
|
ok = false;
|
|
2702
|
-
|
|
2702
|
+
appendTypecheckFailure(messages, relative6(rootDir, pkg) || ".", r.output);
|
|
2703
2703
|
}
|
|
2704
2704
|
return { ok, messages };
|
|
2705
2705
|
}
|
|
@@ -3333,4 +3333,4 @@ switch (subcommand) {
|
|
|
3333
3333
|
}
|
|
3334
3334
|
process.exit(exitCode);
|
|
3335
3335
|
|
|
3336
|
-
//# debugId=
|
|
3336
|
+
//# debugId=E090B73AFCD635EC64756E2164756E21
|