41 lines
1.3 KiB
JavaScript
41 lines
1.3 KiB
JavaScript
#!/usr/bin/env node
|
|
|
|
/// <reference path="./typings/main.d.ts" />
|
|
var plugins = require("./npmts.plugins");
|
|
var paths = require("./npmts.paths");
|
|
exports.run = function (configArg) {
|
|
var done = plugins.q.defer();
|
|
var config = configArg;
|
|
var istanbul = function () {
|
|
var stream = plugins.gulp.src([plugins.path.join(paths.cwd, "dist/*.js")])
|
|
.pipe(plugins.g.istanbul())
|
|
.pipe(plugins.g.istanbul.hookRequire());
|
|
return stream;
|
|
};
|
|
var mocha = function () {
|
|
var stream = plugins.gulp.src(["./test/test.js"])
|
|
.pipe(plugins.g.mocha())
|
|
.pipe(plugins.g.istanbul.writeReports())
|
|
.pipe(plugins.g.istanbul.enforceThresholds({ thresholds: { global: 30 } }));
|
|
return stream;
|
|
};
|
|
var coveralls = function () {
|
|
var stream = plugins.gulp.src([plugins.path.join(paths.cwd, "./coverage/lcov.info")])
|
|
.pipe(plugins.g.coveralls());
|
|
return stream;
|
|
};
|
|
istanbul().on("finish", function () {
|
|
mocha().on("finish", function () {
|
|
if (process.env.TRAVIS && config.coveralls) {
|
|
coveralls().on("finish", function () {
|
|
done.resolve(config);
|
|
});
|
|
}
|
|
else {
|
|
done.resolve(config);
|
|
}
|
|
});
|
|
});
|
|
return done.promise;
|
|
};
|