File tree 4 files changed +30
-0
lines changed
test/fixtures/source-map/output
4 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -3517,6 +3517,19 @@ throw an error.
3517
3517
Using this function is mutually exclusive with using the deprecated
3518
3518
[` domain` ][] built-in module.
3519
3519
3520
+ ## ` process .sourceMapsEnabled `
3521
+
3522
+ <!-- YAML
3523
+ added: REPLACEME
3524
+ -->
3525
+
3526
+ > Stability: 1 - Experimental
3527
+
3528
+ * {boolean}
3529
+
3530
+ The ` process .sourceMapsEnabled ` property returns whether the
3531
+ [Source Map v3][Source Map] support for stack traces is enabled.
3532
+
3520
3533
## ` process .stderr `
3521
3534
3522
3535
* {Stream}
Original file line number Diff line number Diff line change @@ -326,13 +326,22 @@ process.emitWarning = emitWarning;
326
326
327
327
{
328
328
const {
329
+ getSourceMapsEnabled,
329
330
setSourceMapsEnabled,
330
331
maybeCacheGeneratedSourceMap,
331
332
} = require ( 'internal/source_map/source_map_cache' ) ;
332
333
const {
333
334
setMaybeCacheGeneratedSourceMap,
334
335
} = internalBinding ( 'errors' ) ;
335
336
337
+ ObjectDefineProperty ( process , 'sourceMapsEnabled' , {
338
+ __proto__ : null ,
339
+ enumerable : true ,
340
+ configurable : true ,
341
+ get ( ) {
342
+ return getSourceMapsEnabled ( ) ;
343
+ } ,
344
+ } ) ;
336
345
process . setSourceMapsEnabled = setSourceMapsEnabled ;
337
346
// The C++ land calls back to maybeCacheGeneratedSourceMap()
338
347
// when code is generated by user with eval() or new Function()
Original file line number Diff line number Diff line change 2
2
3
3
'use strict' ;
4
4
require ( '../../../common' ) ;
5
+ const assert = require ( 'assert' ) ;
5
6
Error . stackTraceLimit = 5 ;
6
7
8
+ assert . strictEqual ( process . sourceMapsEnabled , true ) ;
7
9
process . setSourceMapsEnabled ( false ) ;
10
+ assert . strictEqual ( process . sourceMapsEnabled , false ) ;
8
11
9
12
try {
10
13
require ( '../enclosing-call-site-min.js' ) ;
@@ -17,6 +20,7 @@ delete require.cache[require
17
20
18
21
// Re-enable.
19
22
process . setSourceMapsEnabled ( true ) ;
23
+ assert . strictEqual ( process . sourceMapsEnabled , true ) ;
20
24
21
25
try {
22
26
require ( '../enclosing-call-site-min.js' ) ;
Original file line number Diff line number Diff line change 1
1
'use strict' ;
2
2
require ( '../../../common' ) ;
3
+ const assert = require ( 'assert' ) ;
3
4
Error . stackTraceLimit = 5 ;
4
5
6
+ assert . strictEqual ( process . sourceMapsEnabled , false ) ;
5
7
process . setSourceMapsEnabled ( true ) ;
8
+ assert . strictEqual ( process . sourceMapsEnabled , true ) ;
6
9
7
10
try {
8
11
require ( '../enclosing-call-site-min.js' ) ;
@@ -14,6 +17,7 @@ delete require.cache[require
14
17
. resolve ( '../enclosing-call-site-min.js' ) ] ;
15
18
16
19
process . setSourceMapsEnabled ( false ) ;
20
+ assert . strictEqual ( process . sourceMapsEnabled , false ) ;
17
21
18
22
try {
19
23
require ( '../enclosing-call-site-min.js' ) ;
You can’t perform that action at this time.
0 commit comments