From 6499c9abf15e09236e5cf2db358cf77f849b8ef9 Mon Sep 17 00:00:00 2001 From: Rafal Czajkowski Date: Wed, 15 May 2024 15:00:56 +0200 Subject: [PATCH] Mock `@orangekit/sdk` to run jest test Reverts 553b5be6ab75587dcfc3a17c00ee25b3e19ae4dc commit. We can just mock the `@orangekit/sdk` module globally to run jest tests correctly w/o converting the JS files to CommonJS syntax. --- sdk/jest.config.ts | 3 +-- sdk/test/__mocks__/@orangekit/sdk.ts | 1 + sdk/tsconfig.json | 2 -- 3 files changed, 2 insertions(+), 4 deletions(-) create mode 100644 sdk/test/__mocks__/@orangekit/sdk.ts diff --git a/sdk/jest.config.ts b/sdk/jest.config.ts index 04e040912..d15006424 100644 --- a/sdk/jest.config.ts +++ b/sdk/jest.config.ts @@ -1,9 +1,8 @@ import type { JestConfigWithTsJest } from "ts-jest" const jestConfig: JestConfigWithTsJest = { - preset: "ts-jest/presets/js-with-ts", + preset: "ts-jest", testPathIgnorePatterns: ["/dist/", "/node_modules/"], - transformIgnorePatterns: ["/node_modules/(?!@orangekit/sdk)/"], } export default jestConfig diff --git a/sdk/test/__mocks__/@orangekit/sdk.ts b/sdk/test/__mocks__/@orangekit/sdk.ts new file mode 100644 index 000000000..bc7bd20f4 --- /dev/null +++ b/sdk/test/__mocks__/@orangekit/sdk.ts @@ -0,0 +1 @@ +jest.mock("@orangekit/sdk") diff --git a/sdk/tsconfig.json b/sdk/tsconfig.json index df2c1f6d0..0ac0507f9 100644 --- a/sdk/tsconfig.json +++ b/sdk/tsconfig.json @@ -11,8 +11,6 @@ "esModuleInterop": true, "moduleResolution": "Bundler", "resolveJsonModule": true, - "skipLibCheck": true, - "allowJs": true }, "include": ["src", "test", "src/typings.d.ts", "jest.config.js"] }