npmci/dist/npmci.test.js

49 lines
5.2 KiB
JavaScript

"use strict";
require("typings-global");
var plugins = require("./npmci.plugins");
var npmci_bash_1 = require("./npmci.bash");
var npmci_install_1 = require("./npmci.install");
var NpmciBuildDocker = require("./npmci.build.docker");
exports.test = function (versionArg) {
var done = plugins.q.defer();
if (versionArg == "docker") {
testDocker()
.then(function () {
done.resolve();
});
}
else {
npmci_install_1.install(versionArg)
.then(npmDependencies)
.then(npmTest)
.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;
};
var npmTest = function () {
var done = plugins.q.defer();
plugins.beautylog.info("now starting tests:");
npmci_bash_1.bash("npm test");
done.resolve();
return done.promise;
};
var testDocker = function () {
var done = plugins.q.defer();
NpmciBuildDocker.readDockerfiles()
.then(NpmciBuildDocker.pullDockerfileImages)
.then(NpmciBuildDocker.testDockerfiles)
.then(done.resolve);
return done.promise;
};
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5wbWNpLnRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sZ0JBQWdCLENBQUMsQ0FBQTtBQUN4QixJQUFZLE9BQU8sV0FBTSxpQkFBaUIsQ0FBQyxDQUFBO0FBQzNDLDJCQUFtQixjQUFjLENBQUMsQ0FBQTtBQUNsQyw4QkFBc0IsaUJBQWlCLENBQUMsQ0FBQTtBQUV4QyxJQUFZLGdCQUFnQixXQUFNLHNCQUFzQixDQUFDLENBQUE7QUFFOUMsWUFBSSxHQUFHLFVBQUMsVUFBVTtJQUN6QixJQUFJLElBQUksR0FBRyxPQUFPLENBQUMsQ0FBQyxDQUFDLEtBQUssRUFBRSxDQUFDO0lBQzdCLEVBQUUsQ0FBQSxDQUFDLFVBQVUsSUFBSSxRQUFRLENBQUMsQ0FBQSxDQUF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