mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
0b50972e6c
Calling env->EmitProcessEnvWarning() prevents additional warnings from being set it should therefore be called only if a warning will emit. PR-URL: https://github.com/nodejs/node/pull/25575 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
21 lines
640 B
JavaScript
21 lines
640 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
|
|
// Flags: --pending-deprecation
|
|
|
|
common.expectWarning(
|
|
'DeprecationWarning',
|
|
'Assigning any value other than a string, number, or boolean to a ' +
|
|
'process.env property is deprecated. Please make sure to convert the value ' +
|
|
'to a string before setting process.env with it.',
|
|
'DEP0104'
|
|
);
|
|
|
|
// Make sure setting a valid environment variable doesn't
|
|
// result in warning being suppressed, see:
|
|
// https://github.com/nodejs/node/pull/25157
|
|
process.env.FOO = 'apple';
|
|
process.env.ABC = undefined;
|
|
assert.strictEqual(process.env.ABC, 'undefined');
|