Fix tests by using jest-babel
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
module.exports = {
|
||||
presets: [
|
||||
['@babel/preset-env', { targets: { node: 'current' } }],
|
||||
'@babel/preset-typescript',
|
||||
],
|
||||
};
|
||||
@@ -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,
|
||||
},
|
||||
},
|
||||
};
|
||||
Generated
+2902
-291
File diff suppressed because it is too large
Load Diff
@@ -36,11 +36,14 @@
|
||||
"yaml": "^2.2.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/preset-env": "^7.25.4",
|
||||
"@babel/preset-typescript": "^7.24.7",
|
||||
"@types/glob": "^8.1.0",
|
||||
"@types/jest": "^29.5.1",
|
||||
"@vercel/ncc": "^0.36.1",
|
||||
"eslint": "^8.46.0",
|
||||
"jest": "^29.5.0",
|
||||
"jest-transform-stub": "^2.0.0",
|
||||
"ts-jest": "^29.1.0"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user