Skip to content

Commit bf25b38

Browse files
author
Andrew Bradley
committed
Adds failing test
1 parent 8c732cd commit bf25b38

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

test/test-source-map-consumer.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,11 @@ exports['test eachMapping'] = function (assert) {
270270
map.eachMapping(function (mapping) {
271271
assert.ok(mapping.source === 'one.js' || mapping.source === 'two.js');
272272
});
273+
274+
map = new SourceMapConsumer(util.mapWithSourcelessMapping);
275+
map.eachMapping(function (mapping) {
276+
assert.ok(mapping.source === null || (typeof mapping.originalColumn === 'number' && typeof mapping.originalLine === 'number'));
277+
});
273278
};
274279

275280
exports['test eachMapping for indexed source maps'] = function(assert) {

test/util.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,13 @@ exports.emptyMap = {
249249
sources: [],
250250
mappings: ''
251251
};
252+
exports.mapWithSourcelessMapping = {
253+
version: 3,
254+
file: 'example.js',
255+
names: [],
256+
sources: ['example.js'],
257+
mappings: 'AAgCA,C'
258+
};
252259

253260

254261
function assertMapping(generatedLine, generatedColumn, originalSource,

0 commit comments

Comments
 (0)