@starci/jest-preset 2.4.0 → 2.4.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,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.4.1 - 2026-10-28
4
+
5
+ - Changed: `@starci/ai-router` joins the ESM-only dependencies jest compiles to CommonJS, so a spec that builds an AppModule registering the AI pool loads it.
6
+ - Fixed: the built declarations name `.js` (`dist/index.d.ts` and `dist/entity-manager.d.ts` named `.ts` files a consumer tsc cannot read).
7
+ - Fixed: the pair-mismatch message names state protocol 2 as test-world 1.1 and later write it, not "test-world 1.1.x"; release C pins this preset beside `@starci/test-world` 1.2.3, which speaks protocol 2.
8
+
3
9
  ## 2.4.0 - 2026-10-28
4
10
 
5
11
  - Changed: the source is TypeScript in `src/`, built to CommonJS JavaScript in `dist/` (`npm run build`; `prepack` builds), and the declarations are emitted from it instead of hand-written; `main`, `types` and every export (`.`, `./mock`, `./clock`, `./entity-manager`, `./ids`, `./matchers`, `./cache`, `./lock`, `./event-bus`, `./queue`, `./inbox`, `./builders`, `./merge`) point into `dist/`. No rule or behaviour changed; the specifiers are unchanged. The files jest loads by path are now `dist/world-runner.js`, `dist/unit-metadata.js`, `dist/unit-metadata.generated.js` (the coverage anchor, copied byte for byte from `assets/`) and `dist/lcov.js`; `@starci/jest-preset/merge` now has types.
@@ -17,7 +17,7 @@
17
17
  * rethrown) and which writes it made, so a spec can assert that a rolled-back transaction committed nothing.
18
18
  */
19
19
  import type { DeleteResult, EntityManager, InsertResult, UpdateResult } from "typeorm";
20
- import type { MockOf } from "./mock.ts";
20
+ import type { MockOf } from "./mock.js";
21
21
  /** A typed double of `EntityManager`: assignable wherever an `EntityManager` is required, every method a jest mock. */
22
22
  export type MockEntityManager = MockOf<EntityManager>;
23
23
  /** An entity class. */
package/dist/index.d.ts CHANGED
@@ -1,22 +1,22 @@
1
1
  import type { Config } from "jest";
2
- import { mock, createMock } from "./mock.ts";
3
- import { mockEntityManager, fakeTransaction } from "./entity-manager.ts";
4
- import { FakeClock } from "./clock.ts";
5
- import { fakeCache } from "./cache.ts";
6
- import { fakeLock } from "./lock.ts";
7
- import { recordingEventBus } from "./event-bus.ts";
8
- import { recordingQueueOutbox } from "./queue.ts";
9
- import { fakeInbox } from "./inbox.ts";
10
- import { builder } from "./builders.ts";
11
- import { fakeIds, FakeIds } from "./ids.ts";
12
- export type { MockOf } from "./mock.ts";
13
- export type { MockEntityManager, FakeTransaction, EntityClass } from "./entity-manager.ts";
14
- export type { FakeCache } from "./cache.ts";
15
- export type { FakeLock } from "./lock.ts";
16
- export type { RecordingEventBus } from "./event-bus.ts";
17
- export type { RecordingQueueOutbox } from "./queue.ts";
18
- export type { FakeInbox } from "./inbox.ts";
19
- export type { RefusalReason } from "./matchers.ts";
2
+ import { mock, createMock } from "./mock.js";
3
+ import { mockEntityManager, fakeTransaction } from "./entity-manager.js";
4
+ import { FakeClock } from "./clock.js";
5
+ import { fakeCache } from "./cache.js";
6
+ import { fakeLock } from "./lock.js";
7
+ import { recordingEventBus } from "./event-bus.js";
8
+ import { recordingQueueOutbox } from "./queue.js";
9
+ import { fakeInbox } from "./inbox.js";
10
+ import { builder } from "./builders.js";
11
+ import { fakeIds, FakeIds } from "./ids.js";
12
+ export type { MockOf } from "./mock.js";
13
+ export type { MockEntityManager, FakeTransaction, EntityClass } from "./entity-manager.js";
14
+ export type { FakeCache } from "./cache.js";
15
+ export type { FakeLock } from "./lock.js";
16
+ export type { RecordingEventBus } from "./event-bus.js";
17
+ export type { RecordingQueueOutbox } from "./queue.js";
18
+ export type { FakeInbox } from "./inbox.js";
19
+ export type { RefusalReason } from "./matchers.js";
20
20
  /** The coverage scope `starci app sync` renders from the slot manifest: the measured roots (a directory pattern per measured slot, a placeholder folder written as a star), the logic roles measured in them and the directories inside a root that are never measured (each ending in a double star). */
