test(custom-dirs): fix custom-asset dir test (#4136)

This commit is contained in:
Alexander Lichter 2018-10-16 22:55:56 +01:00 committed by Pooya Parsa
parent ae2d31ed19
commit 411e89e52c
2 changed files with 31 additions and 4 deletions

View File

@ -1,4 +1,24 @@
export default { export default {
build: {
extractCSS: true,
optimization: {
splitChunks: {
name: true
}
},
postcss: {
preset: {
autoprefixer: {
grid: true
}
}
},
filenames: {
css: () => {
return '[name].css'
}
}
},
css: [{ src: '~/custom-assets/app.css' }], css: [{ src: '~/custom-assets/app.css' }],
dir: { dir: {
assets: 'custom-assets', assets: 'custom-assets',

View File

@ -1,4 +1,7 @@
import { loadFixture, getPort, Nuxt, rp } from '../utils' import { resolve } from 'path'
import { promisify } from 'util'
import fs from 'fs'
import { getPort, loadFixture, Nuxt, rp } from '../utils'
let port let port
const url = route => 'http://localhost:' + port + route const url = route => 'http://localhost:' + port + route
@ -13,9 +16,13 @@ describe('custom-dirs', () => {
await nuxt.listen(port, 'localhost') await nuxt.listen(port, 'localhost')
}) })
test.skip('custom assets directory', async () => { test('custom assets directory', async () => {
const { html } = await nuxt.renderRoute('/') const readFile = promisify(fs.readFile)
expect(html).toContain('.global-css-selector')
const extractedIndexCss = resolve(__dirname, '..', 'fixtures/custom-dirs/.nuxt/dist/client/app.css')
const content = await readFile(extractedIndexCss, 'utf-8')
expect(content).toContain('.global-css-selector{color:red}')
}) })
test('custom layouts directory', async () => { test('custom layouts directory', async () => {