diff --git a/test/unit/basic.ssr.test.js b/test/unit/basic.ssr.test.js index 52e2fd9313..dc86614614 100644 --- a/test/unit/basic.ssr.test.js +++ b/test/unit/basic.ssr.test.js @@ -1,3 +1,4 @@ +import consola from 'consola' import { loadFixture, getPort, Nuxt, rp } from '../utils' let port @@ -56,10 +57,9 @@ describe('basic ssr', () => { }) test('/head', async () => { - // const logSpy = await interceptLog() - const window = await nuxt.renderAndGetWindow(url('/head'), { - virtualConsole: false - }) + jest.spyOn(consola, 'log') + + const window = await nuxt.renderAndGetWindow(url('/head')) expect(window.document.title).toBe('My title - Nuxt.js') const html = window.document.body.innerHTML @@ -70,10 +70,9 @@ describe('basic ssr', () => { const metas = window.document.getElementsByTagName('meta') expect(metas[0].getAttribute('content')).toBe('my meta') - // release() + expect(consola.log).toHaveBeenCalledWith('Body script!') - // expect(logSpy.calledOnce).toBe(true) - // expect(logSpy.args[0][0]).toBe('Body script!') + consola.log.mockRestore() }) test('/async-data', async () => { @@ -115,9 +114,7 @@ describe('basic ssr', () => { test('/redirect -> check redirected source', async () => { // there are no transition properties in jsdom, ignore the error log - // await interceptError() const window = await nuxt.renderAndGetWindow(url('/redirect')) - // release() const html = window.document.body.innerHTML expect(html.includes('