| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -187,13 +187,6 @@ Returns an instance of all possible `ArrayBufferView`s of the provided Buffer. | |||
| 187 | 187 | Returns an instance of all possible `BufferSource`s of the provided Buffer, | |
| 188 | 188 | consisting of all `ArrayBufferView` and an `ArrayBuffer`. | |
| 189 | 189 | ||
| 190 | - ### `getCallSite(func)` | ||
| 191 | - | ||
| 192 | - * `func` [\<Function>][<Function>] | ||
| 193 | - * return [\<string>][<string>] | ||
| 194 | - | ||
| 195 | - Returns the file name and line number for the provided Function. | ||
| 196 | - | ||
| 197 | 190 | ### `getTTYfd()` | |
| 198 | 191 | ||
| 199 | 192 | Attempts to get a valid TTY file descriptor. Returns `-1` if it fails. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -30,7 +30,7 @@ const net = require('net'); | |||
| 30 | 30 | // Do not require 'os' until needed so that test-os-checked-function can | |
| 31 | 31 | // monkey patch it. If 'os' is required here, that test will fail. | |
| 32 | 32 | const path = require('path'); | |
| 33 | - const { inspect } = require('util'); | ||
| 33 | + const { inspect, getCallSite } = require('util'); | ||
| 34 | 34 | const { isMainThread } = require('worker_threads'); | |
| 35 | 35 | const { isModuleNamespaceObject } = require('util/types'); | |
| 36 | 36 | ||
@@ -551,25 +551,13 @@ function canCreateSymLink() { | |||
| 551 | 551 | return true; | |
| 552 | 552 | } | |
| 553 | 553 | ||
| 554 | - function getCallSite(top) { | ||
| 555 | - const originalStackFormatter = Error.prepareStackTrace; | ||
| 556 | - Error.prepareStackTrace = (err, stack) => | ||
| 557 | - `${stack[0].getFileName()}:${stack[0].getLineNumber()}`; | ||
| 558 | - const err = new Error(); | ||
| 559 | - Error.captureStackTrace(err, top); | ||
| 560 | - // With the V8 Error API, the stack is not formatted until it is accessed | ||
| 561 | - err.stack; // eslint-disable-line no-unused-expressions | ||
| 562 | - Error.prepareStackTrace = originalStackFormatter; | ||
| 563 | - return err.stack; | ||
| 564 | - } | ||
| 565 | - | ||
| 566 | 554 | function mustNotCall(msg) { | |
| 567 | - const callSite = getCallSite(mustNotCall); | ||
| 555 | + const callSite = getCallSite()[1]; | ||
| 568 | 556 | return function mustNotCall(...args) { | |
| 569 | 557 | const argsInfo = args.length > 0 ? | |
| 570 | 558 | `\ncalled with arguments: ${args.map((arg) => inspect(arg)).join(', ')}` : ''; | |
| 571 | 559 | assert.fail( | |
| 572 | - `${msg || 'function should not have been called'} at ${callSite}` + | ||
| 560 | + `${msg || 'function should not have been called'} at ${callSite.scriptName}:${callSite.lineNumber}` + | ||
| 573 | 561 | argsInfo); | |
| 574 | 562 | }; | |
| 575 | 563 | } | |
@@ -968,7 +956,6 @@ const common = { | |||
| 968 | 956 | expectWarning, | |
| 969 | 957 | getArrayBufferViews, | |
| 970 | 958 | getBufferSources, | |
| 971 | - getCallSite, | ||
| 972 | 959 | getPrintedStackTrace, | |
| 973 | 960 | getTTYfd, | |
| 974 | 961 | hasIntl, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -15,7 +15,6 @@ const { | |||
| 15 | 15 | expectWarning, | |
| 16 | 16 | getArrayBufferViews, | |
| 17 | 17 | getBufferSources, | |
| 18 | - getCallSite, | ||
| 19 | 18 | getTTYfd, | |
| 20 | 19 | hasCrypto, | |
| 21 | 20 | hasIntl, | |
@@ -69,7 +68,6 @@ export { | |||
| 69 | 68 | expectWarning, | |
| 70 | 69 | getArrayBufferViews, | |
| 71 | 70 | getBufferSources, | |
| 72 | - getCallSite, | ||
| 73 | 71 | getPort, | |
| 74 | 72 | getTTYfd, | |
| 75 | 73 | hasCrypto, | |
| Back | FazBrowse Home | New Git URL |
0 commit comments