npmci/dist/npmci.test.js

49 lines
5.2 KiB
JavaScript
Raw Permalink Normal View History

2016-05-30 00:29:30 +00:00
"use strict";
require("typings-global");
var plugins = require("./npmci.plugins");
2016-05-30 01:40:07 +00:00
var npmci_bash_1 = require("./npmci.bash");
2016-05-30 00:29:30 +00:00
var npmci_install_1 = require("./npmci.install");
2016-06-07 02:31:25 +00:00
var NpmciBuildDocker = require("./npmci.build.docker");
2016-05-30 00:29:30 +00:00
exports.test = function (versionArg) {
var done = plugins.q.defer();
2016-06-03 22:10:19 +00:00
if (versionArg == "docker") {
testDocker()
.then(function () {
done.resolve();
});
}
else {
npmci_install_1.install(versionArg)
.then(npmDependencies)
2016-06-07 02:31:25 +00:00
.then(npmTest)
2016-06-03 22:10:19 +00:00
.then(function () {
done.resolve();
});
}
return done.promise;
};
var npmDependencies = function () {
var done = plugins.q.defer();
plugins.beautylog.info("now installing dependencies:");
npmci_bash_1.bash("npm install");
done.resolve();
return done.promise;
};
2016-06-07 02:31:25 +00:00
var npmTest = function () {
2016-06-03 22:10:19 +00:00
var done = plugins.q.defer();
2016-06-07 02:31:25 +00:00
plugins.beautylog.info("now starting tests:");
npmci_bash_1.bash("npm test");
2016-06-03 22:10:19 +00:00
done.resolve();
2016-05-30 00:29:30 +00:00
return done.promise;
};
2016-06-07 02:31:25 +00:00
var testDocker = function () {
var done = plugins.q.defer();
NpmciBuildDocker.readDockerfiles()
.then(NpmciBuildDocker.pullDockerfileImages)
.then(NpmciBuildDocker.testDockerfiles)
.then(done.resolve);
return done.promise;
};
2016-05-30 00:29:30 +00:00
2016-06-07 08:21:56 +00:00
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5wbWNpLnRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sZ0JBQWdCLENBQUMsQ0FBQTtBQUN4QixJQUFZLE9BQU8sV0FBTSxpQkFBaUIsQ0FBQyxDQUF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