How to use the consola.clear function in consola

To help you get started, we’ve selected a few consola examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bazzite / statusfy / test / config / site.spec.js View on Github external
test('invalid', () => {
    const realProcess = process
    const exitMock = jest.fn()
    consola.clear().add({
      log: jest.fn()
    })
    global.process = { ...realProcess, exit: exitMock }

    const sourceDir = path.resolve(tempPath, 'invalid')
    generateConfig(sourceDir, {})

    expect(consola.reporters[0]['log'].mock['calls'][0][0]['additional']).toMatchSnapshot()
    expect(exitMock).toHaveBeenCalledWith(1)
    global.process = realProcess
  })
})