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-03 22:10:19 +00:00
|
|
|
var env = require("./npmci.env");
|
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)
|
|
|
|
.then(function () {
|
|
|
|
plugins.beautylog.info("now starting tests:");
|
|
|
|
npmci_bash_1.bash("npm test");
|
|
|
|
plugins.beautylog.success("test finished");
|
|
|
|
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 testDocker = function () {
|
|
|
|
var done = plugins.q.defer();
|
|
|
|
plugins.shelljs.exec("docker run --name " + env.repo.repo + " " + env.dockerTag());
|
|
|
|
done.resolve();
|
2016-05-30 00:29:30 +00:00
|
|
|
return done.promise;
|
|
|
|
};
|
|
|
|
|
2016-06-04 21:20:39 +00:00
|
|
|
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5wbWNpLnRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sZ0JBQWdCLENBQ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ICAgICB0ZXN0RG9ja2VyKClcbiAgICAgICAgICAgIC50aGVuKCgpPT57XG4gICAgICAgICAgICAgICAgZG9uZS5yZXNvbHZlKCk7XG4gICAgICAgICAgICB9KTtcbiAgICB9IGVsc2Uge1xuICAgICAgICBpbnN0YWxsKHZlcnNpb25BcmcpXG4gICAgICAgICAgICAudGhlbihucG1EZXBlbmRlbmNpZXMpXG4gICAgICAgICAgICAudGhlbigoKT0+e1xuICAgICAgICAgICAgICAgIHBsdWdpbnMuYmVhdXR5bG9nLmluZm8oXCJub3cgc3RhcnRpbmcgdGVzdHM6XCIpO1xuICAgICAgICAgICAgICAgIGJhc2goXCJucG0gdGVzdFwiKTtcbiAgICAgICAgICAgICAgICBwbHVnaW5zLmJlYXV0eWxvZy5zdWNjZXNzKFwidGVzdCBmaW5pc2hlZFwiKTtcbiAgICAgICAgICAgICAgICBkb25lLnJlc29sdmUoKTtcbiAgICAgICAgICAgIH0pO1xuICAgIH1cbiAgICByZXR1cm4gZG9uZS5wcm9taXNlO1xufVxuXG5sZXQgbnBtRGVwZW5kZW5jaWVzID0gZnVuY3Rpb24oKXtcbiAgICBsZXQgZG9uZSA9IHBsdWdpbnMucS5kZWZlcigpO1xuICAgIHBsdWdpbnMuYmVhdXR5bG9nLmluZm8oXCJub3cgaW5zdGFsbGluZyBkZXBlbmRlbmNpZXM6XCIpO1xuICAgIGJhc2goXCJucG0gaW5zdGFsbFwiKTtcbiAgICBkb25lLnJlc29sdmUoKTtcbiAgICByZXR1cm4gZG9uZS5wcm9taXNlO1xufVxuXG5sZXQgdGVzdERvY2tlciA9IGZ1bmN0aW9uKCl7XG4gICAgbGV0IGRvbmUgPSBwbHVnaW5zLnEuZGVmZXIoKTtcbiAgICBwbHVnaW5zLnNoZWxsanMuZXhlYyhcImRvY2tlciBydW4gLS1uYW1lIFwiICsgZW52LnJlcG8ucmVwbyArIFwiIFwiICsgZW52LmRvY2tlclRhZygpKTtcbiAgICBkb25lLnJlc29sdmUoKTtcbiAg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