Skip to content

Conversation

@dmurat
Copy link
Contributor

@dmurat dmurat commented Nov 6, 2016

This is a proposed resolution for issue 250.

util.assertEqualMaps(assert, map.toJSON(), util.testMapWithSourcesContent);
};

exports['test .fromSourceMap with empty mappings'] = function (assert) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you also add a test case here for the edge case I described above? (i.e. mappings are not empty, but only ever refer to one source).

Copy link
Contributor

@ejpbruel ejpbruel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi dmurat!

Thanks for working on this. This indeed looks like an edge case we should fix.

Your PR looks good overall, but there are a few changes I would make before merging it. Could you look into that?

Sorry for the slow turnaround time on this PR. I promise to respond faster next time.

@dmurat
Copy link
Contributor Author

dmurat commented Nov 19, 2016

I updated pull request as I understood your request. I'm hoping that I understood it correctly :-)

Copy link
Contributor

@ejpbruel ejpbruel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi dmurat,

Thanks for updating the PR. Sorry if my previous review comments were unclear, but there are still a few changes I'd like you to make.

Other than these few changes, your PR looks good to merge, so if it's still not clear what I'd like you to change, don't hesitate to ping me.

generator.addMapping(newMapping);
});
aSourceMapConsumer.sources.forEach(function (sourceFile) {
if (aSourceMapConsumer._mappings === '') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this if-check. We should always execute the code inside this if-block, even if the mappings are not empty.

new SourceMapConsumer(util.testMapEmptyMappingsRelativeSources));
util.assertEqualMaps(assert, map.toJSON(), util.testMapEmptyMappingsRelativeSources_generatedExpected);
};

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also need a test for the following scenario:

  • We have two sources: foo.js and bar.js
  • The mappings are NOT empty, but all the mappings refer only to foo.js.
  • The test should assert that bar.js is also included in the list of sources.

Note that this test will fail with your current code, because it will only add bar.js if the mappings are empty.

@dmurat
Copy link
Contributor Author

dmurat commented Nov 23, 2016

Ok, I believe that I've understood the issue. I've just updated pull request. Tnx for help :-)

@tromey
Copy link
Contributor

tromey commented Sep 22, 2017

I'm sorry about the delay on this. I think this is fine.

@tromey tromey merged commit 2a808d9 into mozilla:master Sep 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants