Skip to content

Commit

Permalink
test: make jest actually use ESM
Browse files Browse the repository at this point in the history
  • Loading branch information
CMCDragonkai committed Aug 12, 2023
1 parent a395bbf commit 676be83
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion jest.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ const config = {
'jest-extended/all',
'<rootDir>/tests/setupAfterEnv.ts'
],
extensionsToTreatAsEsm: ['.ts'],
extensionsToTreatAsEsm: ['.ts', '.tsx', '.mts'],
};

export default config;
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"build": "shx rm -rf ./dist && tsc -p ./tsconfig.build.json",
"postversion": "npm install --package-lock-only --ignore-scripts --silent",
"tsx": "tsx",
"test": "tsc -p ./tsconfig.build.json && jest",
"test": "tsc -p ./tsconfig.build.json && NODE_OPTIONS=--experimental-vm-modules jest",
"lint": "eslint '{src,tests,scripts,benches}/**/*.{js,ts}'",
"lintfix": "eslint '{src,tests,scripts,benches}/**/*.{js,ts}' --fix",
"lint-shell": "find ./src ./tests ./scripts -type f -regextype posix-extended -regex '.*\\.(sh)' -exec shellcheck {} +",
Expand Down
3 changes: 3 additions & 0 deletions tests/setup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { jest } from '@jest/globals';

globalThis.jest = jest;

0 comments on commit 676be83

Please sign in to comment.