@isentinel/jest-roblox 0.3.2 → 0.3.5

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/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-BpjBo-Aw.mjs";
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/types.d.ts
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;
@@ -222,6 +364,12 @@ interface RunnerCredentials {
222
364
  }
223
365
  interface UploadPlaceOptions {
224
366
  placeFilePath: string;
367
+ /**
368
+ * Publish as the live version instead of a Saved draft. Open Cloud Luau
369
+ * Execution boots the live Published version on fresh and recycled servers,
370
+ * so a Saved-only upload can be ignored mid-run when a warm server recycles.
371
+ */
372
+ publish?: boolean;
225
373
  }
226
374
  interface UploadPlaceResult {
227
375
  uploadMs: number;
@@ -305,6 +453,12 @@ interface ResolvedProjectConfig {
305
453
  config: ResolvedConfig;
306
454
  displayColor?: string;
307
455
  displayName: string;
456
+ /**
457
+ * Root-prefixed `exclude` globs subtracted from Runtime Test discovery.
458
+ * Optional on the public type (back-compat for external constructors);
459
+ * `resolveProjectConfig` always populates it (defaulting to `[]`).
460
+ */
461
+ exclude?: Array<string>;
308
462
  /** Original include patterns (with TS extensions) for filesystem discovery. */
309
463
  include: Array<string>;
310
464
  /**
@@ -320,6 +474,135 @@ interface ResolvedProjectConfig {
320
474
  rojoMounts: Array<Mount>;
321
475
  /** Luau-side testMatch patterns (extensions stripped). */
322
476
  testMatch: Array<string>;
477
+ /** Raw per-project `test.typecheck`, merged via `resolveTypecheckConfig`. */
478
+ typecheck?: TypecheckConfig;
479
+ }
480
+ //#endregion
481
+ //#region src/utils/hash.d.ts
482
+ /**
483
+ * SHA-256 of a file's raw bytes. The canonical helper for recording and
484
+ * re-verifying artifact hashes — reads the file as a buffer so the digest
485
+ * matches `hashBuffer` of the same content regardless of encoding.
486
+ */
487
+ declare function hashFile(filePath: string): string;
488
+ //#endregion
489
+ //#region src/coverage-pipeline/manifest-parse.d.ts
490
+ /**
491
+ * Shared read result for the sibling manifest readers. `BuildManifest`'s reader
492
+ * extends this with artifact-rehash variants after a successful parse.
493
+ */
494
+ type ParsedManifest<T> = {
495
+ actual: unknown;
496
+ expected: number;
497
+ kind: "version-mismatch";
498
+ } | {
499
+ kind: "invalid";
500
+ summary: string;
501
+ } | {
502
+ kind: "malformed-json";
503
+ } | {
504
+ kind: "missing";
505
+ } | {
506
+ kind: "ok";
507
+ manifest: T;
508
+ };
509
+ //#endregion
510
+ //#region src/coverage-pipeline/manifest.d.ts
511
+ /**
512
+ * On-disk format version for `coverage-manifest.json`. Bump when the schema
513
+ * below changes shape; `INSTRUMENTER_VERSION` is independent and tracks
514
+ * probe-output compatibility (cache invalidation), not file format.
515
+ *
516
+ * The in-process `CollectorResult` contract between coverage-collector and
517
+ * probe-inserter is intentionally not formalized here: it has no serialization
518
+ * boundary, so the TypeScript interface is sufficient.
519
+ */
520
+ declare const MANIFEST_VERSION: 4;
521
+ interface InstrumentedFileRecord {
522
+ key: string;
523
+ branchCount?: number;
524
+ coverageMapPath: string;
525
+ /**
526
+ * Per-statement attribution: maps a Luau statement id (the probe index, same
527
+ * key space as the coverage-map sidecar) to the ids of the tests that covered
528
+ * it. Populated after a coverage run by the per-test attribution harvester;
529
+ * absent on a freshly-instrumented manifest (no run yet).
530
+ */
531
+ coveringTestIds?: Record<string, Array<string>>;
532
+ functionCount?: number;
533
+ instrumentedLuauPath: string;
534
+ originalLuauPath: string;
535
+ sourceHash: string;
536
+ sourceMapPath: string;
537
+ statementCount: number;
538
+ /**
539
+ * Statement ids hit during the coverage run but credited to no per-test
540
+ * window (executed at module load or in a hook). Computed by the per-test
541
+ * attribution harvester; a consumer marks a mutant on one of these as
542
+ * Ignored (ADR-0003). Absent on a freshly-instrumented manifest (no run yet).
543
+ */
544
+ staticStatementIds?: Array<string>;
545
+ }
546
+ /**
547
+ * One Jest test case's identity, recorded so Phase 3's differential cache can
548
+ * key on which tests cover a mutant and whether their source changed.
549
+ * `coveringTestIds` references these by `testId`.
550
+ */
551
+ interface TestRecord {
552
+ /** Full test name (describe chain + leaf `it`). */
553
+ testCaseId: string;
554
+ /** The test file's DataModel path, as the runner observed it. */
555
+ testFilePath: string;
556
+ /** SHA-256 of the test file's source, for cache invalidation. */
557
+ testFileSourceHash: string;
558
+ /** Stable unique id for the test case; referenced by `coveringTestIds`. */
559
+ testId: string;
560
+ }
561
+ interface NonInstrumentedFileRecord {
562
+ shadowPath: string;
563
+ sourceHash: string;
564
+ sourcePath: string;
565
+ }
566
+ interface CoverageManifest {
567
+ /** Shared UUID linking this manifest to its sibling `BuildManifest`. */
568
+ buildId: string;
569
+ files: Record<string, InstrumentedFileRecord>;
570
+ generatedAt: string;
571
+ instrumenterVersion: number;
572
+ luauRoots: Array<string>;
573
+ nonInstrumentedFiles: Record<string, NonInstrumentedFileRecord>;
574
+ placeFilePath?: string;
575
+ /**
576
+ * SHA-256 over every rojo build input OUTSIDE the luauRoots (non-luauRoot
577
+ * `$path` mounts plus the rojo project files), per `computeRojoInputsHash`.
578
+ * The incremental cache rebuilds the place when it drifts. Absent on manifests
579
+ * written before this field existed; a missing value is treated as changed so
580
+ * the next run repopulates it.
581
+ */
582
+ rojoInputsHash?: string;
583
+ shadowDir: string;
584
+ /**
585
+ * Per-test attribution records, one per Jest test case that covered at least
586
+ * one statement. Populated by the harvester after a coverage run; absent on a
587
+ * freshly-instrumented manifest.
588
+ */
589
+ tests?: Array<TestRecord>;
590
+ version: typeof MANIFEST_VERSION;
591
+ }
592
+ type ReadManifestResult = ParsedManifest<CoverageManifest>;
593
+ declare const manifestSchema: type<CoverageManifest>;
594
+ declare function readManifest(filePath: string): ReadManifestResult;
595
+ //#endregion
596
+ //#region src/coverage-pipeline/attribution.d.ts
597
+ interface AttributionResult {
598
+ /** Per Luau file: statement id → ids of the tests that covered it. */
599
+ coveringTestIds: Record<string, Record<string, Array<string>>>;
600
+ /**
601
+ * Per Luau file: statement ids hit during the run but credited to no per-test
602
+ * window (module-load or hook code). The static-mutant set of ADR-0003.
603
+ */
604
+ staticStatementIds: Record<string, Array<string>>;
605
+ tests: Array<TestRecord>;
323
606
  }
324
607
  //#endregion
325
608
  //#region src/source-mapper/index.d.ts
@@ -377,6 +660,7 @@ interface TimingResult {
377
660
  //#endregion
378
661
  //#region src/executor.d.ts
379
662
  interface ExecuteResult {
663
+ attribution?: AttributionResult;
380
664
  coverageData?: RawCoverageData;
381
665
  exitCode: number;
382
666
  gameOutput?: string;
@@ -590,7 +874,7 @@ declare function formatJobSummary(result: JestResult, options: GitHubActionsOpti
590
874
  declare function formatJson(result: JestResult): string;
591
875
  declare function writeJsonFile(result: JestResult, filePath: string): Promise<void>;
592
876
  //#endregion
593
- //#region src/coverage/mapper.d.ts
877
+ //#region src/coverage-pipeline/mapper.d.ts
594
878
  interface MappedFileCoverage {
595
879
  b: Record<string, Array<number>>;
596
880
  branchMap: Record<string, {
@@ -655,10 +939,17 @@ interface ProjectResult {
655
939
  result: ExecuteResult;
656
940
  }
657
941
  interface MultiProjectMerged {
942
+ attribution?: ExecuteResult["attribution"];
658
943
  coverageData?: ExecuteResult["coverageData"];
659
944
  sourceMapper?: SourceMapper;
660
945
  }
661
946
  interface SingleRunResult {
947
+ /**
948
+ * Producer record for the entry point to emit a Build Manifest from. Set only
949
+ * on a coverage run; an entry point reads it to write the manifest with the
950
+ * place set it has.
951
+ */
952
+ coverageArtifacts?: CoverageArtifacts;
662
953
  mode: "single";
663
954
  preCoverageMs: number;
664
955
  runtimeResult?: ExecuteResult;
@@ -667,6 +958,8 @@ interface SingleRunResult {
667
958
  }
668
959
  interface MultiRunResult {
669
960
  collectCoverageFrom?: Array<string>;
961
+ /** Producer record for the entry point to emit a Build Manifest from. */
962
+ coverageArtifacts?: CoverageArtifacts;
670
963
  merged: MultiProjectMerged;
671
964
  mode: "multi";
672
965
  preCoverageMs: number;
@@ -715,7 +1008,7 @@ interface RunOptions {
715
1008
  //#region src/run.d.ts
716
1009
  declare function runJestRoblox(cli: CliOptions, config: ResolvedConfig): Promise<RunResult>;
717
1010
  //#endregion
718
- //#region node_modules/.pnpm/@rbxts+jest@3.13.3-ts.1/node_modules/@rbxts/jest/src/config.d.ts
1011
+ //#region node_modules/.pnpm/@rbxts+jest@3.16.0-ts.1/node_modules/@rbxts/jest/src/config.d.ts
719
1012
  interface ReporterConfig {
720
1013
  reporter: string | ModuleScript;
721
1014
  options?: Record<string, any>;
@@ -741,6 +1034,7 @@ type Argv = Partial<{
741
1034
  json: boolean;
742
1035
  maxWorkers: number | string;
743
1036
  noStackTrace: boolean;
1037
+ stackDepth: number;
744
1038
  outputFile: string;
745
1039
  preset: string | undefined;
746
1040
  projects: Array<string>;
@@ -803,10 +1097,21 @@ interface TestDefinition {
803
1097
  //#region src/typecheck/runner.d.ts
804
1098
  interface TypecheckOptions {
805
1099
  files: Array<string>;
1100
+ /**
1101
+ * When `false` (default), tsgo errors in non-test source files surface as
1102
+ * source-level failures. When `true`, only errors inside the discovered Type
1103
+ * Test files are reported.
1104
+ */
1105
+ ignoreSourceErrors?: boolean;
806
1106
  rootDir: string;
1107
+ /**
1108
+ * Milliseconds the tsgo spawn may run before it is killed and the pass
1109
+ * throws. Defaults to {@link DEFAULT_SPAWN_TIMEOUT}.
1110
+ */
1111
+ spawnTimeout?: number;
807
1112
  tsconfig?: string;
808
1113
  }
809
- declare function runTypecheck(options: TypecheckOptions): JestResult;
1114
+ declare function runTypecheck(options: TypecheckOptions): Promise<JestResult>;
810
1115
  //#endregion
811
1116
  //#region src/types/game-output.d.ts
812
1117
  interface GameOutputEntry {
@@ -1105,4 +1410,4 @@ declare function visitExpression(expression: AstExpr, visitor: LuauVisitor): voi
1105
1410
  declare function visitStatement(statement: AstStat, visitor: LuauVisitor): void;
1106
1411
  declare function visitBlock(block: AstStatBlock, visitor: LuauVisitor): void; //#endregion
1107
1412
  //#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 };
1413
+ 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 extractJsonFromOutput, C as formatJson, D as formatTestSummary, E as formatResult, F as DEFAULT_CONFIG, H as defineProject, I as GLOBAL_TEST_KEYS, L as JEST_ARGV_EXCLUDED_KEYS, N as loadConfig, P as resolveConfig, R as ROOT_CLI_KEYS, S as writeGameOutput, T as formatFailure, V as defineConfig, _ as formatJobSummary, a as visitStatement, b as formatGameOutputNotice, c as OpenCloudBackend, f as buildJestArgv, g as formatAnnotations, i as visitExpression, j as parseJestOutput, l as createOpenCloudBackend, n as runTypecheck, o as StudioBackend, p as generateTestScript, r as visitBlock, s as createStudioBackend, t as runJestRoblox, v as formatExecuteOutput, w as writeJsonFile, x as parseGameOutput, y as runProjects, z as SHARED_TEST_KEYS } from "./run-CyHhajiY.mjs";
2
- export { DEFAULT_CONFIG, GLOBAL_TEST_KEYS, JEST_ARGV_EXCLUDED_KEYS, OpenCloudBackend, ROOT_CLI_KEYS, SHARED_TEST_KEYS, StudioBackend, 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 };
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-DbEgZMyU.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 };