npmci/ts/npmci.test.ts

50 lines
1.2 KiB
TypeScript
Raw Permalink Normal View History

2016-11-24 22:21:40 +00:00
import * as plugins from './npmci.plugins'
import {bash} from './npmci.bash'
import {install} from './npmci.install'
import * as env from './npmci.env'
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) => {
2016-11-24 22:21:40 +00:00
let done = plugins.q.defer()
if (versionArg === 'docker') {
testDocker()
2016-11-24 22:21:40 +00:00
.then(() => {
done.resolve()
})
} else {
install(versionArg)
.then(npmDependencies)
2016-06-07 02:31:25 +00:00
.then(npmTest)
2016-11-24 22:21:40 +00:00
.then(() => {
done.resolve()
})
}
2016-11-24 22:21:40 +00:00
return done.promise
}
let npmDependencies = function(){
2016-11-24 22:21:40 +00:00
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 = () => {
2016-11-24 22:21:40 +00:00
let done = plugins.q.defer()
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(){
2016-11-24 22:21:40 +00:00
let done = plugins.q.defer()
2016-06-07 02:31:25 +00:00
NpmciBuildDocker.readDockerfiles()
.then(NpmciBuildDocker.pullDockerfileImages)
.then(NpmciBuildDocker.testDockerfiles)
.then(done.resolve)
2016-11-24 22:21:40 +00:00
return done.promise
2016-06-07 02:31:25 +00:00
}