-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Assert that sourcemaps are actually valid + empty map issue #51
Conversation
@ef4 you might want to take a look at this. There is one existing test case which is not generating a valid sourcemap (i.e. fails validation using a the |
@johnnyshields sorry for causing the conflicts on your branch, can you rebase on |
@@ -294,8 +285,7 @@ describe('sourcemap-concat', function() { | |||
}); | |||
builder = new broccoli.Builder(node); | |||
return builder.build().then(function(result) { | |||
expectFile('nothing.js').in(result); | |||
expectFile('nothing.map').in(result); | |||
expectValidSourcemap('nothing.js').in(result); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we should keep using expectFile()
here and add a code comment about why expectValidSourcemap()
is not used
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we are generating a .map
file, it should always pass validation. Otherwise, downstream parsers may choke on the map--many of them are quite brittle.
An alternative would be to not generate a .map
file.
The current behavior--generating an invalid .map
--is not acceptable IMHO.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@stefanpenner any opinions on this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that we should not generate an invalid map file. We could generate a valid one that has nothing in it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could generate a valid one that has nothing in it.
if I understand the situation correctly that is what we are currently doing. we are generating a map for nothing/*.js
but the whole nothing
folder doesn't exist, which results in sources
of the map being empty, which according to the validator is invalid.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just ran our empty source maps against sourcemaps.io and they are not complaining about the empty sources
list.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although not perfect, it would seem that:
- an empty map file is valid, if someone asks for a
map
they get amap
even if it is empty, as long as it is well formed. - the validate tool seems to not handle this case correctly.
- unless new information surfaces, we should: skip the validator for this one scenario, and continue the existing behavior
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
5aab9c5
to
9d2319c
Compare
@Turbo87 I've done the rebase. Please take over this PR and fix as necessary. |
awesome, thanks! |
One of the tests (below) is failing as it is not valid to have an empty sourcemap: