Import and call runWrapper normally in analyze tests

This commit is contained in:
Michael B. Gale
2026-05-14 18:32:40 +01:00
parent 0d08c01f78
commit 52aafec073
2 changed files with 4 additions and 16 deletions
+2 -8
View File
@@ -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";
@@ -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(
+2 -8
View File
@@ -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";
@@ -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(