From 0a2ade3c9d481b51bea7987e5b425f0d31f94fd6 Mon Sep 17 00:00:00 2001 From: Koen Vlaswinkel Date: Fri, 30 Aug 2024 11:19:10 +0200 Subject: [PATCH] Update transformIgnorePatterns --- extensions/ql-vscode/src/view/jest.config.ts | 6 ++---- extensions/ql-vscode/test/jest-config.ts | 4 ++++ extensions/ql-vscode/test/unit-tests/jest.config.ts | 6 ++---- extensions/ql-vscode/test/vscode-tests/jest.config.base.ts | 6 ++---- 4 files changed, 10 insertions(+), 12 deletions(-) create mode 100644 extensions/ql-vscode/test/jest-config.ts diff --git a/extensions/ql-vscode/src/view/jest.config.ts b/extensions/ql-vscode/src/view/jest.config.ts index 441e0e970..8840858c5 100644 --- a/extensions/ql-vscode/src/view/jest.config.ts +++ b/extensions/ql-vscode/src/view/jest.config.ts @@ -1,4 +1,5 @@ import type { Config } from "jest"; +import { transformIgnorePatterns } from "../../test/jest-config"; /* * For a detailed explanation regarding each configuration property and type check, visit: @@ -184,10 +185,7 @@ const config: Config = { }, // An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation - transformIgnorePatterns: [ - // These use ES modules, so need to be transformed - "node_modules/(?!(?:@vscode/webview-ui-toolkit|@microsoft/.+|exenv-es6|d3|d3-(.*)|internmap|delaunator|robust-predicates)/.*)", - ], + transformIgnorePatterns, // An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them // unmockedModulePathPatterns: undefined, diff --git a/extensions/ql-vscode/test/jest-config.ts b/extensions/ql-vscode/test/jest-config.ts new file mode 100644 index 000000000..6f25adc34 --- /dev/null +++ b/extensions/ql-vscode/test/jest-config.ts @@ -0,0 +1,4 @@ +export const transformIgnorePatterns = [ + // These use ES modules, so need to be transformed + "node_modules/(?!(?:@vscode/webview-ui-toolkit|@microsoft/.+|@octokit/.+|before-after-hook|d3|d3-(.*)|delaunator|exenv-es6|internmap|nanoid|p-queue|p-timeout|robust-predicates|universal-user-agent)/.*)", +]; diff --git a/extensions/ql-vscode/test/unit-tests/jest.config.ts b/extensions/ql-vscode/test/unit-tests/jest.config.ts index 74c207b27..21f0a38b2 100644 --- a/extensions/ql-vscode/test/unit-tests/jest.config.ts +++ b/extensions/ql-vscode/test/unit-tests/jest.config.ts @@ -1,4 +1,5 @@ import type { Config } from "jest"; +import { transformIgnorePatterns } from "../jest-config"; /* * For a detailed explanation regarding each configuration property and type check, visit: @@ -180,10 +181,7 @@ const config: Config = { }, // An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation - transformIgnorePatterns: [ - // These use ES modules, so need to be transformed - "node_modules/(?!(?:@vscode/webview-ui-toolkit|@microsoft/.+|exenv-es6|nanoid|p-queue|p-timeout)/.*)", - ], + transformIgnorePatterns, // An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them // unmockedModulePathPatterns: undefined, diff --git a/extensions/ql-vscode/test/vscode-tests/jest.config.base.ts b/extensions/ql-vscode/test/vscode-tests/jest.config.base.ts index 1af4f8661..4b2d69a28 100644 --- a/extensions/ql-vscode/test/vscode-tests/jest.config.base.ts +++ b/extensions/ql-vscode/test/vscode-tests/jest.config.base.ts @@ -1,5 +1,6 @@ import type { Config } from "jest"; import { resolve } from "path"; +import { transformIgnorePatterns } from "../jest-config"; /* * For a detailed explanation regarding each configuration property and type check, visit: @@ -181,10 +182,7 @@ const config: Config = { }, // An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation - transformIgnorePatterns: [ - // These use ES modules, so need to be transformed - "node_modules/(?!(?:@vscode/webview-ui-toolkit|@microsoft/.+|exenv-es6|nanoid|p-queue|p-timeout)/.*)", - ], + transformIgnorePatterns, // An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them // unmockedModulePathPatterns: undefined,