@typed/test
Version:
Testing made simple.
55 lines (48 loc) • 1.18 kB
text/typescript
#!/usr/bin/env node
import yargs from 'yargs'
import { runTypedTest } from './runTypedTest'
import { TypedTestOptions } from './types'
const cliOptions = yargs
.options({
mode: {
choices: ['node', 'browser'],
requiresArg: true,
defaultDescription: 'node',
group: 'Typed Test',
},
timeout: {
number: true,
requiresArg: true,
defaultDescription: '2000',
group: 'Typed Test',
},
browser: {
choices: ['chrome', 'chromium', 'firefox', 'opera', 'safari', 'ie'],
defaultDescription: 'chrome',
group: 'Browser Mode',
},
keepAlive: {
boolean: true,
defaultDescription: 'false',
group: 'Browser Mode',
},
typeCheck: {
boolean: true,
defaultDescription: 'false',
group: 'Typed Test',
},
watch: {
boolean: true,
defaultDescription: 'false',
group: 'Typed Test',
},
})
.help().argv as Partial<TypedTestOptions> & { _: string[] }
const options = { ...cliOptions }
if (cliOptions._.length > 0) {
options.files = cliOptions._
}
runTypedTest(options).catch(error => {
console.error(error)
process.exit(1)
})