Skip to content

Commit

Permalink
Fix tests by using jest-babel
Browse files Browse the repository at this point in the history
  • Loading branch information
juxtin authored Sep 27, 2024
1 parent ecb240e commit 2857c71
Show file tree
Hide file tree
Showing 4 changed files with 6,764 additions and 4,128 deletions.
6 changes: 6 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
presets: [
['@babel/preset-env', { targets: { node: 'current' } }],
'@babel/preset-typescript',
],
};
16 changes: 16 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
module.exports = {
transform: {
"^.+\\.tsx?$": "ts-jest",
"^.+\\.[t|j]sx?$": "babel-jest", // Use Babel for transforming JS and TS files
"^.+\\.mjs$": "jest-transform-stub", // Use the stub to handle ES modules
},
preset: 'ts-jest',
testEnvironment: 'node',
moduleNameMapper: {
"^octokit$": "<rootDir>/node_modules/octokit/dist-bundle/index.js",
"^@github/dependency-submission-toolkit$": "<rootDir>/node_modules/@github/dependency-submission-toolkit/dist/index.js",
},
extensionsToTreatAsEsm: [".ts"],
transformIgnorePatterns: ["/node_modules/(?!(octokit|\\@github\\/dependency-submission-toolkit)/)"], // Ensure octokit and @github/dependency-submission-toolkit are transformed
globals: {
"ts-jest": {
useESM: true,
},
},
};
Loading

0 comments on commit 2857c71

Please sign in to comment.