@hublo/sentinel 1.4.0-alpha.13 → 1.4.0-alpha.14

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hublo/sentinel",
3
- "version": "1.4.0-alpha.13",
3
+ "version": "1.4.0-alpha.14",
4
4
  "description": "One CLI that guards code health across Hublo repos: shared lint/typescript/build/test presets, static & dynamic analysis, and architecture checks.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -66,6 +66,10 @@
66
66
  "types": "./dist/roles/test/tools/msw.d.ts",
67
67
  "import": "./dist/roles/test/tools/msw.js"
68
68
  },
69
+ "./test/tools/mock-extended": {
70
+ "types": "./dist/roles/test/setup/mock-extended.d.ts",
71
+ "import": "./dist/roles/test/setup/mock-extended.js"
72
+ },
69
73
  "./test/setup/msw-lifecycle": {
70
74
  "types": "./dist/roles/test/setup/msw-lifecycle.d.ts",
71
75
  "import": "./dist/roles/test/setup/msw-lifecycle.js"
@@ -5,19 +5,36 @@
5
5
  * time a migrated module has ONE copy. TypeScript does not read Vite's aliases, so it keeps
6
6
  * resolving the jest package and a migrated spec ends up compiling two worlds at once:
7
7
  *
8
- * the value typeof mockDeep<Db>() -> CalledWithMock<…> extends jest.Mock
8
+ * the value typeof mockDeep<Db>() -> CalledWithMock<…> extends jest.Mock
9
9
  * the spec let spy: MockInstance -> vitest's own type
10
10
  * TS2322 not assignable
11
11
  *
12
12
  * Measured on `apps/nest/microservices/agency`: one error, on a module whose typecheck was clean
13
13
  * before it migrated. 34 files under `libs/` export a type built this way.
14
14
  *
15
- * ## Why here, and not in the module
15
+ * ## Why it re-exports a SUBPATH of sentinel rather than `vitest-mock-extended`
16
16
  *
17
- * The declaration REPLACES the module's types with whatever it re-exports, so it has to name a
18
- * package that resolves from wherever the file sits. `vitest-mock-extended` is sentinel's
19
- * dependency, so a copy of this file placed in an adopting module would resolve nothing and empty
20
- * the module out: measured, `Module '"jest-mock-extended"' has no exported member 'mockDeep'`.
17
+ * Because a bare `vitest-mock-extended` does not resolve from here, which was measured with
18
+ * `--traceResolution` after the first attempt emptied the module out:
19
+ *
20
+ * Resolving module 'vitest-mock-extended' from '…/agency/node_modules/@hublo/sentinel/types/…'
21
+ * Module name 'vitest-mock-extended' was not resolved.
22
+ *
23
+ * The module's `tsconfig.spec.json` names this file by PATH, so TypeScript keeps the symlink path
24
+ * pnpm installed and walks up from there: `…/sentinel/node_modules`, then the module's, then the
25
+ * workspace's. Sentinel's own dependency sits in the store beside its real directory, and none of
26
+ * those three is it. A file reached by RESOLUTION is realpathed into the store instead, and its
27
+ * dependencies are found: same trace, `@hublo/sentinel/test/tools/msw` → `msw` resolved.
28
+ *
29
+ * `skipLibCheck` is on in every module here, so the failed `export *` was silent and what surfaced
30
+ * was an empty module: 18 × `Module '"jest-mock-extended"' has no exported member 'mockDeep'`.
31
+ *
32
+ * ## Why THIS subpath
33
+ *
34
+ * `@hublo/sentinel/test/tools/mock-extended` is the very module the runtime alias points at, so the
35
+ * types a spec compiles against are the ones it runs against, down to the lifecycle helpers the
36
+ * fork adds. Re-exporting `vitest-mock-extended` directly would describe something adjacent to what
37
+ * executes.
21
38
  *
22
39
  * ## Why it does not couple modules to each other
23
40
  *
@@ -31,5 +48,5 @@
31
48
  * module at a time; this keeps the test role the same.
32
49
  */
33
50
  declare module 'jest-mock-extended' {
34
- export * from 'vitest-mock-extended'
51
+ export * from '@hublo/sentinel/test/tools/mock-extended'
35
52
  }