| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent d197105 commit 207612c
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -55,9 +55,7 @@ const { | |||
| 55 | 55 | isArrayBufferView, | |
| 56 | 56 | isUint8Array | |
| 57 | 57 | } = require('internal/util/types'); | |
| 58 | - const { | ||
| 59 | - pendingDeprecation | ||
| 60 | - } = internalBinding('config'); | ||
| 58 | + | ||
| 61 | 59 | const { | |
| 62 | 60 | formatProperty, | |
| 63 | 61 | kObjectType | |
@@ -150,7 +148,7 @@ const bufferWarning = 'Buffer() is deprecated due to security and usability ' + | |||
| 150 | 148 | function showFlaggedDeprecation() { | |
| 151 | 149 | if (bufferWarningAlreadyEmitted || | |
| 152 | 150 | ++nodeModulesCheckCounter > 10000 || | |
| 153 | - (!pendingDeprecation && | ||
| 151 | + (!require('internal/options').getOptionValue('--pending-deprecation') && | ||
| 154 | 152 | isInsideNodeModules())) { | |
| 155 | 153 | // We don't emit a warning, because we either: | |
| 156 | 154 | // - Already did so, or | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -176,7 +176,7 @@ function startup() { | |||
| 176 | 176 | { | |
| 177 | 177 | // Install legacy getters on the `util` binding for typechecking. | |
| 178 | 178 | // TODO(addaleax): Turn into a full runtime deprecation. | |
| 179 | - const { pendingDeprecation } = internalBinding('config'); | ||
| 179 | + const pendingDeprecation = getOptionValue('--pending-deprecation'); | ||
| 180 | 180 | const utilBinding = internalBinding('util'); | |
| 181 | 181 | const types = internalBinding('types'); | |
| 182 | 182 | for (const name of [ | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -77,9 +77,6 @@ static void Initialize(Local<Object> target, | |||
| 77 | 77 | if (env->options()->experimental_repl_await) | |
| 78 | 78 | READONLY_TRUE_PROPERTY(target, "experimentalREPLAwait"); | |
| 79 | 79 | ||
| 80 | - if (env->options()->pending_deprecation) | ||
| 81 | - READONLY_TRUE_PROPERTY(target, "pendingDeprecation"); | ||
| 82 | - | ||
| 83 | 80 | if (env->options()->expose_internals) | |
| 84 | 81 | READONLY_TRUE_PROPERTY(target, "exposeInternals"); | |
| 85 | 82 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,44 +1,53 @@ | |||
| 1 | 1 | 'use strict'; | |
| 2 | 2 | ||
| 3 | - // Tests that --pending-deprecation and NODE_PENDING_DEPRECATION both | ||
| 4 | - // set the process.binding('config').pendingDeprecation flag that is | ||
| 5 | - // used to determine if pending deprecation messages should be shown. | ||
| 6 | - // The test is performed by launching two child processes that run | ||
| 3 | + // Flags: --expose-internals | ||
| 4 | + // Tests that --pending-deprecation and NODE_PENDING_DEPRECATION both set the | ||
| 5 | + // `require('internal/options').getOptionValue('--pending-deprecation')` | ||
| 6 | + // flag that is used to determine if pending deprecation messages should be | ||
| 7 | + // shown. The test is performed by launching two child processes that run | ||
| 7 | 8 | // this same test script with different arguments. If those exit with | |
| 8 | 9 | // code 0, then the test passes. If they don't, it fails. | |
| 9 | 10 | ||
| 11 | + // TODO(joyeecheung): instead of testing internals, test the actual features | ||
| 12 | + // pending deprecations. | ||
| 13 | + | ||
| 10 | 14 | const common = require('../common'); | |
| 11 | 15 | ||
| 12 | 16 | const assert = require('assert'); | |
| 13 | - const config = process.binding('config'); | ||
| 14 | 17 | const fork = require('child_process').fork; | |
| 18 | + const { getOptionValue } = require('internal/options'); | ||
| 15 | 19 | ||
| 16 | 20 | function message(name) { | |
| 17 | - return `${name} did not set the process.binding('config').` + | ||
| 18 | - 'pendingDeprecation flag.'; | ||
| 21 | + return `${name} did not affect getOptionValue('--pending-deprecation')`; | ||
| 19 | 22 | } | |
| 20 | 23 | ||
| 21 | 24 | switch (process.argv[2]) { | |
| 22 | 25 | case 'env': | |
| 23 | 26 | case 'switch': | |
| 24 | - assert.strictEqual(config.pendingDeprecation, true); | ||
| 27 | + assert.strictEqual( | ||
| 28 | + getOptionValue('--pending-deprecation'), | ||
| 29 | + true | ||
| 30 | + ); | ||
| 25 | 31 | break; | |
| 26 | 32 | default: | |
| 27 | 33 | // Verify that the flag is off by default. | |
| 28 | 34 | const envvar = process.env.NODE_PENDING_DEPRECATION; | |
| 29 | - assert.strictEqual(config.pendingDeprecation, envvar && envvar[0] === '1'); | ||
| 35 | + assert.strictEqual( | ||
| 36 | + getOptionValue('--pending-deprecation'), | ||
| 37 | + !!(envvar && envvar[0] === '1') | ||
| 38 | + ); | ||
| 30 | 39 | ||
| 31 | 40 | // Test the --pending-deprecation command line switch. | |
| 32 | 41 | fork(__filename, ['switch'], { | |
| 33 | - execArgv: ['--pending-deprecation'], | ||
| 42 | + execArgv: ['--pending-deprecation', '--expose-internals'], | ||
| 34 | 43 | silent: true | |
| 35 | 44 | }).on('exit', common.mustCall((code) => { | |
| 36 | 45 | assert.strictEqual(code, 0, message('--pending-deprecation')); | |
| 37 | 46 | })); | |
| 38 | 47 | ||
| 39 | 48 | // Test the --pending_deprecation command line switch. | |
| 40 | 49 | fork(__filename, ['switch'], { | |
| 41 | - execArgv: ['--pending_deprecation'], | ||
| 50 | + execArgv: ['--pending_deprecation', '--expose-internals'], | ||
| 42 | 51 | silent: true | |
| 43 | 52 | }).on('exit', common.mustCall((code) => { | |
| 44 | 53 | assert.strictEqual(code, 0, message('--pending_deprecation')); | |
@@ -47,6 +56,7 @@ switch (process.argv[2]) { | |||
| 47 | 56 | // Test the NODE_PENDING_DEPRECATION environment var. | |
| 48 | 57 | fork(__filename, ['env'], { | |
| 49 | 58 | env: Object.assign({}, process.env, { NODE_PENDING_DEPRECATION: 1 }), | |
| 59 | + execArgv: ['--expose-internals'], | ||
| 50 | 60 | silent: true | |
| 51 | 61 | }).on('exit', common.mustCall((code) => { | |
| 52 | 62 | assert.strictEqual(code, 0, message('NODE_PENDING_DEPRECATION')); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments