diff --git a/lib/internal/source_map/source_map_cache_map.js b/lib/internal/source_map/source_map_cache_map.js index dcacfd9bdbf269..10561acffc4bab 100644 --- a/lib/internal/source_map/source_map_cache_map.js +++ b/lib/internal/source_map/source_map_cache_map.js @@ -13,6 +13,9 @@ const { source_map_data_private_symbol, }, } = internalBinding('util'); +let debug = require('internal/util/debuglog').debuglog('source_map', (fn) => { + debug = fn; +}); /** * Specialized map of WeakRefs to module instances that caches source map @@ -46,6 +49,7 @@ class SourceMapCacheMap { ArrayPrototypeForEach(keys, (key) => { const ref = this.#weakModuleMap.get(key); if (ref && ref.deref() === undefined) { + debug(`Cleanup obsolete source map cache entry with key: ${key}`); this.#weakModuleMap.delete(key); } }); diff --git a/test/fixtures/source-map/output/source_map_sourcemapping_url_string.js b/test/fixtures/source-map/output/source_map_sourcemapping_url_string.js index 8dca7a35bfe7b9..1890e6e0b6d429 100644 --- a/test/fixtures/source-map/output/source_map_sourcemapping_url_string.js +++ b/test/fixtures/source-map/output/source_map_sourcemapping_url_string.js @@ -7,7 +7,5 @@ Error.stackTraceLimit = 2; try { require('../typescript-sourcemapping_url_string'); } catch (err) { - setTimeout(() => { - console.info(err); - }, 10); + console.info(err); } diff --git a/test/fixtures/source-map/output/source_map_throw_catch.js b/test/fixtures/source-map/output/source_map_throw_catch.js index c49ffcff865907..75ce228c918870 100644 --- a/test/fixtures/source-map/output/source_map_throw_catch.js +++ b/test/fixtures/source-map/output/source_map_throw_catch.js @@ -7,7 +7,5 @@ Error.stackTraceLimit = 2; try { require('../typescript-throw'); } catch (err) { - setTimeout(() => { - console.info(err); - }, 10); + console.info(err); }