MCPcopy Index your code
hub / github.com/nodejs/node / getSourceMapFromCache

Function getSourceMapFromCache

test/parallel/test-source-map-enable.js:387–406  ·  view source on GitHub ↗
(fixtureFile, coverageDirectory)

Source from the content-addressed store, hash-verified

385}
386
387function getSourceMapFromCache(fixtureFile, coverageDirectory) {
388 const jsonFiles = fs.readdirSync(coverageDirectory);
389 for (const jsonFile of jsonFiles) {
390 let maybeSourceMapCache;
391 try {
392 maybeSourceMapCache = require(
393 path.join(coverageDirectory, jsonFile)
394 )['source-map-cache'] || {};
395 } catch (err) {
396 console.warn(err);
397 maybeSourceMapCache = {};
398 }
399 const keys = Object.keys(maybeSourceMapCache);
400 for (const key of keys) {
401 if (key.includes(fixtureFile)) {
402 return maybeSourceMapCache[key];
403 }
404 }
405 }
406}

Callers 1

Calls 6

warnMethod · 0.80
includesMethod · 0.80
keysMethod · 0.65
requireFunction · 0.50
readdirSyncMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…