Skip to content

Commit 6b5763e

Browse files
committed
Skip slow test on Windows
1 parent 3322491 commit 6b5763e

File tree

1 file changed

+37
-35
lines changed

1 file changed

+37
-35
lines changed

src/artifact-scanner.test.ts

Lines changed: 37 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -56,41 +56,43 @@ test("scanArtifactsForTokens handles files without tokens", async (t) => {
5656
}
5757
});
5858

59-
test("scanArtifactsForTokens finds token in debug artifacts", async (t) => {
60-
t.timeout(os.platform() === "win32" ? 30000 : 10000); // 30 seconds on Windows, 10 seconds on other platforms
61-
const messages: LoggedMessage[] = [];
62-
const logger = getRecordingLogger(messages, { logToConsole: false });
63-
// The zip here is a regression test based on
64-
// https://github.com/github/codeql-action/security/advisories/GHSA-vqf5-2xx6-9wfm
65-
const testZip = path.join(
66-
__dirname,
67-
"..",
68-
"src",
69-
"testdata",
70-
"debug-artifacts-with-fake-token.zip",
71-
);
59+
if (os.platform() !== "win32") {
60+
test("scanArtifactsForTokens finds token in debug artifacts", async (t) => {
61+
t.timeout(15000); // 15 seconds
62+
const messages: LoggedMessage[] = [];
63+
const logger = getRecordingLogger(messages, { logToConsole: false });
64+
// The zip here is a regression test based on
65+
// https://github.com/github/codeql-action/security/advisories/GHSA-vqf5-2xx6-9wfm
66+
const testZip = path.join(
67+
__dirname,
68+
"..",
69+
"src",
70+
"testdata",
71+
"debug-artifacts-with-fake-token.zip",
72+
);
7273

73-
// This zip file contains a nested structure with a fake token in:
74-
// my-db-java-partial.zip/trap/java/invocations/kotlin.9017231652989744319.trap
75-
const error = await t.throwsAsync(
76-
async () => await scanArtifactsForTokens([testZip], logger),
77-
);
74+
// This zip file contains a nested structure with a fake token in:
75+
// my-db-java-partial.zip/trap/java/invocations/kotlin.9017231652989744319.trap
76+
const error = await t.throwsAsync(
77+
async () => await scanArtifactsForTokens([testZip], logger),
78+
);
7879

79-
t.regex(
80-
error?.message || "",
81-
/Found.*potential GitHub token/,
82-
"Should detect token in nested zip",
83-
);
84-
t.regex(
85-
error?.message || "",
86-
/kotlin\.9017231652989744319\.trap/,
87-
"Should report the .trap file containing the token",
88-
);
80+
t.regex(
81+
error?.message || "",
82+
/Found.*potential GitHub token/,
83+
"Should detect token in nested zip",
84+
);
85+
t.regex(
86+
error?.message || "",
87+
/kotlin\.9017231652989744319\.trap/,
88+
"Should report the .trap file containing the token",
89+
);
8990

90-
const logOutput = messages.map((msg) => msg.message).join("\n");
91-
t.regex(
92-
logOutput,
93-
/^Extracting gz file: .*\.gz$/m,
94-
"Logs should show that .gz files were extracted",
95-
);
96-
});
91+
const logOutput = messages.map((msg) => msg.message).join("\n");
92+
t.regex(
93+
logOutput,
94+
/^Extracting gz file: .*\.gz$/m,
95+
"Logs should show that .gz files were extracted",
96+
);
97+
});
98+
}

0 commit comments

Comments
 (0)