@isentinel/jest-roblox 0.3.2 → 0.3.4
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/README.md +160 -156
- package/dist/cli.d.mts +1 -1
- package/dist/cli.mjs +1 -1
- package/dist/index.d.mts +293 -6
- package/dist/index.mjs +84 -2
- package/dist/{run-CyHhajiY.mjs → run-D20euZYa.mjs} +3961 -2926
- package/dist/{schema-BpjBo-Aw.d.mts → schema-BCTnsaiC.d.mts} +68 -21
- package/package.json +24 -16
- package/plugin/JestRobloxRunner.rbxm +0 -0
- package/dist/sea-entry.cjs +0 -43018
package/dist/index.d.mts
CHANGED
|
@@ -1,9 +1,112 @@
|
|
|
1
|
-
import { _ as SnapshotFormatOptions, a as DisplayName, b as defineProject, c as GlobalTestConfig, d as ProjectEntry, f as ProjectTestConfig, g as SharedTestConfig, h as SHARED_TEST_KEYS, i as DEFAULT_CONFIG, l as InlineProjectConfig, m as ResolvedConfig, n as Config, o as FormatterEntry, p as ROOT_CLI_KEYS, r as ConfigInput, s as GLOBAL_TEST_KEYS, t as CliOptions, u as JEST_ARGV_EXCLUDED_KEYS, v as WorkspaceConfig, y as defineConfig } from "./schema-
|
|
1
|
+
import { _ as SnapshotFormatOptions, a as DisplayName, b as defineProject, c as GlobalTestConfig, d as ProjectEntry, f as ProjectTestConfig, g as SharedTestConfig, h as SHARED_TEST_KEYS, i as DEFAULT_CONFIG, l as InlineProjectConfig, m as ResolvedConfig, n as Config, o as FormatterEntry, p as ROOT_CLI_KEYS, r as ConfigInput, s as GLOBAL_TEST_KEYS, t as CliOptions, u as JEST_ARGV_EXCLUDED_KEYS, v as WorkspaceConfig, x as TypecheckConfig, y as defineConfig } from "./schema-BCTnsaiC.mjs";
|
|
2
2
|
import { type } from "arktype";
|
|
3
3
|
import { WebSocket, WebSocketServer } from "ws";
|
|
4
4
|
import { StorageClient } from "@bedrock-rbx/ocale/storage";
|
|
5
5
|
|
|
6
|
-
//#region src/coverage/
|
|
6
|
+
//#region src/coverage-pipeline/build-manifest.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* On-disk format version for `build-manifest.json`. Independent of
|
|
9
|
+
* `MANIFEST_VERSION` (the coverage manifest's version) — the two siblings
|
|
10
|
+
* version separately and are cross-linked by `buildId`.
|
|
11
|
+
*/
|
|
12
|
+
declare const BUILD_MANIFEST_VERSION: 1;
|
|
13
|
+
interface BuildManifestProject {
|
|
14
|
+
displayName: string;
|
|
15
|
+
jestDataModelPath?: string;
|
|
16
|
+
projectDataModelPath: string;
|
|
17
|
+
setupFiles: Array<string>;
|
|
18
|
+
setupFilesAfterEnv: Array<string>;
|
|
19
|
+
testMatch: Array<string>;
|
|
20
|
+
}
|
|
21
|
+
interface BuildManifestFileRecord {
|
|
22
|
+
sourceHash: string;
|
|
23
|
+
}
|
|
24
|
+
interface BuildManifestArtifact {
|
|
25
|
+
hash: string;
|
|
26
|
+
path: string;
|
|
27
|
+
}
|
|
28
|
+
interface BuildManifest {
|
|
29
|
+
/** Shared UUID linking this manifest to its sibling `CoverageManifest`. */
|
|
30
|
+
buildId: string;
|
|
31
|
+
/**
|
|
32
|
+
* The uninstrumented place a consumer mutates and runs against. Present only
|
|
33
|
+
* when produced by `prepareArtifacts`; `runJestRoblox` / the CLI never build
|
|
34
|
+
* one, so coverage-only manifests omit it.
|
|
35
|
+
*/
|
|
36
|
+
cleanPlace?: BuildManifestArtifact;
|
|
37
|
+
/** The coverage-instrumented place — the only source of coverage hit data. */
|
|
38
|
+
coveragePlace: BuildManifestArtifact;
|
|
39
|
+
/** SHA-256 of each compiled `.luau`, keyed by package-relative POSIX path. */
|
|
40
|
+
files: Record<string, BuildManifestFileRecord>;
|
|
41
|
+
generatedAt: string;
|
|
42
|
+
projects: Array<BuildManifestProject>;
|
|
43
|
+
version: typeof BUILD_MANIFEST_VERSION;
|
|
44
|
+
}
|
|
45
|
+
type ReadBuildManifestResult = {
|
|
46
|
+
actual: string;
|
|
47
|
+
expected: string;
|
|
48
|
+
kind: "buildid-mismatch";
|
|
49
|
+
} | {
|
|
50
|
+
actual: string;
|
|
51
|
+
expected: string;
|
|
52
|
+
kind: "clean-place-hash-mismatch";
|
|
53
|
+
path: string;
|
|
54
|
+
} | {
|
|
55
|
+
actual: string;
|
|
56
|
+
expected: string;
|
|
57
|
+
kind: "coverage-place-hash-mismatch";
|
|
58
|
+
path: string;
|
|
59
|
+
} | {
|
|
60
|
+
actual: string;
|
|
61
|
+
expected: string;
|
|
62
|
+
kind: "source-drift";
|
|
63
|
+
path: string;
|
|
64
|
+
} | {
|
|
65
|
+
actual: unknown;
|
|
66
|
+
expected: number;
|
|
67
|
+
kind: "version-mismatch";
|
|
68
|
+
} | {
|
|
69
|
+
kind: "invalid";
|
|
70
|
+
summary: string;
|
|
71
|
+
} | {
|
|
72
|
+
kind: "malformed-json";
|
|
73
|
+
} | {
|
|
74
|
+
kind: "missing";
|
|
75
|
+
} | {
|
|
76
|
+
kind: "missing-referenced-artifact";
|
|
77
|
+
path: string;
|
|
78
|
+
} | {
|
|
79
|
+
kind: "ok";
|
|
80
|
+
manifest: BuildManifest;
|
|
81
|
+
};
|
|
82
|
+
interface ReadBuildManifestOptions {
|
|
83
|
+
/** When set, refuse if the manifest's `buildId` differs from this value. */
|
|
84
|
+
expectedBuildId?: string;
|
|
85
|
+
/** Base for resolving place paths and `files` keys when re-hashing. */
|
|
86
|
+
rootDir?: string;
|
|
87
|
+
}
|
|
88
|
+
declare const buildManifestSchema: type<BuildManifest>;
|
|
89
|
+
/**
|
|
90
|
+
* The producer-side build record an entry point emits after a coverage run.
|
|
91
|
+
* `prepareCoverage` returns this so `runJestRoblox` and `prepareArtifacts` can
|
|
92
|
+
* each write the Build Manifest with the place set they actually have.
|
|
93
|
+
*/
|
|
94
|
+
interface CoverageArtifacts {
|
|
95
|
+
buildId: string;
|
|
96
|
+
coveragePlace: BuildManifestArtifact;
|
|
97
|
+
files: Record<string, BuildManifestFileRecord>;
|
|
98
|
+
generatedAt: string;
|
|
99
|
+
/**
|
|
100
|
+
* Per-project DataModel paths the kernel consumes, resolved by the run path
|
|
101
|
+
* that built the place. Empty when the run resolved no projects.
|
|
102
|
+
*/
|
|
103
|
+
projects: Array<BuildManifestProject>;
|
|
104
|
+
/** `false` on the incremental no-change reuse path. */
|
|
105
|
+
rebuilt: boolean;
|
|
106
|
+
}
|
|
107
|
+
declare function readBuildManifest(filePath: string, options?: ReadBuildManifestOptions): ReadBuildManifestResult;
|
|
108
|
+
//#endregion
|
|
109
|
+
//#region src/coverage-pipeline/types.d.ts
|
|
7
110
|
/**
|
|
8
111
|
* Raw hit counts for a single file, keyed by statement/function index.
|
|
9
112
|
*/
|
|
@@ -16,6 +119,44 @@ interface RawFileCoverage {
|
|
|
16
119
|
* Raw coverage data for all files, keyed by original Luau-relative path.
|
|
17
120
|
*/
|
|
18
121
|
type RawCoverageData = Record<string, RawFileCoverage>;
|
|
122
|
+
/**
|
|
123
|
+
* One Jest test case's coverage delta, as the Luau runner harvested it: the
|
|
124
|
+
* statements (keyed by original Luau-relative path) whose hit count rose while
|
|
125
|
+
* that test ran. Produced by the parser from the run envelope, consumed by the
|
|
126
|
+
* per-test attribution harvester.
|
|
127
|
+
*/
|
|
128
|
+
interface PerTestCoverageEntry {
|
|
129
|
+
delta: Record<string, {
|
|
130
|
+
s: Array<number>;
|
|
131
|
+
}>;
|
|
132
|
+
testCaseId: string;
|
|
133
|
+
testFilePath: string;
|
|
134
|
+
}
|
|
135
|
+
//#endregion
|
|
136
|
+
//#region src/artifacts/prepare-artifacts.d.ts
|
|
137
|
+
/**
|
|
138
|
+
* Everything a consumer (mutation-tester, `flux`) needs from one artifact-
|
|
139
|
+
* production run: the two distinct places, the coverage hit data, and the paths
|
|
140
|
+
* of the sibling manifests, all sharing one `buildId`.
|
|
141
|
+
*/
|
|
142
|
+
interface ArtifactBundle {
|
|
143
|
+
buildId: string;
|
|
144
|
+
buildManifestPath: string;
|
|
145
|
+
cleanPlace: BuildManifestArtifact;
|
|
146
|
+
coverageData?: RawCoverageData;
|
|
147
|
+
coverageManifestPath: string;
|
|
148
|
+
coveragePlace: BuildManifestArtifact;
|
|
149
|
+
/** Per-project DataModel paths the kernel consumes, resolved from the run. */
|
|
150
|
+
projects: Array<BuildManifestProject>;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* The sole producer of a Clean Place. Builds the Coverage-Instrumented Place and
|
|
154
|
+
* runs the instrumented suite once (via the shared single/multi core), builds an
|
|
155
|
+
* uninstrumented Clean Place through the Place Builder, then emits the Build
|
|
156
|
+
* Manifest with both places in a single atomic write. `runJestRoblox` / the CLI
|
|
157
|
+
* never build a Clean Place — opting in is calling this entry point.
|
|
158
|
+
*/
|
|
159
|
+
declare function prepareArtifacts(config: ResolvedConfig): Promise<ArtifactBundle>;
|
|
19
160
|
//#endregion
|
|
20
161
|
//#region src/memory-store/sorted-map-client.d.ts
|
|
21
162
|
/**
|
|
@@ -98,6 +239,7 @@ type SnapshotWrites = Record<string, string>;
|
|
|
98
239
|
interface ParseResult {
|
|
99
240
|
coverageData?: RawCoverageData;
|
|
100
241
|
luauTiming?: Record<string, number>;
|
|
242
|
+
perTestCoverage?: Array<PerTestCoverageEntry>;
|
|
101
243
|
result: JestResult;
|
|
102
244
|
setupSeconds?: number;
|
|
103
245
|
snapshotWrites?: SnapshotWrites;
|
|
@@ -305,6 +447,12 @@ interface ResolvedProjectConfig {
|
|
|
305
447
|
config: ResolvedConfig;
|
|
306
448
|
displayColor?: string;
|
|
307
449
|
displayName: string;
|
|
450
|
+
/**
|
|
451
|
+
* Root-prefixed `exclude` globs subtracted from Runtime Test discovery.
|
|
452
|
+
* Optional on the public type (back-compat for external constructors);
|
|
453
|
+
* `resolveProjectConfig` always populates it (defaulting to `[]`).
|
|
454
|
+
*/
|
|
455
|
+
exclude?: Array<string>;
|
|
308
456
|
/** Original include patterns (with TS extensions) for filesystem discovery. */
|
|
309
457
|
include: Array<string>;
|
|
310
458
|
/**
|
|
@@ -320,6 +468,123 @@ interface ResolvedProjectConfig {
|
|
|
320
468
|
rojoMounts: Array<Mount>;
|
|
321
469
|
/** Luau-side testMatch patterns (extensions stripped). */
|
|
322
470
|
testMatch: Array<string>;
|
|
471
|
+
/** Raw per-project `test.typecheck`, merged via `resolveTypecheckConfig`. */
|
|
472
|
+
typecheck?: TypecheckConfig;
|
|
473
|
+
}
|
|
474
|
+
//#endregion
|
|
475
|
+
//#region src/utils/hash.d.ts
|
|
476
|
+
/**
|
|
477
|
+
* SHA-256 of a file's raw bytes. The canonical helper for recording and
|
|
478
|
+
* re-verifying artifact hashes — reads the file as a buffer so the digest
|
|
479
|
+
* matches `hashBuffer` of the same content regardless of encoding.
|
|
480
|
+
*/
|
|
481
|
+
declare function hashFile(filePath: string): string;
|
|
482
|
+
//#endregion
|
|
483
|
+
//#region src/coverage-pipeline/manifest-parse.d.ts
|
|
484
|
+
/**
|
|
485
|
+
* Shared read result for the sibling manifest readers. `BuildManifest`'s reader
|
|
486
|
+
* extends this with artifact-rehash variants after a successful parse.
|
|
487
|
+
*/
|
|
488
|
+
type ParsedManifest<T> = {
|
|
489
|
+
actual: unknown;
|
|
490
|
+
expected: number;
|
|
491
|
+
kind: "version-mismatch";
|
|
492
|
+
} | {
|
|
493
|
+
kind: "invalid";
|
|
494
|
+
summary: string;
|
|
495
|
+
} | {
|
|
496
|
+
kind: "malformed-json";
|
|
497
|
+
} | {
|
|
498
|
+
kind: "missing";
|
|
499
|
+
} | {
|
|
500
|
+
kind: "ok";
|
|
501
|
+
manifest: T;
|
|
502
|
+
};
|
|
503
|
+
//#endregion
|
|
504
|
+
//#region src/coverage-pipeline/manifest.d.ts
|
|
505
|
+
/**
|
|
506
|
+
* On-disk format version for `coverage-manifest.json`. Bump when the schema
|
|
507
|
+
* below changes shape; `INSTRUMENTER_VERSION` is independent and tracks
|
|
508
|
+
* probe-output compatibility (cache invalidation), not file format.
|
|
509
|
+
*
|
|
510
|
+
* The in-process `CollectorResult` contract between coverage-collector and
|
|
511
|
+
* probe-inserter is intentionally not formalized here: it has no serialization
|
|
512
|
+
* boundary, so the TypeScript interface is sufficient.
|
|
513
|
+
*/
|
|
514
|
+
declare const MANIFEST_VERSION: 3;
|
|
515
|
+
interface InstrumentedFileRecord {
|
|
516
|
+
key: string;
|
|
517
|
+
branchCount?: number;
|
|
518
|
+
coverageMapPath: string;
|
|
519
|
+
/**
|
|
520
|
+
* Per-statement attribution: maps a Luau statement id (the probe index, same
|
|
521
|
+
* key space as the coverage-map sidecar) to the ids of the tests that covered
|
|
522
|
+
* it. Populated after a coverage run by the per-test attribution harvester;
|
|
523
|
+
* absent on a freshly-instrumented manifest (no run yet).
|
|
524
|
+
*/
|
|
525
|
+
coveringTestIds?: Record<string, Array<string>>;
|
|
526
|
+
functionCount?: number;
|
|
527
|
+
instrumentedLuauPath: string;
|
|
528
|
+
originalLuauPath: string;
|
|
529
|
+
sourceHash: string;
|
|
530
|
+
sourceMapPath: string;
|
|
531
|
+
statementCount: number;
|
|
532
|
+
}
|
|
533
|
+
/**
|
|
534
|
+
* One Jest test case's identity, recorded so Phase 3's differential cache can
|
|
535
|
+
* key on which tests cover a mutant and whether their source changed.
|
|
536
|
+
* `coveringTestIds` references these by `testId`.
|
|
537
|
+
*/
|
|
538
|
+
interface TestRecord {
|
|
539
|
+
/** Full test name (describe chain + leaf `it`). */
|
|
540
|
+
testCaseId: string;
|
|
541
|
+
/** The test file's DataModel path, as the runner observed it. */
|
|
542
|
+
testFilePath: string;
|
|
543
|
+
/** SHA-256 of the test file's source, for cache invalidation. */
|
|
544
|
+
testFileSourceHash: string;
|
|
545
|
+
/** Stable unique id for the test case; referenced by `coveringTestIds`. */
|
|
546
|
+
testId: string;
|
|
547
|
+
}
|
|
548
|
+
interface NonInstrumentedFileRecord {
|
|
549
|
+
shadowPath: string;
|
|
550
|
+
sourceHash: string;
|
|
551
|
+
sourcePath: string;
|
|
552
|
+
}
|
|
553
|
+
interface CoverageManifest {
|
|
554
|
+
/** Shared UUID linking this manifest to its sibling `BuildManifest`. */
|
|
555
|
+
buildId: string;
|
|
556
|
+
files: Record<string, InstrumentedFileRecord>;
|
|
557
|
+
generatedAt: string;
|
|
558
|
+
instrumenterVersion: number;
|
|
559
|
+
luauRoots: Array<string>;
|
|
560
|
+
nonInstrumentedFiles: Record<string, NonInstrumentedFileRecord>;
|
|
561
|
+
placeFilePath?: string;
|
|
562
|
+
/**
|
|
563
|
+
* SHA-256 over every rojo build input OUTSIDE the luauRoots (non-luauRoot
|
|
564
|
+
* `$path` mounts plus the rojo project files), per `computeRojoInputsHash`.
|
|
565
|
+
* The incremental cache rebuilds the place when it drifts. Absent on manifests
|
|
566
|
+
* written before this field existed; a missing value is treated as changed so
|
|
567
|
+
* the next run repopulates it.
|
|
568
|
+
*/
|
|
569
|
+
rojoInputsHash?: string;
|
|
570
|
+
shadowDir: string;
|
|
571
|
+
/**
|
|
572
|
+
* Per-test attribution records, one per Jest test case that covered at least
|
|
573
|
+
* one statement. Populated by the harvester after a coverage run; absent on a
|
|
574
|
+
* freshly-instrumented manifest.
|
|
575
|
+
*/
|
|
576
|
+
tests?: Array<TestRecord>;
|
|
577
|
+
version: typeof MANIFEST_VERSION;
|
|
578
|
+
}
|
|
579
|
+
type ReadManifestResult = ParsedManifest<CoverageManifest>;
|
|
580
|
+
declare const manifestSchema: type<CoverageManifest>;
|
|
581
|
+
declare function readManifest(filePath: string): ReadManifestResult;
|
|
582
|
+
//#endregion
|
|
583
|
+
//#region src/coverage-pipeline/attribution.d.ts
|
|
584
|
+
interface AttributionResult {
|
|
585
|
+
/** Per Luau file: statement id → ids of the tests that covered it. */
|
|
586
|
+
coveringTestIds: Record<string, Record<string, Array<string>>>;
|
|
587
|
+
tests: Array<TestRecord>;
|
|
323
588
|
}
|
|
324
589
|
//#endregion
|
|
325
590
|
//#region src/source-mapper/index.d.ts
|
|
@@ -377,6 +642,7 @@ interface TimingResult {
|
|
|
377
642
|
//#endregion
|
|
378
643
|
//#region src/executor.d.ts
|
|
379
644
|
interface ExecuteResult {
|
|
645
|
+
attribution?: AttributionResult;
|
|
380
646
|
coverageData?: RawCoverageData;
|
|
381
647
|
exitCode: number;
|
|
382
648
|
gameOutput?: string;
|
|
@@ -590,7 +856,7 @@ declare function formatJobSummary(result: JestResult, options: GitHubActionsOpti
|
|
|
590
856
|
declare function formatJson(result: JestResult): string;
|
|
591
857
|
declare function writeJsonFile(result: JestResult, filePath: string): Promise<void>;
|
|
592
858
|
//#endregion
|
|
593
|
-
//#region src/coverage/mapper.d.ts
|
|
859
|
+
//#region src/coverage-pipeline/mapper.d.ts
|
|
594
860
|
interface MappedFileCoverage {
|
|
595
861
|
b: Record<string, Array<number>>;
|
|
596
862
|
branchMap: Record<string, {
|
|
@@ -655,10 +921,17 @@ interface ProjectResult {
|
|
|
655
921
|
result: ExecuteResult;
|
|
656
922
|
}
|
|
657
923
|
interface MultiProjectMerged {
|
|
924
|
+
attribution?: ExecuteResult["attribution"];
|
|
658
925
|
coverageData?: ExecuteResult["coverageData"];
|
|
659
926
|
sourceMapper?: SourceMapper;
|
|
660
927
|
}
|
|
661
928
|
interface SingleRunResult {
|
|
929
|
+
/**
|
|
930
|
+
* Producer record for the entry point to emit a Build Manifest from. Set only
|
|
931
|
+
* on a coverage run; an entry point reads it to write the manifest with the
|
|
932
|
+
* place set it has.
|
|
933
|
+
*/
|
|
934
|
+
coverageArtifacts?: CoverageArtifacts;
|
|
662
935
|
mode: "single";
|
|
663
936
|
preCoverageMs: number;
|
|
664
937
|
runtimeResult?: ExecuteResult;
|
|
@@ -667,6 +940,8 @@ interface SingleRunResult {
|
|
|
667
940
|
}
|
|
668
941
|
interface MultiRunResult {
|
|
669
942
|
collectCoverageFrom?: Array<string>;
|
|
943
|
+
/** Producer record for the entry point to emit a Build Manifest from. */
|
|
944
|
+
coverageArtifacts?: CoverageArtifacts;
|
|
670
945
|
merged: MultiProjectMerged;
|
|
671
946
|
mode: "multi";
|
|
672
947
|
preCoverageMs: number;
|
|
@@ -715,7 +990,7 @@ interface RunOptions {
|
|
|
715
990
|
//#region src/run.d.ts
|
|
716
991
|
declare function runJestRoblox(cli: CliOptions, config: ResolvedConfig): Promise<RunResult>;
|
|
717
992
|
//#endregion
|
|
718
|
-
//#region node_modules/.pnpm/@rbxts+jest@3.
|
|
993
|
+
//#region node_modules/.pnpm/@rbxts+jest@3.16.0-ts.1/node_modules/@rbxts/jest/src/config.d.ts
|
|
719
994
|
interface ReporterConfig {
|
|
720
995
|
reporter: string | ModuleScript;
|
|
721
996
|
options?: Record<string, any>;
|
|
@@ -741,6 +1016,7 @@ type Argv = Partial<{
|
|
|
741
1016
|
json: boolean;
|
|
742
1017
|
maxWorkers: number | string;
|
|
743
1018
|
noStackTrace: boolean;
|
|
1019
|
+
stackDepth: number;
|
|
744
1020
|
outputFile: string;
|
|
745
1021
|
preset: string | undefined;
|
|
746
1022
|
projects: Array<string>;
|
|
@@ -803,10 +1079,21 @@ interface TestDefinition {
|
|
|
803
1079
|
//#region src/typecheck/runner.d.ts
|
|
804
1080
|
interface TypecheckOptions {
|
|
805
1081
|
files: Array<string>;
|
|
1082
|
+
/**
|
|
1083
|
+
* When `false` (default), tsgo errors in non-test source files surface as
|
|
1084
|
+
* source-level failures. When `true`, only errors inside the discovered Type
|
|
1085
|
+
* Test files are reported.
|
|
1086
|
+
*/
|
|
1087
|
+
ignoreSourceErrors?: boolean;
|
|
806
1088
|
rootDir: string;
|
|
1089
|
+
/**
|
|
1090
|
+
* Milliseconds the tsgo spawn may run before it is killed and the pass
|
|
1091
|
+
* throws. Defaults to {@link DEFAULT_SPAWN_TIMEOUT}.
|
|
1092
|
+
*/
|
|
1093
|
+
spawnTimeout?: number;
|
|
807
1094
|
tsconfig?: string;
|
|
808
1095
|
}
|
|
809
|
-
declare function runTypecheck(options: TypecheckOptions): JestResult
|
|
1096
|
+
declare function runTypecheck(options: TypecheckOptions): Promise<JestResult>;
|
|
810
1097
|
//#endregion
|
|
811
1098
|
//#region src/types/game-output.d.ts
|
|
812
1099
|
interface GameOutputEntry {
|
|
@@ -1105,4 +1392,4 @@ declare function visitExpression(expression: AstExpr, visitor: LuauVisitor): voi
|
|
|
1105
1392
|
declare function visitStatement(statement: AstStat, visitor: LuauVisitor): void;
|
|
1106
1393
|
declare function visitBlock(block: AstStatBlock, visitor: LuauVisitor): void; //#endregion
|
|
1107
1394
|
//#endregion
|
|
1108
|
-
export { type AstExpr, type AstExprBinary, type AstExprCall, type AstExprFunction, type AstStat, type AstStatBlock, type Backend, type BackendOptions, type CliOptions, type Config, type ConfigInput, DEFAULT_CONFIG, type DisplayName, type ExecuteResult, type FormatOutputOptions, type FormatterEntry, GLOBAL_TEST_KEYS, type GameOutputEntry, type GitHubActionsFormatterOptions, type GlobalTestConfig, type InlineProjectConfig, JEST_ARGV_EXCLUDED_KEYS, type JestArgv, type JestResult, type LuauSpan, type LuauVisitor, type MultiProjectMerged, type MultiRunResult, OpenCloudBackend, type ProjectEntry, type ProjectInput, type ProjectResult, type ProjectTestConfig, ROOT_CLI_KEYS, type ResolvedConfig, type ResolvedProjectConfig, type RunMode, type RunOptions, type RunProjectsOptions, type RunProjectsResult, type RunResult, SHARED_TEST_KEYS, type SharedTestConfig, type SingleRunResult, StudioBackend, type TestCaseResult, type TestDefinition, type TestFileResult, type TestStatus, type TscErrorInfo, type TypecheckOptions, type WorkspaceConfig, type WorkspaceRunResult, buildJestArgv, createOpenCloudBackend, createStudioBackend, defineConfig, defineProject, extractJsonFromOutput, formatAnnotations, formatExecuteOutput, formatFailure, formatGameOutputNotice, formatJobSummary, formatJson, formatResult, formatTestSummary, generateTestScript, loadConfig, parseGameOutput, parseJestOutput, resolveConfig, runJestRoblox, runProjects, runTypecheck, visitBlock, visitExpression, visitStatement, writeGameOutput, writeJsonFile };
|
|
1395
|
+
export { type ArtifactBundle, type AstExpr, type AstExprBinary, type AstExprCall, type AstExprFunction, type AstStat, type AstStatBlock, BUILD_MANIFEST_VERSION, type Backend, type BackendOptions, type BuildManifest, type BuildManifestArtifact, type BuildManifestFileRecord, type BuildManifestProject, type CliOptions, type Config, type ConfigInput, type CoverageManifest, DEFAULT_CONFIG, type DisplayName, type ExecuteResult, type FormatOutputOptions, type FormatterEntry, GLOBAL_TEST_KEYS, type GameOutputEntry, type GitHubActionsFormatterOptions, type GlobalTestConfig, type InlineProjectConfig, type InstrumentedFileRecord, JEST_ARGV_EXCLUDED_KEYS, type JestArgv, type JestResult, type LuauSpan, type LuauVisitor, MANIFEST_VERSION, type MultiProjectMerged, type MultiRunResult, type NonInstrumentedFileRecord, OpenCloudBackend, type ProjectEntry, type ProjectInput, type ProjectResult, type ProjectTestConfig, ROOT_CLI_KEYS, type ReadBuildManifestOptions, type ReadBuildManifestResult, type ReadManifestResult as ReadCoverageManifestResult, type ResolvedConfig, type ResolvedProjectConfig, type RunMode, type RunOptions, type RunProjectsOptions, type RunProjectsResult, type RunResult, SHARED_TEST_KEYS, type SharedTestConfig, type SingleRunResult, StudioBackend, type TestCaseResult, type TestDefinition, type TestFileResult, type TestRecord, type TestStatus, type TscErrorInfo, type TypecheckOptions, type WorkspaceConfig, type WorkspaceRunResult, buildJestArgv, buildManifestSchema, manifestSchema as coverageManifestSchema, createOpenCloudBackend, createStudioBackend, defineConfig, defineProject, extractJsonFromOutput, formatAnnotations, formatExecuteOutput, formatFailure, formatGameOutputNotice, formatJobSummary, formatJson, formatResult, formatTestSummary, generateTestScript, hashFile, loadConfig, parseGameOutput, parseJestOutput, prepareArtifacts, readBuildManifest, readManifest as readCoverageManifest, resolveConfig, runJestRoblox, runProjects, runTypecheck, visitBlock, visitExpression, visitStatement, writeGameOutput, writeJsonFile };
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,84 @@
|
|
|
1
|
-
import { A as
|
|
2
|
-
|
|
1
|
+
import { $ as loadConfig, A as formatJobSummary, B as formatResult, C as BUILD_MANIFEST_VERSION, E as readBuildManifest, F as writeGameOutput, G as manifestSchema, I as createTimingCollector, J as applyAttribution, K as readManifest, L as formatJson, M as runProjects, N as formatGameOutputNotice, P as parseGameOutput, Q as mergeCliWithConfig, R as writeJsonFile, S as buildPlace, T as emitBuildManifest, U as hashFile, V as formatTestSummary, W as MANIFEST_VERSION, X as extractJsonFromOutput, Z as parseJestOutput, _ as COVERAGE_MANIFEST_PATH, a as loadRojoTree, at as SHARED_TEST_KEYS, b as visitExpression, c as StudioBackend, ct as defineProject, d as createOpenCloudBackend, et as resolveConfig, g as COVERAGE_BUILD_MANIFEST_PATH, h as generateTestScript, i as collectStubMounts, it as ROOT_CLI_KEYS, j as formatExecuteOutput, k as formatAnnotations, l as createStudioBackend, m as buildJestArgv, n as runJestRoblox, nt as GLOBAL_TEST_KEYS, o as runTypecheck, q as writeManifest, r as runSingleOrMulti, rt as JEST_ARGV_EXCLUDED_KEYS, s as resolveAllProjects, st as defineConfig, t as getRawProjects, tt as DEFAULT_CONFIG, u as OpenCloudBackend, v as findRojoProject, w as buildManifestSchema, x as visitStatement, y as visitBlock, z as formatFailure } from "./run-D20euZYa.mjs";
|
|
2
|
+
import * as path$1 from "node:path";
|
|
3
|
+
//#region src/artifacts/prepare-artifacts.ts
|
|
4
|
+
const COVERAGE_DIR = path$1.dirname(COVERAGE_BUILD_MANIFEST_PATH);
|
|
5
|
+
const CLEAN_PLACE_FILE = path$1.join(COVERAGE_DIR, "clean.rbxl");
|
|
6
|
+
const CLEAN_PROJECT_FILE = path$1.join(COVERAGE_DIR, "clean.project.json");
|
|
7
|
+
const CACHE_DIR = path$1.join(".jest-roblox", "cache");
|
|
8
|
+
/**
|
|
9
|
+
* The sole producer of a Clean Place. Builds the Coverage-Instrumented Place and
|
|
10
|
+
* runs the instrumented suite once (via the shared single/multi core), builds an
|
|
11
|
+
* uninstrumented Clean Place through the Place Builder, then emits the Build
|
|
12
|
+
* Manifest with both places in a single atomic write. `runJestRoblox` / the CLI
|
|
13
|
+
* never build a Clean Place — opting in is calling this entry point.
|
|
14
|
+
*/
|
|
15
|
+
async function prepareArtifacts(config) {
|
|
16
|
+
const cli = {};
|
|
17
|
+
const timing = createTimingCollector();
|
|
18
|
+
try {
|
|
19
|
+
const merged = mergeCliWithConfig(cli, {
|
|
20
|
+
...config,
|
|
21
|
+
collectCoverage: true,
|
|
22
|
+
collectPerTestCoverage: true
|
|
23
|
+
});
|
|
24
|
+
const result = await runSingleOrMulti(cli, merged, timing);
|
|
25
|
+
const { coverageArtifacts } = result;
|
|
26
|
+
if (coverageArtifacts === void 0) throw new Error("prepareArtifacts: the coverage run produced no artifacts. Ensure the project has runtime tests and that `typecheckOnly` is not set.");
|
|
27
|
+
const cleanPlace = await buildCleanPlace(merged);
|
|
28
|
+
emitBuildManifest(COVERAGE_BUILD_MANIFEST_PATH, coverageArtifacts, cleanPlace);
|
|
29
|
+
writeManifestAttribution(COVERAGE_MANIFEST_PATH, extractAttribution(result));
|
|
30
|
+
return {
|
|
31
|
+
buildId: coverageArtifacts.buildId,
|
|
32
|
+
buildManifestPath: COVERAGE_BUILD_MANIFEST_PATH,
|
|
33
|
+
cleanPlace,
|
|
34
|
+
coverageData: extractCoverageData(result),
|
|
35
|
+
coverageManifestPath: COVERAGE_MANIFEST_PATH,
|
|
36
|
+
coveragePlace: coverageArtifacts.coveragePlace,
|
|
37
|
+
projects: coverageArtifacts.projects
|
|
38
|
+
};
|
|
39
|
+
} finally {
|
|
40
|
+
timing.flushTimingReport();
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
function extractCoverageData(result) {
|
|
44
|
+
return result.mode === "single" ? result.runtimeResult?.coverageData : result.merged.coverageData;
|
|
45
|
+
}
|
|
46
|
+
function extractAttribution(result) {
|
|
47
|
+
return result.mode === "single" ? result.runtimeResult?.attribution : result.merged.attribution;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Re-publish the coverage manifest with attribution folded in. A missing or
|
|
51
|
+
* unreadable manifest, or a run that produced no attribution, is a no-op — the
|
|
52
|
+
* file records the instrument step wrote stay as published.
|
|
53
|
+
*/
|
|
54
|
+
function writeManifestAttribution(manifestPath, attribution) {
|
|
55
|
+
if (attribution === void 0) return;
|
|
56
|
+
const read = readManifest(manifestPath);
|
|
57
|
+
if (read.kind === "ok") writeManifest(manifestPath, applyAttribution(read.manifest, attribution));
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Build the uninstrumented Clean Place from the same rojo project as the
|
|
61
|
+
* Coverage-Instrumented Place, minus `coverageRoots`. In multi mode the place
|
|
62
|
+
* carries the same `jest.config` stub mounts the coverage run already wrote to
|
|
63
|
+
* the cache, so the Clean Place is runnable.
|
|
64
|
+
*/
|
|
65
|
+
async function buildCleanPlace(config) {
|
|
66
|
+
const descriptor = {
|
|
67
|
+
name: "jest-roblox-clean",
|
|
68
|
+
packageDirectory: path$1.resolve(config.rootDir),
|
|
69
|
+
rojoProjectPath: path$1.resolve(findRojoProject(config))
|
|
70
|
+
};
|
|
71
|
+
const rawProjects = getRawProjects(config);
|
|
72
|
+
if (rawProjects !== void 0 && rawProjects.length > 0) {
|
|
73
|
+
const cacheRoot = path$1.resolve(config.rootDir, CACHE_DIR);
|
|
74
|
+
descriptor.stubMounts = collectStubMounts(await resolveAllProjects(rawProjects, config, loadRojoTree(config), config.rootDir), config.rootDir, cacheRoot);
|
|
75
|
+
}
|
|
76
|
+
return buildPlace({
|
|
77
|
+
packages: [descriptor],
|
|
78
|
+
placeFile: CLEAN_PLACE_FILE,
|
|
79
|
+
projectFile: CLEAN_PROJECT_FILE,
|
|
80
|
+
wrap: false
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
//#endregion
|
|
84
|
+
export { BUILD_MANIFEST_VERSION, DEFAULT_CONFIG, GLOBAL_TEST_KEYS, JEST_ARGV_EXCLUDED_KEYS, MANIFEST_VERSION, OpenCloudBackend, ROOT_CLI_KEYS, SHARED_TEST_KEYS, StudioBackend, buildJestArgv, buildManifestSchema, manifestSchema as coverageManifestSchema, createOpenCloudBackend, createStudioBackend, defineConfig, defineProject, extractJsonFromOutput, formatAnnotations, formatExecuteOutput, formatFailure, formatGameOutputNotice, formatJobSummary, formatJson, formatResult, formatTestSummary, generateTestScript, hashFile, loadConfig, parseGameOutput, parseJestOutput, prepareArtifacts, readBuildManifest, readManifest as readCoverageManifest, resolveConfig, runJestRoblox, runProjects, runTypecheck, visitBlock, visitExpression, visitStatement, writeGameOutput, writeJsonFile };
|