Skip to content

Commit

Permalink
fix: setupFiles resolution according to CJS rules
Browse files Browse the repository at this point in the history
  • Loading branch information
ChALkeR committed Oct 24, 2024
1 parent 9ef5b23 commit 0af023b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,9 @@ export async function installJestEnvironment(jestGlobals) {
}
} else if (config.rootDir) {
const { resolve } = await import('node:path')
dynamicImport = (path) => import(resolve(config.rootDir, path))
const { createRequire } = await import('node:module')
const require = createRequire(resolve(config.rootDir, 'package.json'))
dynamicImport = (path) => import(require.resolve(path))
} else {
dynamicImport = async () => assert.fail('Unreachable: importing plugins without a rootDir')
}
Expand Down

0 comments on commit 0af023b

Please sign in to comment.