Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import { LogContexts, Logger } from 'bs-logger'
import { Arguments } from 'yargs'
import yargsParser = require('yargs-parser')
import { rootLogger } from '../util/logger'
const VALID_COMMANDS = ['help', 'config:migrate', 'config:init']
const logger = rootLogger.child({ [LogContexts.namespace]: 'cli', [LogContexts.application]: 'ts-jest' })
/**
* @internal
*/
export type CliCommand = (argv: Arguments, logger: Logger) => Promise
async function cli(args: string[]): Promise {
const parsedArgv = yargsParser(args, {
boolean: ['dry-run', 'jest-preset', 'allow-js', 'diff', 'babel', 'force', 'jsdom'],
string: ['tsconfig', 'js'],
count: ['verbose'],
alias: { verbose: ['v'] },
default: { jestPreset: true, verbose: 0 },
coerce: {
js(val: string) {
const res = val.trim().toLowerCase()