@hublo/sentinel 1.4.0-alpha.54 → 1.4.0-alpha.55

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.
@@ -15,10 +15,10 @@ import {
15
15
  palette,
16
16
  registerAdapters,
17
17
  resolve
18
- } from "../chunk-DEDLGEHF.js";
18
+ } from "../chunk-OT2TWYRV.js";
19
19
  import {
20
20
  resolveContext
21
- } from "../chunk-WE2AU6M2.js";
21
+ } from "../chunk-2X26HWRL.js";
22
22
  import "../chunk-O7REVMOC.js";
23
23
  import "../chunk-QXFCZON7.js";
24
24
  import {
@@ -145,7 +145,7 @@ async function runValidate(ctx) {
145
145
  );
146
146
  }
147
147
  if (!ctx.targets.includes("test")) return 1;
148
- const { validateModuleTests } = await import("../validate-T2YQFHJA.js");
148
+ const { validateModuleTests } = await import("../validate-SWE3M6WK.js");
149
149
  const outcomes = modules.flatMap(
150
150
  (module) => validateModuleTests(module.name, module.root)
151
151
  );
@@ -1020,18 +1020,45 @@ function inheritedAutomocks(cwd, setupFiles, parse6) {
1020
1020
  }
1021
1021
  var INHERITED_MOCKS_SETUP = "vitest.setup.inherited-mocks.mts";
1022
1022
  function inheritedMocksSetup(specifiers) {
1023
- const lines = specifiers.map((specifier) => `vi.mock('${specifier}')`);
1023
+ const mocks = specifiers.map((specifier) => `vi.mock('${specifier}', () => automock())`);
1024
1024
  return `/**
1025
- * Module mocks the workspace's jest setup made for every suite, declared where you can see
1026
- * them.
1025
+ * Module mocks the ROOT jest setup made for every suite, declared where you can see them.
1027
1026
  *
1028
1027
  * The root setup mocked these for every file of every module that named it, and this
1029
1028
  * migration cuts that reach on purpose. A spec that wants the real module says
1030
1029
  * \`vi.unmock('<specifier>')\`: a file beats a setup.
1030
+ *
1031
+ * \u26A0\uFE0F \`vi.mock(specifier)\` alone is NOT what jest's automock did. Measured on \`dynamoose\`,
1032
+ * vitest keeps the exported FUNCTIONS and drops \`aws\`, the object the code calls, so the
1033
+ * provider dies on \`Cannot read properties of undefined (reading 'ddb')\`. The factory below
1034
+ * rebuilds the shape jest handed back: every property is a spy, a nested one builds another,
1035
+ * and \`new Thing()\` constructs. A property the underlying spy already owns, such as
1036
+ * \`mockImplementation\`, is returned untouched, so \`vi.mocked(X).mockImplementation(...)\`
1037
+ * keeps working.
1031
1038
  */
1032
1039
  import { vi } from 'vitest'
1033
1040
 
1034
- ${lines.join("\n")}
1041
+ const automock = (): Record<string | symbol, unknown> => {
1042
+ const anything = (): never =>
1043
+ new Proxy(vi.fn() as never, {
1044
+ get: (target: Record<string | symbol, unknown>, key: string | symbol) => {
1045
+ if (key === 'then') return undefined
1046
+ target[key] ??= anything()
1047
+ return target[key]
1048
+ },
1049
+ })
1050
+
1051
+ const namespace: Record<string | symbol, unknown> = {}
1052
+ return new Proxy(namespace, {
1053
+ get: (target, key) => {
1054
+ if (key === 'then' || key === '__esModule') return undefined
1055
+ target[key] ??= anything()
1056
+ return target[key]
1057
+ },
1058
+ })
1059
+ }
1060
+
1061
+ ${mocks.join("\n")}
1035
1062
  `;
1036
1063
  }
1037
1064
 
@@ -53,7 +53,7 @@ import {
53
53
  selfCommand,
54
54
  splitToolArgs,
55
55
  walk
56
- } from "./chunk-WE2AU6M2.js";
56
+ } from "./chunk-2X26HWRL.js";
57
57
  import {
58
58
  parseJsonc
59
59
  } from "./chunk-QXFCZON7.js";
package/dist/index.js CHANGED
@@ -6,10 +6,10 @@ import {
6
6
  registerAdapters,
7
7
  resolve,
8
8
  setDefaultRunner
9
- } from "./chunk-DEDLGEHF.js";
9
+ } from "./chunk-OT2TWYRV.js";
10
10
  import {
11
11
  BaseAdapter
12
- } from "./chunk-WE2AU6M2.js";
12
+ } from "./chunk-2X26HWRL.js";
13
13
  import "./chunk-O7REVMOC.js";
14
14
  import "./chunk-QXFCZON7.js";
15
15
  import "./chunk-KMKQDGI6.js";
@@ -7,7 +7,7 @@ import {
7
7
  readTestAdoption,
8
8
  resolveVitest,
9
9
  suiteOf
10
- } from "./chunk-WE2AU6M2.js";
10
+ } from "./chunk-2X26HWRL.js";
11
11
  import "./chunk-O7REVMOC.js";
12
12
  import "./chunk-QXFCZON7.js";
13
13
  import "./chunk-KMKQDGI6.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hublo/sentinel",
3
- "version": "1.4.0-alpha.54",
3
+ "version": "1.4.0-alpha.55",
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",