import { existsSync } from 'fs' import { resolve } from 'upath' import jsdom from 'jsdom' import Glob from 'glob' import pify from 'pify' import { getPort, loadFixture, Nuxt, rp } from '../utils' const glob = pify(Glob) let port const url = route => 'http://localhost:' + port + route let nuxt = null describe('with-config', () => { beforeAll(async () => { const config = await loadFixture('with-config') nuxt = new Nuxt(config) await nuxt.ready() port = await getPort() await nuxt.server.listen(port, 'localhost') }) test('client source map generated', async () => { const jsFiles = await glob(resolve(__dirname, '..', 'fixtures/with-config/.nuxt/dist/client/*.js')) for (const file of jsFiles) { expect(existsSync(`${file}.map`)).toBe(true) } }) test('/', async () => { const { html } = await nuxt.server.renderRoute('/') expect(html).toContain('

I have custom configurations

') }) test('/ (global styles inlined)', async () => { const window = await nuxt.server.renderAndGetWindow(url('/test/')) const html = window.document.head.innerHTML expect(html).toContain('.global-css-selector') }) test('/ (preload fonts)', async () => { const { html } = await nuxt.server.renderRoute('/') expect(html).toMatch( / { const { html } = await nuxt.server.renderRoute('/') expect(html).toContain('.pre-process-selector') }) test('/ (custom app.html)', async () => { const { html } = await nuxt.server.renderRoute('/') expect(html).toContain('

Made by Nuxt team

') }) test('/ (custom build.publicPath)', async () => { const { html } = await nuxt.server.renderRoute('/') expect(html).toContain('