| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -132,7 +132,7 @@ const { | |||
| 132 | 132 | let urlParseWarned = false; | |
| 133 | 133 | ||
| 134 | 134 | function urlParse(url, parseQueryString, slashesDenoteHost) { | |
| 135 | - if (!urlParseWarned && !isInsideNodeModules(2)) { | ||
| 135 | + if (!urlParseWarned && !isInsideNodeModules(4)) { | ||
| 136 | 136 | urlParseWarned = true; | |
| 137 | 137 | process.emitWarning( | |
| 138 | 138 | '`url.parse()` behavior is not standardized and prone to ' + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,23 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + | ||
| 3 | + const common = require('../common'); | ||
| 4 | + const fixtures = require('../common/fixtures'); | ||
| 5 | + | ||
| 6 | + const assert = require('assert'); | ||
| 7 | + const url = require('url'); | ||
| 8 | + | ||
| 9 | + const fixturePath = fixtures.path('node_modules', 'url-deprecations.js'); | ||
| 10 | + | ||
| 11 | + // Application deprecation for url.parse() | ||
| 12 | + url.parse('foo'); | ||
| 13 | + common.expectWarning('DeprecationWarning', | ||
| 14 | + [/`url\.parse\(\)` behavior is not standardized/, 'DEP0169']); | ||
| 15 | + | ||
| 16 | + // No warnings from inside node_modules | ||
| 17 | + common.spawnPromisified(process.execPath, [fixturePath]).then( | ||
| 18 | + common.mustCall(({ code, signal, stderr }) => { | ||
| 19 | + assert.strictEqual(code, 0); | ||
| 20 | + assert.strictEqual(signal, null); | ||
| 21 | + assert.doesNotMatch(stderr, /\[DEP0169\]/); | ||
| 22 | + }) | ||
| 23 | + ); | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -87,13 +87,6 @@ if (common.hasIntl) { | |||
| 87 | 87 | })); | |
| 88 | 88 | }); | |
| 89 | 89 | ||
| 90 | - // Warning should only happen once per process. | ||
| 91 | - common.expectWarning({ | ||
| 92 | - DeprecationWarning: { | ||
| 93 | - // eslint-disable-next-line @stylistic/js/max-len | ||
| 94 | - DEP0169: '`url.parse()` behavior is not standardized and prone to errors that have security implications. Use the WHATWG URL API instead. CVEs are not issued for `url.parse()` vulnerabilities.', | ||
| 95 | - }, | ||
| 96 | - }); | ||
| 97 | 90 | badURLs.forEach((badURL) => { | |
| 98 | 91 | assert.throws(() => url.parse(badURL), { | |
| 99 | 92 | code: 'ERR_INVALID_ARG_VALUE', | |
| Back | FazBrowse Home | New Git URL |
0 commit comments