Files
node/test/parallel/test-icu-data-dir.js
Masashi Hirano 7480864c51 src,lib: make process.binding('config') internal
PR-URL: https://github.com/nodejs/node/pull/23400
Refs: https://github.com/nodejs/node/issues/22160
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>

Backport-PR-URL: https://github.com/nodejs/node/pull/25446
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2019-01-14 13:58:08 +01:00

28 lines
824 B
JavaScript

// Flags: --expose-internals
'use strict';
const { internalBinding } = require('internal/test/binding');
const common = require('../common');
const os = require('os');
const { hasSmallICU } = internalBinding('config');
if (!(common.hasIntl && hasSmallICU))
common.skip('missing Intl');
const assert = require('assert');
const { spawnSync } = require('child_process');
const expected =
'could not initialize ICU (check NODE_ICU_DATA or ' +
`--icu-data-dir parameters)${os.EOL}`;
{
const child = spawnSync(process.execPath, ['--icu-data-dir=/', '-e', '0']);
assert(child.stderr.toString().includes(expected));
}
{
const env = Object.assign({}, process.env, { NODE_ICU_DATA: '/' });
const child = spawnSync(process.execPath, ['-e', '0'], { env });
assert(child.stderr.toString().includes(expected));
}