Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
[LogContexts.logLevel]: LogLevels.trace,
version: require('../../package.json').version,
},
targets: process.env.TS_JEST_LOG || undefined,
})
/**
* @internal
*/
export let rootLogger = createLogger(buildOptions())
backportTsJestDebugEnvVar(rootLogger)
// re-create the logger if the env var has been backported
if (original !== process.env.TS_JEST_LOG) {
rootLogger = createLogger(buildOptions())
}
const original = process.env.TS_JEST_LOG
const buildOptions = () => ({
context: {
[LogContexts.package]: 'ts-jest',
[LogContexts.logLevel]: LogLevels.trace,
version: require('../../package.json').version,
},
targets: process.env.TS_JEST_LOG || undefined,
})
/**
* @internal
*/
export let rootLogger = createLogger(buildOptions())
backportTsJestDebugEnvVar(rootLogger)
// re-create the logger if the env var has been backported
if (original !== process.env.TS_JEST_LOG) {
rootLogger = createLogger(buildOptions())
}
export const run: CliCommand = async (args: Arguments /*, logger: Logger*/) => {
const nullLogger = createLogger({ targets: [] })
const file = args._[0]
const filePath = resolve(process.cwd(), file)
const footNotes: string[] = []
if (!existsSync(filePath)) {
throw new Error(`Configuration file ${file} does not exists.`)
}
const name = basename(file)
const isPackage = name === 'package.json'
if (!/\.(js|json)$/.test(name)) {
throw new TypeError(`Configuration file ${file} must be a JavaScript or JSON file.`)
}
let actualConfig: jest.InitialOptions = require(filePath)
if (isPackage) {
actualConfig = (actualConfig as any).jest
}
if (!actualConfig) actualConfig = {}