21
21
  export interface StarciCoverageScope {
22
22
  readonly roots: readonly string[];
package/dist/index.js CHANGED
@@ -87,9 +87,10 @@ function transform(tsconfig) {
87
87
  * The runtime dependencies of a back end that ship ECMAScript modules only: jest's CommonJS runtime cannot load them, so their
88
88
  * files are compiled to CommonJS like the repository's own (ts-jest with `allowJs`) instead of being skipped as node_modules.
89
89
  * `jose` is the Supabase access-token verifier of every lite back end (be.integrations.supabase); a lite app keeps full's unit
90
- * run (ruling:R212/case-1, amended by ruling:R212/case-4), so a spec that imports its guard must load it.
90
+ * run (ruling:R212/case-1, amended by ruling:R212/case-4), so a spec that imports its guard must load it. `@starci/ai-router`
91
+ * is the AI pool module a back end registers in its AppModule, so a spec that builds the AppModule must load it.
91
92
  */
92
- const ESM_ONLY_DEPENDENCIES = Object.freeze(["jose"]);
93
+ const ESM_ONLY_DEPENDENCIES = Object.freeze(["jose", String.raw `@starci[\\/]ai-router`]);
93
94
  const ESM_DEPENDENCY_TRANSFORM = String.raw `^.+[\\/]node_modules[\\/](?:${ESM_ONLY_DEPENDENCIES.join("|")})[\\/].+\.js$`;
94
95
  function esmDependencyTransform() {
95
96
  return { [ESM_DEPENDENCY_TRANSFORM]: ["ts-jest", { tsconfig: { allowJs: true, module: "commonjs", target: "es2022", esModuleInterop: true }, diagnostics: false }] };
@@ -30,7 +30,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
30
30
  const node_module_1 = require("node:module");
31
31
  const node_fs_1 = __importDefault(require("node:fs"));
32
32
  const node_path_1 = __importDefault(require("node:path"));
33
- /** The state-file protocol of `@starci/test-world` this runner speaks (test-world 1.1.x). */
33
+ /** The state-file protocol of `@starci/test-world` this runner speaks (test-world 1.1 and later). */
34
34
  const WORLD_STATE_VERSION = 2;
35
35
  /** The variable that carries the path of the world's state file (set by its globalSetup in this process). */
36
36
  const STATE_FILE_ENV = "STARCI_TEST_WORLD_STATE";
@@ -53,7 +53,7 @@ const fieldOf = (value, name) => (typeof value === "object" && value !== null &&
53
53
  /** The slot count the world published; a missing or foreign state file is a pair mismatch. */
54
54
  function worldSlots(env = process.env) {
55
55
  const file = env[STATE_FILE_ENV];
56
- const fix = `pin @starci/test-world and @starci/jest-preset together as knowledge/hfs/canon-pins.yaml pairs them (${PRESET} speaks state protocol ${WORLD_STATE_VERSION}, @starci/test-world 1.1.x)`;
56
+ const fix = `pin @starci/test-world and @starci/jest-preset together as knowledge/hfs/canon-pins.yaml pairs them (${PRESET} speaks state protocol ${WORLD_STATE_VERSION}, as @starci/test-world 1.1 and later write it)`;
57
57
  if (file === undefined || file === "") {
58
58
  throw runnerError(WORLD_PAIR_MISMATCH, `${STATE_FILE_ENV} is not set: the world's globalSetup published no state file for ${PRESET}; ${fix}`);
59
59
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@starci/jest-preset",
3
- "version": "2.4.0",
3
+ "version": "2.4.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(), recordingEventBus(), recordingQueueOutbox(), fakeInbox(), FakeClock, fakeIds(), builder() and the Outcome matchers toBeRefused/toSucceedWith.",
5
5
  "license": "MIT",
6
6
  "author": "starci183",
@@ -88,7 +88,7 @@
88
88
  "typeorm": ">=0.3"
89
89
  },
90
90
  "scripts": {
91
- "build": "node -e \"require('node:fs').rmSync('dist', {recursive: true, force: true})\" && tsc -p tsconfig.build.json && node -e \"require('node:fs').copyFileSync('assets/unit-metadata.generated.js', 'dist/unit-metadata.generated.js')\"",
91
+ "build": "node -e \"require('node:fs').rmSync('dist', {recursive: true, force: true})\" && tsc -p tsconfig.build.json && node -e \"const fs = require('node:fs'); for (const f of fs.readdirSync('dist', {recursive: true}).filter((n) => n.endsWith('.d.ts'))) fs.writeFileSync('dist/' + f, fs.readFileSync('dist/' + f, 'utf8').replace(/((?:from |import\\()['\\x22]\\.\\.?\\/[^'\\x22]+)\\.ts(['\\x22])/g, (all, head, quote) => head + '.js' + quote))\" && node -e \"require('node:fs').copyFileSync('assets/unit-metadata.generated.js', 'dist/unit-metadata.generated.js')\"",
92
92
  "typecheck": "tsc -p tsconfig.json",
93
93
  "prepack": "npm run build",
94
94
  "test": "npm run build && npm run typecheck && node --test \"test/**/*.spec.ts\""