@hublo/sentinel 1.4.0-alpha.37 → 1.4.0-alpha.39
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/bin/sentinel.js
CHANGED
|
@@ -15,10 +15,10 @@ import {
|
|
|
15
15
|
palette,
|
|
16
16
|
registerAdapters,
|
|
17
17
|
resolve
|
|
18
|
-
} from "../chunk-
|
|
18
|
+
} from "../chunk-CTF6XMW4.js";
|
|
19
19
|
import {
|
|
20
20
|
resolveContext
|
|
21
|
-
} from "../chunk-
|
|
21
|
+
} from "../chunk-AT5AEZ7M.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-
|
|
148
|
+
const { validateModuleTests } = await import("../validate-3BLRDD6D.js");
|
|
149
149
|
const outcomes = modules.flatMap(
|
|
150
150
|
(module) => validateModuleTests(module.name, module.root)
|
|
151
151
|
);
|
|
@@ -1003,7 +1003,7 @@ var TYPE_RENAMES = {
|
|
|
1003
1003
|
var NAMED_RULE = {
|
|
1004
1004
|
requireActual: `await vi.importActual(...), which makes the surrounding factory async`,
|
|
1005
1005
|
requireMock: `await vi.importMock(...), which makes the surrounding factory async`,
|
|
1006
|
-
setTimeout: `vi.setConfig({ testTimeout: ... }), which is configuration rather than a call`
|
|
1006
|
+
setTimeout: `vi.setConfig({ testTimeout: ..., hookTimeout: ... }), which is configuration rather than a call, and BOTH because jest's one budget covers hooks too`
|
|
1007
1007
|
};
|
|
1008
1008
|
var OWNED_BY_A_LATER_PASS = /* @__PURE__ */ new Set(["isolateModules", "isolateModulesAsync"]);
|
|
1009
1009
|
function lineOf(source, offset) {
|
|
@@ -1108,11 +1108,17 @@ function injectTypeImport(fileName, source, typeNames) {
|
|
|
1108
1108
|
return source.slice(0, existing.start) + renderTypeImport(merged, semi) + source.slice(existing.end);
|
|
1109
1109
|
}
|
|
1110
1110
|
const line = renderTypeImport([...new Set(typeNames)].sort(), semi);
|
|
1111
|
-
const first = imports
|
|
1112
|
-
|
|
1111
|
+
const first = imports.find(
|
|
1112
|
+
(node) => (node.specifiers?.length ?? 0) > 0
|
|
1113
|
+
);
|
|
1114
|
+
if (first !== void 0) {
|
|
1115
|
+
return source.slice(0, first.start) + line + "\n" + source.slice(first.start);
|
|
1116
|
+
}
|
|
1117
|
+
const last = imports.at(-1);
|
|
1118
|
+
if (last === void 0) return `${line}
|
|
1113
1119
|
|
|
1114
1120
|
${source}`;
|
|
1115
|
-
return source.slice(0,
|
|
1121
|
+
return source.slice(0, last.end) + "\n" + line + source.slice(last.end);
|
|
1116
1122
|
}
|
|
1117
1123
|
function injectViImport(fileName, source) {
|
|
1118
1124
|
const { program, errors } = parseSync3(fileName, source, { sourceType: "module" });
|
|
@@ -2308,10 +2314,11 @@ function applyNamedRules(source, program, fileName = "") {
|
|
|
2308
2314
|
return;
|
|
2309
2315
|
}
|
|
2310
2316
|
if (member === "setTimeout") {
|
|
2317
|
+
const budget = argumentText(source, node);
|
|
2311
2318
|
edits.push({
|
|
2312
2319
|
start: node.start,
|
|
2313
2320
|
end: node.end,
|
|
2314
|
-
text: `vi.setConfig({ testTimeout: ${
|
|
2321
|
+
text: `vi.setConfig({ testTimeout: ${budget}, hookTimeout: ${budget} })`
|
|
2315
2322
|
});
|
|
2316
2323
|
applied.add("jest.setTimeout");
|
|
2317
2324
|
}
|
|
@@ -3795,7 +3802,9 @@ function concurrencyBlock(cwd, reading, target) {
|
|
|
3795
3802
|
return "";
|
|
3796
3803
|
}
|
|
3797
3804
|
function timeoutBlock(reading) {
|
|
3798
|
-
|
|
3805
|
+
if (reading.testTimeout === void 0) return "";
|
|
3806
|
+
return ` testTimeout: ${reading.testTimeout},
|
|
3807
|
+
hookTimeout: ${reading.testTimeout},`;
|
|
3799
3808
|
}
|
|
3800
3809
|
function globalSetupBlock(reading) {
|
|
3801
3810
|
if (reading.globalSetup === void 0) return "";
|
|
@@ -5266,17 +5275,17 @@ var VitestAdapter = class extends BaseAdapter {
|
|
|
5266
5275
|
fixWithTheModulesLinter(ctx, written) {
|
|
5267
5276
|
const linter = writtenFileLinter(ctx.cwd);
|
|
5268
5277
|
if (linter === void 0) return;
|
|
5269
|
-
let
|
|
5278
|
+
let unsettled = 0;
|
|
5270
5279
|
for (let at = 0; at < written.length; at += FORMAT_BATCH) {
|
|
5271
5280
|
const batch = written.slice(at, at + FORMAT_BATCH);
|
|
5272
5281
|
const pass = spawnSync(linter.bin, [...linter.args, ...batch], {
|
|
5273
5282
|
cwd: ctx.cwd,
|
|
5274
5283
|
encoding: "utf8"
|
|
5275
5284
|
});
|
|
5276
|
-
if (pass.status !== 0)
|
|
5285
|
+
if (pass.status !== 0) unsettled += 1;
|
|
5277
5286
|
}
|
|
5278
5287
|
this.say(
|
|
5279
|
-
|
|
5288
|
+
unsettled === 0 ? `ran ${linter.origin} with its fixer over the ${written.length} file(s) this wrote, so the import this migration adds is ordered the way your rules ask. Without it, \`import/order\` alone put 19 modules of this repository in the red.` : `ran ${linter.origin} with its fixer over the ${written.length} file(s) this wrote, and it still reports something it cannot fix. Adoption itself is applied. Run your own lint to see what: it may be rules this module already failed, which are not this migration's to settle.`
|
|
5280
5289
|
);
|
|
5281
5290
|
}
|
|
5282
5291
|
plan(context) {
|
package/dist/index.js
CHANGED
|
@@ -6,10 +6,10 @@ import {
|
|
|
6
6
|
registerAdapters,
|
|
7
7
|
resolve,
|
|
8
8
|
setDefaultRunner
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-CTF6XMW4.js";
|
|
10
10
|
import {
|
|
11
11
|
BaseAdapter
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-AT5AEZ7M.js";
|
|
13
13
|
import "./chunk-O7REVMOC.js";
|
|
14
14
|
import "./chunk-QXFCZON7.js";
|
|
15
15
|
import "./chunk-NW6UHNYX.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hublo/sentinel",
|
|
3
|
-
"version": "1.4.0-alpha.
|
|
3
|
+
"version": "1.4.0-alpha.39",
|
|
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",
|