jdx / mean-sample

Sample project for Write Modern Web Apps with the MEAN Stack by Jeff Dickey
https://mean-sample.herokuapp.com
165 stars 90 forks source link

Not able to run mocha tests with blanket - CH11 #33

Open dustin-lennon opened 9 years ago

dustin-lennon commented 9 years ago

I'm at the portion of your book where I'm running the code-coverage test with blanket and I am having the following error being thrown:

C:\meanstack>npm test

socialapp@ test C:\meanstack jshint . && mocha && protractor

C:\meanstack\controllers\api\users.js:2 if (typeof _$jscoverage['C:\meanstack\controllers\api\users.js'] === 'undefine ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Error: BLANKET-Error parsing instrumented code: Error: BLANKET-Error parsing instrumented code: Error: BLANKET-Error parsing instrumented code: SyntaxError: Unexpected token ILLEGAL

I cannot figure out where the issue is so I can run this test.

theneva commented 9 years ago

You can solve this temporarily (until Blanket releases a fix) by specifying the version number of Blanket in package.json as "1.1.6" (no hat) instead of what presumably is currently "^1.1.6" or "^1.1.7".

See out alex-seville/blanket#491 for more information on this problem.

hrasyid commented 8 years ago

I hit this too. For some reason "1.1.6" (or "1.1.5", or the current "^1.2.1") didn't work for me :( Any idea?

Here's the exception: $ mocha -R html-cov > coverage.html D:\Codes\meanbook\node_modules\blanket\src\index.js:179 throw e; ^

Error: BLANKET-Error parsing instrumented code: Error: BLANKET-Error parsing instrumented code: Error: BLANKET-Error parsing instrumented code: SyntaxError: Unexpected token ILLEGAL
    at D:\Codes\meanbook\node_modules\blanket\src\index.js:177:37
    at Object.__dirname.blanket._blanket.instrument (D:\Codes\meanbook\node_modules\blanket\src\blanket.js:126:17)
    at Object.require.extensions..js (D:\Codes\meanbook\node_modules\blanket\src\index.js:158:25)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:311:12)
    at Module.require (module.js:366:17)
    at require (module.js:385:17)
    at C:\Users\admin\AppData\Roaming\npm\node_modules\mocha\lib\mocha.js:216:27
    at Array.forEach (native)
    at Mocha.loadFiles (C:\Users\admin\AppData\Roaming\npm\node_modules\mocha\lib\mocha.js:213:14)
    at Mocha.run (C:\Users\admin\AppData\Roaming\npm\node_modules\mocha\lib\mocha.js:453:10)
    at Object.<anonymous> (C:\Users\admin\AppData\Roaming\npm\node_modules\mocha\bin\_mocha:393:18)
    at Module._compile (module.js:435:26)
    at Object.Module._extensions..js (module.js:442:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:311:12)
    at Function.Module.runMain (module.js:467:10)
    at startup (node.js:136:18)
    at node.js:963:3