File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed
Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ const { IterableWeakMap } = require('internal/util/iterable_weak_map');
2929const {
3030 normalizeReferrerURL,
3131} = require ( 'internal/modules/cjs/helpers' ) ;
32+ const { validateBoolean } = require ( 'internal/validators' ) ;
3233// Since the CJS module cache is mutable, which leads to memory leaks when
3334// modules are deleted, we use a WeakMap so that the source map cache will
3435// be purged automatically:
@@ -47,6 +48,8 @@ function getSourceMapsEnabled() {
4748}
4849
4950function setSourceMapsEnabled ( val ) {
51+ validateBoolean ( val , 'val' ) ;
52+
5053 const {
5154 setSourceMapsEnabled,
5255 setPrepareStackTraceCallback
@@ -58,7 +61,7 @@ function setSourceMapsEnabled(val) {
5861 } = require ( 'internal/source_map/prepare_stack_trace' ) ;
5962 setPrepareStackTraceCallback ( prepareStackTrace ) ;
6063 } else if ( sourceMapsEnabled !== undefined ) {
61- // Set prepare stack trace callback only when disabling source maps.
64+ // Reset prepare stack trace callback only when disabling source maps.
6265 const {
6366 prepareStackTrace,
6467 } = require ( 'internal/errors' ) ;
Original file line number Diff line number Diff line change 1+ 'use strict' ;
2+ require ( '../common' ) ;
3+ const assert = require ( 'assert' ) ;
4+
5+ const unexpectedValues = [
6+ undefined ,
7+ null ,
8+ 1 ,
9+ { } ,
10+ ( ) => { } ,
11+ ] ;
12+ for ( const it of unexpectedValues ) {
13+ assert . throws ( ( ) => {
14+ process . setSourceMapsEnabled ( it ) ;
15+ } , / E R R _ I N V A L I D _ A R G _ T Y P E / ) ;
16+ }
You can’t perform that action at this time.
0 commit comments