@staff0rd/assist 0.875.2 → 0.876.0
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/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { Command } from "commander";
|
|
|
6
6
|
// package.json
|
|
7
7
|
var package_default = {
|
|
8
8
|
name: "@staff0rd/assist",
|
|
9
|
-
version: "0.
|
|
9
|
+
version: "0.876.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -35840,17 +35840,30 @@ function capHighLevelPatches(files, criticalPaths) {
|
|
|
35840
35840
|
// src/commands/review/highLevel/capHighLevelTestSources.ts
|
|
35841
35841
|
var MAX_TEST_SOURCE_LINES = 200;
|
|
35842
35842
|
var MAX_TOTAL_SOURCE_LINES = 5e3;
|
|
35843
|
-
function
|
|
35843
|
+
function collectCases(nodes) {
|
|
35844
|
+
return nodes.flatMap(
|
|
35845
|
+
(node) => node.kind === "it" ? [node] : collectCases(node.children)
|
|
35846
|
+
);
|
|
35847
|
+
}
|
|
35848
|
+
function shippedCases(files) {
|
|
35849
|
+
const sized = files.flatMap((file) => collectCases(file.tests)).flatMap(
|
|
35850
|
+
(test) => test.source === void 0 ? [] : [{ test, lines: test.source.split("\n").length }]
|
|
35851
|
+
).filter(({ lines: lines2 }) => lines2 <= MAX_TEST_SOURCE_LINES).sort((a, b) => a.lines - b.lines);
|
|
35852
|
+
const shipped = /* @__PURE__ */ new Set();
|
|
35844
35853
|
let remaining = MAX_TOTAL_SOURCE_LINES;
|
|
35854
|
+
for (const { test, lines: lines2 } of sized) {
|
|
35855
|
+
if (lines2 > remaining) break;
|
|
35856
|
+
remaining -= lines2;
|
|
35857
|
+
shipped.add(test);
|
|
35858
|
+
}
|
|
35859
|
+
return shipped;
|
|
35860
|
+
}
|
|
35861
|
+
function capHighLevelTestSources(files) {
|
|
35862
|
+
const shipped = shippedCases(files);
|
|
35845
35863
|
const capCase = (test) => {
|
|
35846
|
-
if (test.source === void 0) return test;
|
|
35847
|
-
const
|
|
35848
|
-
|
|
35849
|
-
remaining -= lines2;
|
|
35850
|
-
return test;
|
|
35851
|
-
}
|
|
35852
|
-
const { source: _dropped, ...rest } = test;
|
|
35853
|
-
return { ...rest, truncated: true };
|
|
35864
|
+
if (test.source === void 0 || shipped.has(test)) return test;
|
|
35865
|
+
const { source, ...rest } = test;
|
|
35866
|
+
return source.split("\n").length > MAX_TEST_SOURCE_LINES ? { ...rest, truncated: true } : { ...rest, overBudget: true };
|
|
35854
35867
|
};
|
|
35855
35868
|
const capNode = (node) => node.kind === "it" ? capCase(node) : { ...node, children: node.children.map(capNode) };
|
|
35856
35869
|
return files.map((file) => ({ ...file, tests: file.tests.map(capNode) }));
|