From 377b9ce8c27cb2c4d10d154c005c7553c173c0e8 Mon Sep 17 00:00:00 2001 From: Patrick <116003638+patrick-medusajs@users.noreply.github.com> Date: Thu, 30 Mar 2023 03:17:09 -0400 Subject: [PATCH] fix(oas:test): Augment jest timeout from 30 to 60 sec (#3631) * fix(oas:test): fix beforeAll timeout silent failure * fix(test): fix ts-jest scaffolding in medusa-oas-cli * chore(changeset): patch --- .changeset/poor-bulldogs-repeat.md | 5 +++++ packages/oas/medusa-oas-cli/jest.config.js | 2 +- .../oas/medusa-oas-cli/src/__tests__/command-oas.test.ts | 5 +++++ packages/oas/medusa-oas-cli/tsconfig.spec.json | 5 +++++ 4 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 .changeset/poor-bulldogs-repeat.md create mode 100644 packages/oas/medusa-oas-cli/tsconfig.spec.json diff --git a/.changeset/poor-bulldogs-repeat.md b/.changeset/poor-bulldogs-repeat.md new file mode 100644 index 0000000000..ee97632ae6 --- /dev/null +++ b/.changeset/poor-bulldogs-repeat.md @@ -0,0 +1,5 @@ +--- +"@medusajs/medusa-oas-cli": patch +--- + +fix(oas:test): fix beforeAll timeout silent failure diff --git a/packages/oas/medusa-oas-cli/jest.config.js b/packages/oas/medusa-oas-cli/jest.config.js index 5e9ddf76a1..8cdcf8d10f 100644 --- a/packages/oas/medusa-oas-cli/jest.config.js +++ b/packages/oas/medusa-oas-cli/jest.config.js @@ -10,5 +10,5 @@ module.exports = { }, testEnvironment: `node`, moduleFileExtensions: [`js`, `ts`], - testTimeout: 30000, + testTimeout: 60000, } diff --git a/packages/oas/medusa-oas-cli/src/__tests__/command-oas.test.ts b/packages/oas/medusa-oas-cli/src/__tests__/command-oas.test.ts index 434f79cfba..91e84dd133 100644 --- a/packages/oas/medusa-oas-cli/src/__tests__/command-oas.test.ts +++ b/packages/oas/medusa-oas-cli/src/__tests__/command-oas.test.ts @@ -82,6 +82,11 @@ describe("command oas", () => { describe("--type admin", () => { let oas: OpenAPIObject + /** + * In a CI context, beforeAll might exceed the configured jest timeout. + * Until we upgrade our jest version, the timeout error will be swallowed + * and the test will fail in unexpected ways. + */ beforeAll(async () => { const outDir = path.resolve(tmpDir, uid()) await runCLI("oas", ["--type", "admin", "--out-dir", outDir]) diff --git a/packages/oas/medusa-oas-cli/tsconfig.spec.json b/packages/oas/medusa-oas-cli/tsconfig.spec.json new file mode 100644 index 0000000000..9b62409191 --- /dev/null +++ b/packages/oas/medusa-oas-cli/tsconfig.spec.json @@ -0,0 +1,5 @@ +{ + "extends": "./tsconfig.json", + "include": ["src"], + "exclude": ["node_modules"] +}