1'use strict'; 2// Flags: --expose-internals 3require('../common'); 4const { getOptionValue } = require('internal/options'); 5const assert = require('assert'); 6const cp = require('child_process'); 7 8const expected_redirect_value = 'foó'; 9 10if (process.argv.length === 2) { 11 const NODE_OPTIONS = `--redirect-warnings=${expected_redirect_value}`; 12 const result = cp.spawnSync(process.argv0, 13 ['--expose-internals', __filename, 'test'], 14 { 15 env: { 16 ...process.env, 17 NODE_OPTIONS 18 }, 19 stdio: 'inherit' 20 }); 21 assert.strictEqual(result.status, 0); 22} else { 23 const redirect_value = getOptionValue('--redirect-warnings'); 24 console.log(`--redirect-warings=${redirect_value}`); 25 assert.strictEqual(redirect_value, expected_redirect_value); 26} 27