Im attempting to make this Code Coverage functionality work from the Sails Documentation so from the project root I run
istanbul cover -x "**/config/**" _mocha -- --timeout 5000
Which returns
Unable to resolve file [_mocha]
So thinking maybe because I am using this generator something is different so I try to use a path that is what is fired when doing 'npm test'
istanbul cover test/bootstrap.js _mocha -- --timeout 5000
and I get
No coverage information was collected, exit without writing coverage information
…myprojectpath/test/bootstrap.js:1
import Sails from 'sails';
^^^^^^
I have little familiarity with Istanbul or mocha so I'm a little off in no man's land right now. For bonus points can someone tell me what the
-x
is doing?
*****EDIT*****
So using @MjZac suggestion below as the command line entry I was able to get it to work AFTER running
npm install -g mocha
However I notice my tests/generator might be more recent as it looks like ...
import Sails from 'sails';
import config from '../config/env/test';
let sails;
before(done => {
Sails.lift(config, (error, server) => {
if (error) return done(error);
sails = server;
done();
});
});
after(done => sails.lower(done));
Which is now producing the exception
import Sails from 'sails';
^^^^^^
SyntaxError: Unexpected token import
Which I think is related to ES6 and istanbul?