Skip to content

Commit 52aafec

Browse files
committed
Import and call runWrapper normally in analyze tests
1 parent 0d08c01 commit 52aafec

2 files changed

Lines changed: 4 additions & 16 deletions

File tree

src/analyze-action-env.test.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import * as sinon from "sinon";
33

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

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

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

7569
t.assert(
7670
runFinalizeStub.calledOnceWith(

src/analyze-action-input.test.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import * as sinon from "sinon";
33

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

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

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

7367
t.assert(
7468
runFinalizeStub.calledOnceWith(

0 commit comments

Comments
 (0)