| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 30e5658 commit d5a26f6
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -388,7 +388,9 @@ function getCallSites(frameCount = 10, options) { | |||
| 388 | 388 | // If frameCount is an object, it is the options object | |
| 389 | 389 | options = frameCount; | |
| 390 | 390 | validateObject(options, 'options'); | |
| 391 | - validateBoolean(options.sourceMap, 'options.sourceMap'); | ||
| 391 | + if (options.sourceMap !== undefined) { | ||
| 392 | + validateBoolean(options.sourceMap, 'options.sourceMap'); | ||
| 393 | + } | ||
| 392 | 394 | frameCount = 10; | |
| 393 | 395 | } else { | |
| 394 | 396 | // If options is not provided, set it to an empty object | |
@@ -397,7 +399,9 @@ function getCallSites(frameCount = 10, options) { | |||
| 397 | 399 | } else { | |
| 398 | 400 | // If options is provided, validate it | |
| 399 | 401 | validateObject(options, 'options'); | |
| 400 | - validateBoolean(options.sourceMap, 'options.sourceMap'); | ||
| 402 | + if (options.sourceMap !== undefined) { | ||
| 403 | + validateBoolean(options.sourceMap, 'options.sourceMap'); | ||
| 404 | + } | ||
| 401 | 405 | } | |
| 402 | 406 | ||
| 403 | 407 | // Using kDefaultMaxCallStackSizeToCapture as reference | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -172,3 +172,17 @@ const assert = require('node:assert'); | |||
| 172 | 172 | assert.match(output, /test-get-callsite-explicit\.ts/); | |
| 173 | 173 | assert.strictEqual(status, 0); | |
| 174 | 174 | } | |
| 175 | + | ||
| 176 | + { | ||
| 177 | + // sourceMap must be a boolean | ||
| 178 | + assert.throws(() => getCallSites({ sourceMap: 1 }), { | ||
| 179 | + code: 'ERR_INVALID_ARG_TYPE' | ||
| 180 | + }); | ||
| 181 | + assert.throws(() => getCallSites(1, { sourceMap: 1 }), { | ||
| 182 | + code: 'ERR_INVALID_ARG_TYPE' | ||
| 183 | + }); | ||
| 184 | + | ||
| 185 | + // Not specifying the sourceMap option should not fail. | ||
| 186 | + getCallSites({}); | ||
| 187 | + getCallSites(1, {}); | ||
| 188 | + } | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments