Skip to content

Commit f678f49

Browse files
committed
Transform nanoid module in Jest tests
1 parent 99dabb0 commit f678f49

File tree

2 files changed

+24
-27
lines changed

2 files changed

+24
-27
lines changed

extensions/ql-vscode/test/unit-tests/jest.config.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -180,10 +180,10 @@ const config: Config = {
180180
},
181181

182182
// An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
183-
// 'transformIgnorePatterns': [
184-
// // These use ES modules, so need to be transformed
185-
// 'node_modules/(?!(?:@vscode/webview-ui-toolkit|@microsoft/.+|exenv-es6)/.*)'
186-
// ],
183+
transformIgnorePatterns: [
184+
// These use ES modules, so need to be transformed
185+
"node_modules/(?!(?:@vscode/webview-ui-toolkit|@microsoft/.+|exenv-es6|nanoid)/.*)",
186+
],
187187

188188
// An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
189189
// unmockedModulePathPatterns: undefined,

extensions/ql-vscode/test/vscode-tests/jest.config.base.ts

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import type { Config } from "jest";
2+
import { resolve } from "path";
23

34
/*
45
* For a detailed explanation regarding each configuration property and type check, visit:
@@ -163,31 +164,27 @@ const config: Config = {
163164
// testRunner: "jest-circus/runner",
164165

165166
// A map from regular expressions to paths to transformers
166-
// transform: {
167-
// '^.+\\.tsx?$': [
168-
// 'ts-jest',
169-
// {
170-
// tsconfig: 'src/view/tsconfig.spec.json',
171-
// },
172-
// ],
173-
// 'node_modules': [
174-
// 'babel-jest',
175-
// {
176-
// presets: [
177-
// '@babel/preset-env'
178-
// ],
179-
// plugins: [
180-
// '@babel/plugin-transform-modules-commonjs',
181-
// ]
182-
// }
183-
// ]
184-
// },
167+
transform: {
168+
"^.+\\.tsx?$": [
169+
"ts-jest",
170+
{
171+
tsconfig: resolve(__dirname, "../tsconfig.json"),
172+
},
173+
],
174+
node_modules: [
175+
"babel-jest",
176+
{
177+
presets: ["@babel/preset-env"],
178+
plugins: ["@babel/plugin-transform-modules-commonjs"],
179+
},
180+
],
181+
},
185182

186183
// An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
187-
// 'transformIgnorePatterns': [
188-
// // These use ES modules, so need to be transformed
189-
// 'node_modules/(?!(?:@vscode/webview-ui-toolkit|@microsoft/.+|exenv-es6)/.*)'
190-
// ],
184+
transformIgnorePatterns: [
185+
// These use ES modules, so need to be transformed
186+
"node_modules/(?!(?:@vscode/webview-ui-toolkit|@microsoft/.+|exenv-es6|nanoid)/.*)",
187+
],
191188

192189
// An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
193190
// unmockedModulePathPatterns: undefined,

0 commit comments

Comments
 (0)