Skip to content

Commit

Permalink
move test file to fixtures
Browse files Browse the repository at this point in the history
  • Loading branch information
islandryu committed Nov 15, 2024
1 parent a4f6830 commit fd7a3f5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 12 deletions.
3 changes: 1 addition & 2 deletions src/node_modules.cc
Original file line number Diff line number Diff line change
Expand Up @@ -342,8 +342,7 @@ void BindingData::GetNearestParentPackageJSON(
path += kPathSeparator;
}

auto package_json =
TraverseParent(realm, path);
auto package_json = TraverseParent(realm, path);

if (package_json != nullptr) {
args.GetReturnValue().Set(package_json->Serialize(realm));
Expand Down
1 change: 1 addition & 0 deletions test/fixtures/ε…¨θ§’ζ–‡ε­—/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
console.log('check non-ascii');
14 changes: 4 additions & 10 deletions test/parallel/test-non-ascii.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
'use strict';

const fs = require('node:fs');
const common = require('../common');
const tmpdir = require('../common/tmpdir');
const path = require('path');
const { test } = require('node:test');
const assert = require('node:assert');

test('Running from a directory with non-ASCII characters', async () => {
fs.mkdirSync(tmpdir.resolve('12月'), { recursive: true });
fs.writeFileSync(
tmpdir.resolve('12月/index.js'),
"console.log('12月');",
);
const { stdout } = await common.spawnPromisified(process.execPath, [tmpdir.resolve('12月/index.js')]);
assert.strictEqual(stdout, '12月\n');
});
const nonAsciiPath = path.resolve(__dirname, '../fixtures/ε…¨θ§’ζ–‡ε­—/index.js');
const { stdout } = await common.spawnPromisified(process.execPath, [nonAsciiPath]);
assert.strictEqual(stdout, 'check non-ascii\n');
});

0 comments on commit fd7a3f5

Please sign in to comment.