npmci/dist/mod_test/index.js

49 lines
3.6 KiB
JavaScript

"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const plugins = require("./mod.plugins");
const npmci_bash_1 = require("../npmci.bash");
const npmciMods = require("../npmci.mods");
let npmDependencies = () => __awaiter(this, void 0, void 0, function* () {
plugins.beautylog.info('now installing dependencies:');
if (yield npmci_bash_1.yarnAvailable.promise) {
yield npmci_bash_1.bash('yarn install');
}
else {
yield npmci_bash_1.bash('npm install');
}
});
let npmTest = () => __awaiter(this, void 0, void 0, function* () {
plugins.beautylog.info('now starting tests:');
yield npmci_bash_1.bash('npm test');
});
let testDocker = (argvArg) => __awaiter(this, void 0, void 0, function* () {
let modDocker = yield npmciMods.modDocker.load();
return yield modDocker.readDockerfiles(argvArg)
.then(modDocker.pullDockerfileImages)
.then(modDocker.testDockerfiles);
});
/**
* the main test function
* @param versionArg
*/
exports.test = (argvArg) => __awaiter(this, void 0, void 0, function* () {
let whatToTest = argvArg._[1];
if (whatToTest === 'docker') {
yield testDocker(argvArg);
}
else {
let modInstall = yield npmciMods.modInstall.load();
yield modInstall.install(whatToTest)
.then(npmDependencies)
.then(npmTest);
}
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi90cy9tb2RfdGVzdC9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7O0FBQUEseUNBQXdDO0FBQ3hDLDhDQUFtRDt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