Skip to content

Commit

Permalink
Transpile dependent packages under node_modules/
Browse files Browse the repository at this point in the history
to avoid error below:
> SyntaxError: Cannot use import statement outside a module
  • Loading branch information
Rindrics committed Jun 11, 2024
1 parent 236ebc7 commit a9ed0b8
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions jest.config.cjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
var esmModules = [
"chalk",
"ora",
"cli-cursor",
"restore-cursor",
"log-symbols",
"is-unicode-supported",
"strip-ansi",
"ansi-regex",
"is-interactive",
"stdin-discarder",
];

module.exports = {
preset: "ts-jest/presets/js-with-babel",
testEnvironment: "node",
Expand All @@ -7,5 +20,8 @@ module.exports = {
moduleNameMapper: {
"^(\\.{1,2}/.*)\\.js$": "$1",
},
transformIgnorePatterns: [
`node_modules/(?!(?:.pnpm/)?(${esmModules.join('|')}))`,
],
testMatch: ["**/?(*.)+(test).[tj]s?(x)"],
};

0 comments on commit a9ed0b8

Please sign in to comment.