Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
name: "Tests"

on: [push, pull_request, workflow_dispatch]
on:
workflow_dispatch:
pull_request:
push:
branches:
- main

jobs:
build: # make sure build/ci work properly and there is no faked build ncc built scripts
Expand Down
2 changes: 1 addition & 1 deletion tests/action_args.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const { run } = require("../index");
const core = require("@actions/core");
const exec = require("@actions/exec");

jest.setTimeout(30000);
jest.setTimeout(90000); // 90 seconds; tests were timing out in CI. https://github.com/anchore/scan-action/pull/249

describe("Github action args", () => {
it("runs with json report", async () => {
Expand Down
2 changes: 1 addition & 1 deletion tests/grype_command.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const githubActionsExec = require("@actions/exec");
const githubActionsToolCache = require("@actions/tool-cache");
const core = require("@actions/core");

jest.setTimeout(30000);
jest.setTimeout(90000); // 90 seconds; tests were timing out in CI. https://github.com/anchore/scan-action/pull/249

jest.spyOn(githubActionsToolCache, "find").mockImplementation(() => {
return "grype";
Expand Down
6 changes: 6 additions & 0 deletions tests/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ jest.mock("@actions/core");
jest.mock("@actions/exec");
jest.mock("@actions/tool-cache");

beforeAll(async () => {
const { grypeVersion } = require("../GrypeVersion");
const { installGrype } = require("../index");
await installGrype(grypeVersion);
});

const core = require("@actions/core");
const path = require("path");
const fs = require("fs");
Expand Down
2 changes: 1 addition & 1 deletion tests/sarif_output.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ require("@microsoft/jest-sarif"); // for sarif validation
const fs = require("fs");
const { runScan } = require("../index");

jest.setTimeout(30000);
jest.setTimeout(90000); // 90 seconds; tests were timing out in CI. https://github.com/anchore/scan-action/pull/249

const testSource = async (source, vulnerabilities) => {
if (fs.existsSync("./vulnerabilities.json")) {
Expand Down