Skip to content

Commit

Permalink
fix imports and jest config to work properly as esmodule
Browse files Browse the repository at this point in the history
  • Loading branch information
mint-thompson committed Dec 6, 2024
1 parent f459bd2 commit dba10df
Show file tree
Hide file tree
Showing 45 changed files with 274 additions and 191 deletions.
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodejs 18.20.4
5 changes: 3 additions & 2 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ export default [
{
ignores: [
'node_modules/',
'lib/'
'lib/',
'coverage/'
]
},
...compat.extends('plugin:@typescript-eslint/recommended', 'prettier'),
...compat.extends('plugin:@typescript-eslint/eslint-recommended', 'plugin:@typescript-eslint/recommended', 'prettier'),
{
languageOptions: {
parser: tsParser,
Expand Down
29 changes: 17 additions & 12 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
const config = {
moduleFileExtensions: ['js', 'ts'],
moduleFileExtensions: ["js", "ts"],
transform: {
'^.+\\.(js|jsx|ts|tsx)$': [
'ts-jest',
"^.+\\.(ts|tsx)$": [
"ts-jest",
{
tsconfig: '<rootDir>/test/tsconfig.json'
}
]
tsconfig: "<rootDir>/test/tsconfig.json",
useESM: true,
},
],
},
testMatch: ['**/test/**/*.test.(ts|js)'],
testEnvironment: 'node',
setupFilesAfterEnv: ['jest-extended/all'],
preset: 'ts-jest'
}
extensionsToTreatAsEsm: [".ts"],
moduleNameMapper: {
"^(\\.{1,2}/.*)\\.js$": "$1",
},
testMatch: ["**/test/**/*.test.(ts|js)"],
testEnvironment: "node",
setupFilesAfterEnv: ["jest-extended/all"],
preset: "ts-jest",
};

export default config
export default config;
Loading

0 comments on commit dba10df

Please sign in to comment.