Commit 1efd494
Bartek Wrona
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 d612f3f commit 1efd494
1 file changed
+3
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15123 | 15123 | | |
15124 | 15124 | | |
15125 | 15125 | | |
| 15126 | + | |
15126 | 15127 | | |
| 15128 | + | |
15127 | 15129 | | |
15128 | | - | |
| 15130 | + | |
15129 | 15131 | | |
15130 | 15132 | | |
15131 | 15133 | | |
| |||
0 commit comments