Skip to content

Commit

Permalink
fix(test): mock consola on each test
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 authored and manniL committed Oct 13, 2018
1 parent c6f0425 commit 40e966a
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions test/module.test.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
const consola = require('consola')

consola.clear().add({
log: jest.fn()
})

const { Nuxt, Builder } = require('nuxt-edge')

const timeout = 60 * 1000

describe('ssr', () => {
let log

beforeEach(() => {
log = jest.fn()
consola.clear().add({ log })
})

test('server variables only accessible on server-bundle', async () => {
const nuxt = await setupNuxt(require('./fixture/configs/ssr'))
const { html } = await nuxt.renderRoute('/')
Expand All @@ -31,7 +34,7 @@ describe('ssr', () => {

test('error when no object is provided', async () => {
const nuxt = await setupNuxt(require('./fixture/configs/no-object'))
expect(consola.error).toHaveBeenCalledTimes(1)
expect(log).toHaveBeenCalledTimes(1)
await nuxt.close()
}, timeout)
})
Expand Down

0 comments on commit 40e966a

Please sign in to comment.