Commit 60c07ff
Fix test_locate_file_abspath_esm to use dynamic import for path module
The test was using require('path') which doesn't work in ESM mode.
Since ESM output (.mjs) wraps the module in an async context, we can
use top-level await with dynamic import.
Changed from:
require('path')['isAbsolute'](scriptDirectory)
To:
var nodePath = await import('node:path');
nodePath.isAbsolute(scriptDirectory)
This properly tests the Node.js path.isAbsolute() function while being
compatible with ESM module format. The CJS variant (test_locate_file_abspath)
continues to use require() as appropriate for CommonJS.1 parent 3540554 commit 60c07ff
1 file changed
Lines changed: 3 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15125 | 15125 | | |
15126 | 15126 | | |
15127 | 15127 | | |
| 15128 | + | |
15128 | 15129 | | |
| 15130 | + | |
15129 | 15131 | | |
15130 | | - | |
| 15132 | + | |
15131 | 15133 | | |
15132 | 15134 | | |
15133 | 15135 | | |
| |||
0 commit comments