mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-23 14:15:13 +00:00
test(custom-dirs): fix custom-asset dir test (#4136)
This commit is contained in:
parent
ae2d31ed19
commit
411e89e52c
20
test/fixtures/custom-dirs/nuxt.config.js
vendored
20
test/fixtures/custom-dirs/nuxt.config.js
vendored
@ -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',
|
||||||
|
@ -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 () => {
|
||||||
|
Loading…
Reference in New Issue
Block a user