-
Notifications
You must be signed in to change notification settings - Fork 30.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add test that uses multibyte for path and resolves modules
PR-URL: #56696 Fixes: #56650 Refs: #56657 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
- Loading branch information
Showing
2 changed files
with
27 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"ofLife": 42 | ||
} |
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,24 @@ | ||
'use strict'; | ||
|
||
require('../common'); | ||
const fixtures = require('../common/fixtures'); | ||
const assert = require('assert'); | ||
|
||
// This test ensures that the module can be resolved | ||
// even if the path given to createRequire contains multibyte characters. | ||
|
||
const { createRequire } = require('module'); | ||
|
||
{ | ||
const u = fixtures.fileURL('あ.js'); | ||
|
||
const reqToo = createRequire(u); | ||
assert.deepStrictEqual(reqToo('./experimental'), { ofLife: 42 }); | ||
} | ||
|
||
{ | ||
const u = fixtures.fileURL('copy/utf/新建文件夹/index.js'); | ||
|
||
const reqToo = createRequire(u); | ||
assert.deepStrictEqual(reqToo('./experimental'), { ofLife: 42 }); | ||
} |