Skip to content

Commit bcb35c3

Browse files
yamachuaduh95
authored andcommitted
test: add test that uses multibyte for path and resolves modules
PR-URL: #56696 Fixes: #56650 Refs: #56657 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent 917f98b commit bcb35c3

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"ofLife": 42
3+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
'use strict';
2+
3+
require('../common');
4+
const fixtures = require('../common/fixtures');
5+
const assert = require('assert');
6+
7+
// This test ensures that the module can be resolved
8+
// even if the path given to createRequire contains multibyte characters.
9+
10+
const { createRequire } = require('module');
11+
12+
{
13+
const u = fixtures.fileURL('あ.js');
14+
15+
const reqToo = createRequire(u);
16+
assert.deepStrictEqual(reqToo('./experimental'), { ofLife: 42 });
17+
}
18+
19+
{
20+
const u = fixtures.fileURL('copy/utf/新建文件夹/index.js');
21+
22+
const reqToo = createRequire(u);
23+
assert.deepStrictEqual(reqToo('./experimental'), { ofLife: 42 });
24+
}

0 commit comments

Comments
 (0)