forked from oracle/graaljs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
esm: skip file: URL conversion to path when possible
PR-URL: nodejs/node#46305 Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com> Reviewed-By: Guy Bedford <guybedford@gmail.com> Reviewed-By: Jacob Smith <jacob@frende.me> Reviewed-By: James M Snell <jasnell@gmail.com>
- Loading branch information
Showing
3 changed files
with
58 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Flags: --expose-internals | ||
'use strict'; | ||
require('../common'); | ||
const assert = require('node:assert'); | ||
const path = require('node:path'); | ||
const { extname } = require('node:internal/modules/esm/get_format'); | ||
const { fileURLToPath } = require('node:url'); | ||
|
||
[ | ||
'file:///c:/path/to/file', | ||
'file:///c:/path/to/file.ext', | ||
'file:///c:/path.to/file.ext', | ||
'file:///c:/path.to/file', | ||
'file:///c:/path.to/.file', | ||
'file:///c:/path.to/.file.ext', | ||
'file:///c:/path/to/f.ext', | ||
'file:///c:/path/to/..ext', | ||
'file:///c:/path/to/..', | ||
'file:///c:/file', | ||
'file:///c:/file.ext', | ||
'file:///c:/.file', | ||
'file:///c:/.file.ext', | ||
].forEach((input) => { | ||
const inputAsURL = new URL(input); | ||
const inputAsPath = fileURLToPath(inputAsURL); | ||
assert.strictEqual(extname(inputAsURL), path.extname(inputAsPath)); | ||
}); |