Skip to content

Commit

Permalink
test: add test that uses multibyte for path and resolves modules
Browse files Browse the repository at this point in the history
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
yamachu authored and lpinca committed Jan 25, 2025
1 parent 97a3a82 commit 687be59
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
3 changes: 3 additions & 0 deletions test/fixtures/copy/utf/新建文件夹/experimental.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"ofLife": 42
}
24 changes: 24 additions & 0 deletions test/parallel/test-module-create-require-multibyte.js
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 });
}

0 comments on commit 687be59

Please sign in to comment.