I'm a newbie on Node.js, I have to setup some test in my application and I'm getting really mad on trying to generate a back-end coverage report with mocha
and istambul
in my loopback
application.
Searching through thousand of dab explained articles on Github I found some good articles and then I figured that I had to use something like this:
istanbul cover _mocha -- [path/to/test/files] -R spec
I was happy because it says: "What you are essentially doing is passing the command to run your tests to Istanbul which in turn, will run those tests on your behalf." but every time I try to run this I got this error:
No coverage information was collected, exit without writing coverage information
C:\...\proj-name\node_modules\.bin\_mocha:2
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
^^^^^^^
SyntaxError: missing ) after argument list
My working test file is:
var userService = require('../TestBusinessLogic.js');
var should = require('chai').should();
describe('API Utenti', function() {
it('should throw Exception on missing UserName', function() {
(function() {
userService({ Name: 'Pippo', Surname: 'Baudo' });
}).should.Throw(Error);
});
});
Is this command good to use? If not, could someone please explain me how to make a coverage report using istambul
with mocha
?
Aucun commentaire:
Enregistrer un commentaire