@feigi/fleet-ctl 3.16.2 → 3.16.3
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,7 @@
|
|
|
1
1
|
import { test } from "node:test";
|
|
2
2
|
import assert from "node:assert/strict";
|
|
3
|
-
import { readFileSync, readdirSync } from "node:fs";
|
|
3
|
+
import { mkdirSync, mkdtempSync, readFileSync, readdirSync, rmSync, writeFileSync } from "node:fs";
|
|
4
|
+
import { tmpdir } from "node:os";
|
|
4
5
|
import { join } from "node:path";
|
|
5
6
|
|
|
6
7
|
// #516. A scan over every tracked `.mjs`/`.sh`/`.js`/`.yml` file for
|
|
@@ -1570,3 +1571,60 @@ test("both rows and the window count read a bare footnote marker as a sentence e
|
|
|
1570
1571
|
assert.doesNotMatch("For minor and patch bumps, jq '.[] | .x' keeps bounding drift at about one month.\n", UNSCOPED_DRIFT_SENTENCE);
|
|
1571
1572
|
assert.doesNotMatch("For minor and patch bumps, `m?.[1] || x` keeps bounding drift at about one month.\n", UNSCOPED_DRIFT_SENTENCE);
|
|
1572
1573
|
});
|
|
1574
|
+
|
|
1575
|
+
// #2431. The `review-pr-*.test.mjs` suite was deleted (ed9f2967) and its
|
|
1576
|
+
// surviving pins moved to `review-core-*`; the citations that kept naming the old files were
|
|
1577
|
+
// retargeted by hand. A citation of a file that is gone is only legitimate as a
|
|
1578
|
+
// git-object path — `<sha>^:plugin/scripts/<name>` or `<sha>:plugin/scripts/<name>`
|
|
1579
|
+
// — which names the revision it is read at.
|
|
1580
|
+
const DELETED_TEST_CITATION = /(?<![0-9a-f]{7,40}\^?:\s?plugin\/scripts\/)(?<![\w-])review-pr-[a-z0-9-]+\.test\.mjs/g;
|
|
1581
|
+
const deletedTestCitations = (text) => [...normalize(text).matchAll(DELETED_TEST_CITATION)].map((m) => m[0]);
|
|
1582
|
+
|
|
1583
|
+
function* pluginFiles(dir) {
|
|
1584
|
+
for (const entry of readdirSync(dir, { withFileTypes: true })) {
|
|
1585
|
+
if (entry.name === "node_modules") continue;
|
|
1586
|
+
const full = join(dir, entry.name);
|
|
1587
|
+
if (entry.isDirectory()) yield* pluginFiles(full);
|
|
1588
|
+
else yield full;
|
|
1589
|
+
}
|
|
1590
|
+
}
|
|
1591
|
+
|
|
1592
|
+
test("no file under plugin/ cites a deleted review-pr-*.test.mjs without a git-object path (#2431)", () => {
|
|
1593
|
+
for (const file of pluginFiles(REPO)) {
|
|
1594
|
+
if (file === import.meta.filename) continue;
|
|
1595
|
+
assert.deepEqual(deletedTestCitations(readFileSync(file, "utf8")), [], `${file} cites a review-pr-*.test.mjs file that no longer exists — name its review-core-* successor, or a pinned revision such as \`ed9f2967^:plugin/scripts/<name>\``);
|
|
1596
|
+
}
|
|
1597
|
+
});
|
|
1598
|
+
|
|
1599
|
+
test("the plugin walk reads extensionless scripts and skips node_modules (#2431)", () => {
|
|
1600
|
+
const dir = mkdtempSync(join(tmpdir(), "plugin-walk-"));
|
|
1601
|
+
try {
|
|
1602
|
+
mkdirSync(join(dir, "sub"));
|
|
1603
|
+
mkdirSync(join(dir, "node_modules"));
|
|
1604
|
+
writeFileSync(join(dir, "fleet-run"), "// see review-pr-reads.test.mjs\n");
|
|
1605
|
+
writeFileSync(join(dir, "sub", "board.html"), "<!-- review-pr-reads.test.mjs -->\n");
|
|
1606
|
+
writeFileSync(join(dir, "node_modules", "dep.mjs"), "// review-pr-reads.test.mjs\n");
|
|
1607
|
+
assert.deepEqual([...pluginFiles(dir)].map((f) => f.slice(dir.length + 1)).sort(), ["fleet-run", join("sub", "board.html")]);
|
|
1608
|
+
} finally {
|
|
1609
|
+
rmSync(dir, { recursive: true, force: true });
|
|
1610
|
+
}
|
|
1611
|
+
});
|
|
1612
|
+
|
|
1613
|
+
test("the deleted-test citation ban accepts git-object paths and review-core-* names", () => {
|
|
1614
|
+
for (const text of [
|
|
1615
|
+
"// `ed9f2967^:plugin/scripts/review-pr-inbound-citation-prose.test.mjs` asserted",
|
|
1616
|
+
"// f743264:plugin/scripts/review-pr-reads.test.mjs | grep -A2",
|
|
1617
|
+
"// in `ed9f2967^:plugin/scripts/review-pr-citation-prose.test.mjs` looked like",
|
|
1618
|
+
"// `ed9f2967^:\n// plugin/scripts/review-pr-x.test.mjs` wrapped after the colon",
|
|
1619
|
+
"// review-core-snapshot-path.test.mjs's guard-ordering pin.",
|
|
1620
|
+
"// prefix-review-pr-x.test.mjs is a different file",
|
|
1621
|
+
]) assert.deepEqual(deletedTestCitations(text), [], text);
|
|
1622
|
+
for (const text of [
|
|
1623
|
+
"// review-pr-snapshot-path.test.mjs's guard-ordering pin.",
|
|
1624
|
+
"// `review-pr-citation-prose.test.mjs`, one",
|
|
1625
|
+
"// plugin/scripts/review-pr-reads.test.mjs",
|
|
1626
|
+
"// abc^:review-pr-reads.test.mjs",
|
|
1627
|
+
"// abc123^:plugin/scripts/review-pr-x.test.mjs",
|
|
1628
|
+
"// review-pr-2nd-pass.test.mjs",
|
|
1629
|
+
]) assert.equal(deletedTestCitations(text).length, 1, text);
|
|
1630
|
+
});
|