Closed johnsoftek closed 9 years ago
Thanks for the issue! And it looks like you found a fix. Would you be willing to make that change in a fork and file a pull request for it?
And oddly enough, I wasn't able to reproduce in this simple test case I created, but your update makes sense, since module-deps would definitely need access to the transforms as well.
Okay. I'll file a pull request.
I reproduced the error in your test case. Just change template.jade to:
p All that you require to crash
Yep, I can confirm the crash in that case. Thanks for your work investigating this!
I made the change but cannot get 100% test coverage - just one line. See https://github.com/johnsoftek/moonboots/tree/fix-issue-55
If you make this line https://github.com/johnsoftek/moonboots/blob/fix-issue-55/index.js#L376-L378 test for self.config.browserify.transforms.length
then the coverage passes.
It seems like under the hood browserify is modifying that object to default transforms
to []
so that line always passes which makes it fail 100% coverage.
That relies on browserify setting self.config.browserify.transforms. Oh well...
On 18 October 2014 07:44, Luke Karrys notifications@github.com wrote:
If you make this line https://github.com/johnsoftek/moonboots/blob/fix-issue-55/index.js#L376-L378 test for self.config.browserify.transforms.length then the coverage passes.
It seems like under the hood browserify is modifying that object to default transforms to [] so that line always passes which makes it fail 100% coverage.
— Reply to this email directly or view it on GitHub https://github.com/HenrikJoreteg/moonboots/issues/55#issuecomment-59580705 .
Agreed, that's not ideal especially since its internal to browserify and we have no guarantee that patch releases wont change that.
The other option is to make a copy of browserify.transforms
before passing it to browserify and use that? It'd be nice to keep coverage at 100%.
I have submitted a pull request but I think your suggestion is an improvement. I will work on it further.
@lukekarrys is this pull request ready to go now? Just spent a long time rediscovering this bug :(
Sorry @latentflip. It's pretty much ready, we were mostly just bikeshedding how to get it to 100% test coverage. I +1 this being merged if you need it.
Cool, I think the current PR is at 100% now so +1 on getting this released.
Philip Roberts
On 30 Oct 2014, at 22:32, Luke Karrys notifications@github.com wrote:
Sorry @latentflip. It's pretty much ready, we were mostly just bikeshedding how to get it to 100% test coverage. I +1 this being merged if you need it.
— Reply to this email directly or view it on GitHub.
@latentflip do you want to merge and release? if not, I can get to it tomorrow
Cool I can release it tomorrow morning.
Philip Roberts
On 30 Oct 2014, at 22:50, Luke Karrys notifications@github.com wrote:
@latentflip do you want to merge and release? if not, I can get to it tomorrow
— Reply to this email directly or view it on GitHub.
If I follow the suggestion to use jadeify (http://ampersandjs.com/learn/templates), it works with isDev: true but not isDev: false.
I have tried adding the transform to package.json:
and in Moonboots config:
Both methods give the same error for production mode:
It seems that module-deps/index.js is trying to trace dependencies for an untransformed .jade file. If I modify module-deps/index.js to skip .jade files in the same way that it skips .json files, the problem is avoided. But there must be a better fix in Moonboots - or maybe I have not configured browserify/jadeify correctly?
UPDATE
I tried this fix in moonboots/index.js. Change
to this
It works.