Nuxt/test/utils/setup.js
2020-05-05 23:53:07 +02:00

29 lines
605 B
JavaScript

import consola from 'consola'
import chalk from 'chalk'
import env from 'std-env'
import exit from 'exit'
const isWin = env.windows
describe.win = isWin ? describe : describe.skip
test.win = isWin ? test : test.skip
describe.posix = !isWin ? describe : describe.skip
test.posix = !isWin ? test : test.skip
chalk.level = 0
jest.setTimeout(60000)
jest.mock('esm', () => () => require)
consola.mockTypes(() => jest.fn())
function errorTrap (error) {
process.stderr.write('\n' + error.stack + '\n')
exit(1)
}
process.on('unhandledRejection', errorTrap)
process.on('uncaughtException', errorTrap)