npmci/ts/npmci.test.ts

51 lines
1.3 KiB
TypeScript
Raw Normal View History

2016-05-30 00:28:47 +00:00
import "typings-global";
import * as plugins from "./npmci.plugins";
2016-05-30 01:40:07 +00:00
import {bash} from "./npmci.bash";
2016-05-30 00:28:47 +00:00
import {install} from "./npmci.install";
2016-06-03 16:20:05 +00:00
import * as env from "./npmci.env";
2016-06-07 02:31:25 +00:00
import * as NpmciBuildDocker from "./npmci.build.docker";
2016-05-30 01:40:07 +00:00
2016-05-30 00:28:47 +00:00
export let test = (versionArg) => {
let done = plugins.q.defer();
if(versionArg == "docker"){
testDocker()
.then(()=>{
done.resolve();
});
} else {
install(versionArg)
.then(npmDependencies)
2016-06-07 02:31:25 +00:00
.then(npmTest)
.then(()=>{
done.resolve();
});
}
2016-05-30 00:28:47 +00:00
return done.promise;
}
let npmDependencies = function(){
let done = plugins.q.defer();
plugins.beautylog.info("now installing dependencies:");
bash("npm install");
done.resolve();
return done.promise;
}
2016-06-07 02:31:25 +00:00
let npmTest = () => {
let done = plugins.q.defer();
2016-06-07 02:31:25 +00:00
plugins.beautylog.info("now starting tests:");
bash("npm test");
done.resolve();
return done.promise;
}
2016-06-07 02:31:25 +00:00
let testDocker = function(){
let done = plugins.q.defer();
NpmciBuildDocker.readDockerfiles()
.then(NpmciBuildDocker.pullDockerfileImages)
.then(NpmciBuildDocker.testDockerfiles)
.then(done.resolve)
return done.promise;
}