Skip to content

Commit b81d0d2

Browse files
authored
Merge pull request #3874 from github/henrymercer/slow-tests-ci-only
Tests: Run slow `scanArtifactsForTokens` test in CI only by default
2 parents a16cb53 + 0c80cee commit b81d0d2

6 files changed

Lines changed: 22 additions & 1 deletion

lib/analyze-action-post.js

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/init-action-post.js

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/start-proxy-action-post.js

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/upload-sarif-action-post.js

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/artifact-scanner.test.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,12 @@ test("scanArtifactsForTokens handles files without tokens", async (t) => {
141141
}
142142
});
143143

144-
if (os.platform() !== "win32") {
144+
// This test is slow (extracts and scans a zip artifact), so by default we only run it in CI. Set
145+
// RUN_SLOW_TESTS=1 to run it locally.
146+
if (
147+
os.platform() !== "win32" &&
148+
(process.env.CI === "true" || process.env.RUN_SLOW_TESTS === "1")
149+
) {
145150
test("scanArtifactsForTokens finds token in debug artifacts", async (t) => {
146151
t.timeout(15000); // 15 seconds
147152
const messages: LoggedMessage[] = [];

src/artifact-scanner.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,10 @@ async function scanArchiveFile(
156156
);
157157
}
158158

159+
if (process.platform === "win32") {
160+
throw new Error("Scanning archives is not supported on Windows.");
161+
}
162+
159163
const result: ScanResult = {
160164
scannedFiles: 0,
161165
findings: [],

0 commit comments

Comments
 (0)