Skip to content

Commit

Permalink
fix: adapt to Node.js 23 ESM CJS import wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
rvagg committed Oct 25, 2024
1 parent cfd7be4 commit 85c1353
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion polendina-node-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@ async function run () {
const tests = testFiles.map((f) => {
return {
name: path.relative(process.cwd(), f),
load: () => import(new URL(`file://${path.resolve(process.cwd(), f)}`))
load: async () => {
const mod = await import(new URL(`file://${path.resolve(process.cwd(), f)}`))
// Node.js 23 ESM CJS wrapper
return 'module.exports' in mod ? mod['module.exports'] : mod
}
}
})
const log = {
Expand Down

0 comments on commit 85c1353

Please sign in to comment.