Skip to content
Prev Previous commit
Next Next commit
Import and call runWrapper normally in analyze tests
  • Loading branch information
mbg committed May 14, 2026
commit 52aafec07347933a26e670390c3f894c5c05e64a
10 changes: 2 additions & 8 deletions src/analyze-action-env.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import * as sinon from "sinon";

import * as actionsUtil from "./actions-util";
import * as analyze from "./analyze";
import { runWrapper } from "./analyze-action";
import * as api from "./api-client";
import * as configUtils from "./config-utils";
import * as gitUtils from "./git-utils";
Expand Down Expand Up @@ -62,15 +63,8 @@ test("analyze action with RAM & threads from environment variables", async (t) =

const runFinalizeStub = sinon.stub(analyze, "runFinalize");
const runQueriesStub = sinon.stub(analyze, "runQueries");
// eslint-disable-next-line @typescript-eslint/no-require-imports
const analyzeAction = require("./analyze-action");

// When analyze-action.ts loads, it runs an async function from the top
// level but does not wait for it to finish. To ensure that calls to
// runFinalize and runQueries are correctly captured by spies, we explicitly
// wait for the action promise to complete before starting verification.
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
await analyzeAction.runWrapper();
await runWrapper();

t.assert(
runFinalizeStub.calledOnceWith(
Expand Down
10 changes: 2 additions & 8 deletions src/analyze-action-input.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import * as sinon from "sinon";

import * as actionsUtil from "./actions-util";
import * as analyze from "./analyze";
import { runWrapper } from "./analyze-action";
import * as api from "./api-client";
import * as configUtils from "./config-utils";
import * as gitUtils from "./git-utils";
Expand Down Expand Up @@ -60,15 +61,8 @@ test("analyze action with RAM & threads from action inputs", async (t) => {

const runFinalizeStub = sinon.stub(analyze, "runFinalize");
const runQueriesStub = sinon.stub(analyze, "runQueries");
// eslint-disable-next-line @typescript-eslint/no-require-imports
const analyzeAction = require("./analyze-action");

// When analyze-action.ts loads, it runs an async function from the top
// level but does not wait for it to finish. To ensure that calls to
// runFinalize and runQueries are correctly captured by spies, we explicitly
// wait for the action promise to complete before starting verification.
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
await analyzeAction.runWrapper();
await runWrapper();

t.assert(
runFinalizeStub.calledOnceWith(
Expand Down