From 80a54dc7d1806ff72bd5a551e61a808a0f238814 Mon Sep 17 00:00:00 2001 From: JohnAlbin Date: Mon, 15 Apr 2024 20:29:05 +0800 Subject: [PATCH] testing code coverage --- packages/next-drupal/jest.config.cjs | 3 ++- .../tests/NextDrupalBase/constructor.test.ts | 22 +++++++++---------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/packages/next-drupal/jest.config.cjs b/packages/next-drupal/jest.config.cjs index 457ff9b9..15330bbc 100644 --- a/packages/next-drupal/jest.config.cjs +++ b/packages/next-drupal/jest.config.cjs @@ -1,6 +1,6 @@ /** @type {import('ts-jest').JestConfigWithTsJest} */ module.exports = { - preset: "ts-jest", + preset: "ts-jest/presets/default-esm", testEnvironment: "node", setupFiles: ["dotenv/config"], setupFilesAfterEnv: ["/jest.setup.ts"], @@ -10,6 +10,7 @@ module.exports = { "ts-jest", { isolatedModules: true, + useESM: true, }, ], }, diff --git a/packages/next-drupal/tests/NextDrupalBase/constructor.test.ts b/packages/next-drupal/tests/NextDrupalBase/constructor.test.ts index cd5a2c64..3dbde181 100644 --- a/packages/next-drupal/tests/NextDrupalBase/constructor.test.ts +++ b/packages/next-drupal/tests/NextDrupalBase/constructor.test.ts @@ -20,18 +20,16 @@ describe("baseUrl parameter", () => { process.env = env }) - test("throws error given an invalid baseUrl", () => { - expect( - () => - // @ts-expect-error - new NextDrupalBase() - ).toThrow("The 'baseUrl' param is required.") - - expect( - () => - // @ts-expect-error - new NextDrupalBase({}) - ).toThrow("The 'baseUrl' param is required.") + test("throws error given an invalid baseUrl", async () => { + expect(() => { + // @ts-expect-error + new NextDrupalBase() + }).toThrow("The 'baseUrl' param is required.") + + expect(() => { + // @ts-expect-error + new NextDrupalBase({}) + }).toThrow("The 'baseUrl' param is required.") }) test("announces debug mode when turned on", () => {