@starci/jest-preset 2.1.0 → 2.1.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/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.1.1 - 2026-10-01
4
+
5
+ - Fixed: a repository without its test world (`src/tests/world/global-setup.ts`) could not run its unit specs with the managed `jest.config.js`: jest validates every project's `globalSetup`, even under `--selectProjects unit`. The integration, e2e and contract projects are now declared only when the world exists.
6
+
3
7
  ## 2.1.0 - 2026-09-30
4
8
 
5
9
  - Added: the claim side of `recordingOutbox()`, so a claim-side consumer is specced with the kit double the `OUTBOX` token requires (`spec-infra-double-from-kit`) instead of `mock<Outbox>()`. `queueRecords(...records)` fills a backlog that `claimDue(params)` hands out in order (only the asked queues, at most `limit`, removed once claimed; an empty backlog is an empty claim, a record queued twice is a duplicate delivery), `failNext(operation, error)` makes the next `enqueue`, `claimDue`, `complete`, `retry` or `bury` reject once, and `claims`, `completed`, `retried`, `buried` and `backlog` expose what happened. `RecordingOutbox<M, R>` takes the claimed record type as a second parameter; `ClaimedRecord`, `ClaimParams`, `RetryParams`, `BuryParams` and `OutboxOperation` are exported from `./outbox`. `clear()` resets the claim side too. No breaking change.
package/index.cjs CHANGED
@@ -89,6 +89,11 @@ const underTests = (folder) => String.raw`[\\/]src[\\/]tests[\\/]` + folder + St
89
89
  * statements: the `test` script runs the unit project with `--coverage` and fails below it. It uses v8: istanbul instruments the helpers TypeScript emits (`__decorate`, `__param`, `__awaiter`, interop wrappers)
90
90
  * as thousands of branches no spec can cover, while v8 measures the real source.
91
91
  */
92
+ /** True when the repository at `root` has the test world's global setup (`src/tests/world/global-setup.ts`). */
93
+ function hasTestWorld(root) {
94
+ return require("node:fs").existsSync(require("node:path").join(root, "src", "tests", "world", "global-setup.ts"))
95
+ }
96
+
92
97
  function starciJestConfig() {
93
98
  const shared = {
94
99
  preset: "ts-jest",
@@ -126,9 +131,10 @@ function starciJestConfig() {
126
131
  testMatch: ["**/*.spec.ts"],
127
132
  testPathIgnorePatterns: ["/node_modules/", ...TEST_KIND_FOLDERS.map(underTests)],
128
133
  },
129
- suite("integration", "integration-spec"),
130
- suite("e2e", "e2e-spec"),
131
- suite("contract", "contract-spec"),
134
+ // The integration, e2e and contract projects exist only where the repository has its test world: jest validates
135
+ // every project's globalSetup even under --selectProjects unit, so a repository whose world is not written yet
136
+ // would otherwise fail to run its unit specs with the managed config.
137
+ ...(hasTestWorld(process.cwd()) ? [suite("integration", "integration-spec"), suite("e2e", "e2e-spec"), suite("contract", "contract-spec")] : []),
132
138
  ],
133
139
  }
134
140
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@starci/jest-preset",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
4
4
  "description": "The StarCi jest config for Nest repositories (unit, integration, e2e and contract projects, ts-jest with diagnostics off, per-file 100 coverage of *.service.ts only) and the one shared unit-test double kit: typed mock<T>(), mockEntityManager(), fakeTransaction(), fakeCache(), fakeLock(), recordingOutbox(), FakeClock, fakeIds(), builder() and the Outcome matchers toBeRefused/toSucceedWith.",
5
5
  "license": "UNLICENSED",
6
6
  "private": false,