nd-jscover
Version:
Latest node wraper for JSCover.
72 lines (62 loc) • 1.99 kB
JavaScript
;
/**
* Module dependencies.
*/
var jscover = require('../');
var should = require('should');
var path = require('path');
var fs = require('fs');
var fse = require('fs-extra');
fs.existsSync = fs.existsSync || path.existsSync;
describe('jscover.test.js', function () {
var source = path.join(__dirname, 'lib');
var target = path.join(__dirname, 'lib-cov');
beforeEach(function () {
fse.removeSync(target);
});
it('should coverage lib to lib-cov', function (done) {
should.ok(!fs.existsSync(target));
jscover(source, target, null, function (err, stdout) {
should.not.exist(err);
should.exist(stdout);
should.ok(fs.existsSync(target));
done();
});
});
xit('should coverage lib to lib-cov with --exclude=subdir', function (done) {
should.ok(!fs.existsSync(target));
should.ok(!fs.existsSync(path.join(target, 'subdir')));
jscover(source, target, ['--exclude=subdir'], function (err, stdout) {
should.exist(err);
should.exist(stdout);
should.ok(fs.existsSync(target));
should.ok(!fs.existsSync(path.join(target, 'subdir')));
done();
});
});
xit('should return stdout when args missing', function (done) {
jscover('', null, {}, function (err) {
should.exist(err);
err.message.trim().should.endWith("A minimum of 3 arguments is required");
done();
});
});
xit('should return error when dir not exists', function (done) {
jscover('a', 'b', {}, function (err) {
should.exist(err);
err.name.should.equal('JSCoverError');
err.message.trim().should.endWith("Source directory 'a' is invalid");
done();
});
});
xdescribe('utf8', function () {
it('should coverage no-ascii char success', function (done) {
should.ok(!fs.existsSync(target));
jscover(source, target, null, function (err, output) {
should.exist(err);
should.exist(output);
done();
});
});
});
});