You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've spent quite a bit of time off and on trying to get a test suite to work on our app, and after trying several different test runners and a lot of debugging, what I've discovered is that the reason I haven't been able to get it to work is that inject-data is basically breaking anything that uses mocha.
Here is what's happening in my case:
Mocha includes jade, which includes this code in lib/filters.js:
So, when meteor concatenates these files together and serves them, because inject-data is using /<!DOCTYPE html>/.test(chunk) to determine when it needs to inject, it's attempting to inject into the practicalmeteor_mocha-core.js file.
This actually wouldn't be a huge problem in this particular case, because I don't think there is anything in practicalmeteor:mocha that would actually use that coffeescript filter, so it would just be some unused code bloat. However, since inject-data is loading lib/inject.html as an asset, the template being used for injection ends with a newline, and it's actually the newline that is causing all my failures..
And in the end, my entire test suite is failing because single-quoted javascript strings can't contain literal new-lines.
Now that I've tracked this down in my own code, I see that several other people have already tried to fix it -- any of the four currently open PR's (#2#5#6#7) would have avoided this problem for me, either by not injecting into that file, or by not including the newline from the template.
The text was updated successfully, but these errors were encountered:
I've spent quite a bit of time off and on trying to get a test suite to work on our app, and after trying several different test runners and a lot of debugging, what I've discovered is that the reason I haven't been able to get it to work is that inject-data is basically breaking anything that uses mocha.
Here is what's happening in my case:
Mocha includes jade, which includes this code in lib/filters.js:
Jade also includes, in lib/doctypes.js:
So, when meteor concatenates these files together and serves them, because inject-data is using
/<!DOCTYPE html>/.test(chunk)
to determine when it needs to inject, it's attempting to inject into the practicalmeteor_mocha-core.js file.This actually wouldn't be a huge problem in this particular case, because I don't think there is anything in practicalmeteor:mocha that would actually use that coffeescript filter, so it would just be some unused code bloat. However, since inject-data is loading lib/inject.html as an asset, the template being used for injection ends with a newline, and it's actually the newline that is causing all my failures..
And in the end, my entire test suite is failing because single-quoted javascript strings can't contain literal new-lines.
Now that I've tracked this down in my own code, I see that several other people have already tried to fix it -- any of the four currently open PR's (#2 #5 #6 #7) would have avoided this problem for me, either by not injecting into that file, or by not including the newline from the template.
The text was updated successfully, but these errors were encountered: