import test from 'ava' import { resolve } from 'path' import rp from 'request-promise-native' import { Nuxt, Builder } from '..' import styleLoader from '../lib/builder/webpack/style-loader' import { interceptLog, release } from './helpers/console' import { loadConfig } from './helpers/config' const port = 4007 const url = route => 'http://localhost:' + port + route let nuxt = null let builder = null // Init nuxt.js and create server listening on localhost:4000 test.before('Init Nuxt.js', async t => { const config = loadConfig('with-config', { dev: false }) const logSpy = await interceptLog(async () => { nuxt = new Nuxt(config) builder = new Builder(nuxt) await builder.build() await nuxt.listen(port, 'localhost') }) t.true(logSpy.calledWithMatch('DONE')) t.true(logSpy.calledWithMatch('OPEN')) }) test.serial('/', async t => { const logSpy = await interceptLog() const { html } = await nuxt.renderRoute('/') t.true(html.includes('

I have custom configurations

')) release() t.true(logSpy.calledOnce) t.is(logSpy.args[0][0], 'Test plugin!') }) test('/ (global styles inlined)', async t => { const { html } = await nuxt.renderRoute('/') t.true(html.includes('.global-css-selector')) }) test.skip('/ (preload fonts)', async t => { const { html } = await nuxt.renderRoute('/') t.true( html.includes( ' { const { html } = await nuxt.renderRoute('/') t.true(html.includes('

Made by Nuxt.js team

')) }) test('/ (custom build.publicPath)', async t => { const { html } = await nuxt.renderRoute('/') t.true(html.includes('