npmci/ts/npmci.test.ts

37 lines
1000 B
TypeScript
Raw Normal View History

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