npmci/ts/npmci.test.ts

37 lines
1000 B
TypeScript
Raw Permalink Normal View History

2016-11-24 22:21:40 +00:00
import * as plugins from './npmci.plugins'
import { bash, yarnAvailable } from './npmci.bash'
2017-03-08 13:50:41 +00:00
import { install } from './npmci.install'
2016-11-24 22:21:40 +00:00
import * as env from './npmci.env'
import * as NpmciBuildDocker from './npmci.build.docker'
2016-05-30 01:40:07 +00:00
2017-03-08 13:50:41 +00:00
export let test = async (versionArg): Promise<void> => {
if (versionArg === 'docker') {
await testDocker()
} else {
await install(versionArg)
.then(npmDependencies)
.then(npmTest)
}
}
let npmDependencies = async (): Promise<void> => {
2017-03-08 13:50:41 +00:00
plugins.beautylog.info('now installing dependencies:')
if (await yarnAvailable.promise) {
await bash('yarn upgrade')
} else {
await bash('npm install')
}
}
2017-03-08 13:50:58 +00:00
let npmTest = async (): Promise<void> => {
2017-03-08 13:50:41 +00:00
plugins.beautylog.info('now starting tests:')
await bash('npm test')
}
2017-03-08 13:50:41 +00:00
let testDocker = async (): Promise<NpmciBuildDocker.Dockerfile[]> => {
return await NpmciBuildDocker.readDockerfiles()
.then(NpmciBuildDocker.pullDockerfileImages)
.then(NpmciBuildDocker.testDockerfiles)
2016-06-07 02:31:25 +00:00
}