diff --git a/package.json b/package.json index 600c948600..296d20925c 100644 --- a/package.json +++ b/package.json @@ -140,6 +140,7 @@ "puppeteer": "^0.13.0", "request": "^2.83.0", "request-promise-native": "^1.0.5", + "sinon": "^4.1.2", "std-mocks": "^1.0.1", "uglify-js": "^3.2.2" }, diff --git a/test/basic.ssr.test.js b/test/basic.ssr.test.js index 9e8e58b93f..0e5a98b237 100755 --- a/test/basic.ssr.test.js +++ b/test/basic.ssr.test.js @@ -1,8 +1,8 @@ import test from 'ava' import { resolve } from 'path' import rp from 'request-promise-native' -import stdMocks from 'std-mocks' import { Nuxt, Builder } from '..' +import { interceptLog, interceptError } from './helpers/console' const port = 4003 const url = (route) => 'http://localhost:' + port + route @@ -20,10 +20,12 @@ test.before('Init Nuxt.js', async t => { } } } - nuxt = new Nuxt(options) - await new Builder(nuxt).build() - await nuxt.listen(port, 'localhost') + await interceptLog('building nuxt', async () => { + nuxt = new Nuxt(options) + await new Builder(nuxt).build() + await nuxt.listen(port, 'localhost') + }) }) test('/stateless', async t => { @@ -61,17 +63,19 @@ test('/store', async t => { }) test('/head', async t => { - stdMocks.use() - const window = await nuxt.renderAndGetWindow(url('/head'), { virtualConsole: false }) - const html = window.document.body.innerHTML - const metas = window.document.getElementsByTagName('meta') - stdMocks.restore() - const { stdout } = stdMocks.flush() - t.is(stdout[0], 'Body script!\n') - t.is(window.document.title, 'My title - Nuxt.js') - t.is(metas[0].getAttribute('content'), 'my meta') - t.true(html.includes('

I can haz meta tags

')) - t.true(html.includes('