mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
test: add test that uses multibyte for path and resolves modules
PR-URL: https://github.com/nodejs/node/pull/56696 Fixes: https://github.com/nodejs/node/issues/56650 Refs: https://github.com/nodejs/node/pull/56657 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
3
test/fixtures/copy/utf/新建文件夹/experimental.json
vendored
Normal file
3
test/fixtures/copy/utf/新建文件夹/experimental.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"ofLife": 42
|
||||
}
|
||||
24
test/parallel/test-module-create-require-multibyte.js
Normal file
24
test/parallel/test-module-create-require-multibyte.js
Normal file
@@ -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 });
|
||||
}
|
||||
Reference in New Issue
Block a user