Skip to content
This repository was archived by the owner on Apr 3, 2024. It is now read-only.

Commit 374c1a7

Browse files
Louis-YeJustinBeckwithmctavish
authored
fix: do not throw when meeting empty source map file (#992)
* fix: do not throw when meeting empty source map file * Fix lint issue Co-authored-by: Justin Beckwith <[email protected]> Co-authored-by: James McTavish <[email protected]>
1 parent cc8eff8 commit 374c1a7

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

src/agent/io/sourcemapper.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,6 @@ async function processSourcemap(
158158
return path.normalize(path.join(parentDir, relPath));
159159
});
160160

161-
if (normalizedSourcesRelToProc.length === 0) {
162-
throw new Error('No sources listed in the sourcemap file ' + mapPath);
163-
}
164-
165161
for (const src of normalizedSourcesRelToProc) {
166162
const inputFile = path.normalize(src);
167163
infoMap.set(inputFile, {

test/fixtures/sourcemaps/empty-source-map.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/test-debuglet.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,16 @@ describe('Debuglet', () => {
112112
const config = extend({}, defaultConfig, {
113113
workingDirectory: SOURCEMAP_DIR,
114114
});
115+
115116
const searchResults = await Debuglet.findFiles(config, 'fake-id');
116117
assert(searchResults.jsStats);
117118
assert.strictEqual(Object.keys(searchResults.jsStats).length, 1);
118119
assert(searchResults.jsStats[path.join(SOURCEMAP_DIR, 'js-file.js')]);
119-
assert.strictEqual(searchResults.mapFiles.length, 1);
120-
assert(searchResults.mapFiles[0].endsWith('js-map-file.js.map'));
120+
121+
assert.strictEqual(searchResults.mapFiles.length, 2);
122+
const mapFiles = searchResults.mapFiles.sort();
123+
assert(mapFiles[0].endsWith('empty-source-map.js.map'));
124+
assert(mapFiles[1].endsWith('js-map-file.js.map'));
121125
});
122126
});
123127

0 commit comments

Comments
 (0)