Open joanvila opened 7 years ago
I don't know if you copy pasted or if this is a transcribing issue but
require(../lib/jsfile.js)
should be
require('../lib/jsfile.js')
note the quotes as the path should be a string
Yes, sorry, I was writting it manually here and I forgot the quotes. It's actually const endpointBuilder = require('../lib/endpoint-builder');
. Also without the js extension.
However, when I run the tests without trying to generate the coverage report, they work fine.
Maybe I'm missing something about Blanket? I've only installed it as a dev dependency and created the coverage/blanket.js file.
Looking at the open PR in the repo, I've seen some discussion around the 'use strict'
. I'm using it everywhere. Is this a problem? I'm also using the const
and let
keywords for defining variables.
I have tried to remove all the use strict
, const
and let
and now It's giving me a different error in the same line of the require:
SyntaxError: Assigning to rvalue (9:37)
Moving away this test, the rest of them are working now so it's a problem with the require. I must be doing something wrong. The only problem it's giving now to me is:
Running "mochaTest:coverage" (mochaTest) task
"html-cov" reporter not found
It seems that html-cov is not included any more in mocha https://github.com/mochajs/mocha/issues/2356
I don't think it would be related to use strict
. And yes html-cov
is no longer supported. I have been migrating everything to istanbul
for coverage. At some point I'll change the docs here to recommend istanbul
instead
Perfect, meanwhile I'm using Istanbul with it's commands as a workaround while grunt-mocha-test
is being updated :)
Can someone show a demo on how to generate coverage report withistanbul
?
I'm following the readme to generate the coverage reports. I have a grunt task like this:
As it is in the readme.
I also created the blanket.js file changing the
src
dir tolib
dir as I am testing the js files that I have inside thelib
dir.The problem comes when I run the grunt task. It says to me:
The problem seems to be in a javascript test file. In a
require(../lib/jsfile.js)
. There, I'm requiring the actual js file from thelib
folder to test.Any thoughts on this? Thanks :)