• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Flags: --expose-internals
2'use strict';
3const common = require('../common');
4const { internalBinding } = require('internal/test/binding');
5const os = require('os');
6
7const { hasSmallICU } = internalBinding('config');
8if (!(common.hasIntl && hasSmallICU))
9  common.skip('missing Intl');
10
11const assert = require('assert');
12const { spawnSync } = require('child_process');
13
14const expected =
15    'could not initialize ICU (check NODE_ICU_DATA or ' +
16    `--icu-data-dir parameters)${os.EOL}`;
17
18{
19  const child = spawnSync(process.execPath, ['--icu-data-dir=/', '-e', '0']);
20  assert(child.stderr.toString().includes(expected));
21}
22
23{
24  const env = { ...process.env, NODE_ICU_DATA: '/' };
25  const child = spawnSync(process.execPath, ['-e', '0'], { env });
26  assert(child.stderr.toString().includes(expected));
27}
28