(warning)
| 88 | let disableWarningSet; |
| 89 | |
| 90 | function onWarning(warning) { |
| 91 | if (!disableWarningSet) { |
| 92 | disableWarningSet = new SafeSet(); |
| 93 | const disableWarningValues = getOptionValue('--disable-warning'); |
| 94 | for (let i = 0; i < disableWarningValues.length; i++) { |
| 95 | disableWarningSet.add(disableWarningValues[i]); |
| 96 | } |
| 97 | } |
| 98 | if ((warning?.code && disableWarningSet.has(warning.code)) || |
| 99 | (warning?.name && disableWarningSet.has(warning.name))) return; |
| 100 | |
| 101 | if (!(warning instanceof Error)) return; |
| 102 | |
| 103 | const isDeprecation = warning.name === 'DeprecationWarning'; |
| 104 | if (isDeprecation && process.noDeprecation) return; |
| 105 | const trace = process.traceProcessWarnings || |
| 106 | (isDeprecation && process.traceDeprecation); |
| 107 | let msg = `(${process.release.name}:${process.pid}) `; |
| 108 | if (warning.code) |
| 109 | msg += `[${warning.code}] `; |
| 110 | if (trace && warning.stack) { |
| 111 | msg += `${warning.stack}`; |
| 112 | } else { |
| 113 | msg += |
| 114 | typeof warning.toString === 'function' ? |
| 115 | `${warning.toString()}` : |
| 116 | ErrorPrototypeToString(warning); |
| 117 | } |
| 118 | if (typeof warning.detail === 'string') { |
| 119 | msg += `\n${warning.detail}`; |
| 120 | } |
| 121 | if (!trace && !traceWarningHelperShown) { |
| 122 | const flag = isDeprecation ? '--trace-deprecation' : '--trace-warnings'; |
| 123 | const argv0 = require('path').basename(process.argv0 || 'node', '.exe'); |
| 124 | msg += `\n(Use \`${argv0} ${flag} ...\` to show where the warning ` + |
| 125 | 'was created)'; |
| 126 | traceWarningHelperShown = true; |
| 127 | } |
| 128 | const warningFile = lazyOption(); |
| 129 | if (warningFile) { |
| 130 | return writeToFile(msg); |
| 131 | } |
| 132 | writeOut(msg); |
| 133 | } |
| 134 | |
| 135 | // process.emitWarning(error) |
| 136 | // process.emitWarning(str[, type[, code]][, ctor]) |
nothing calls this directly
no test coverage detected
searching dependent graphs…