mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-17 06:01:34 +00:00
test: add test for dll
This commit is contained in:
parent
44e3407a6b
commit
b28cfe0db8
31
test/dll.test.js
Normal file
31
test/dll.test.js
Normal file
@ -0,0 +1,31 @@
|
||||
import test from 'ava'
|
||||
import { resolve } from 'path'
|
||||
import fs from 'fs'
|
||||
import pify from 'pify'
|
||||
import { Nuxt, Builder } from '../index.js'
|
||||
|
||||
const readFile = pify(fs.readFile)
|
||||
const rootDir = resolve(__dirname, './fixtures/dll')
|
||||
const dllDir = resolve(rootDir, '.cache/client-dll')
|
||||
|
||||
const checkCache = (lib) => {
|
||||
return async (t) => {
|
||||
const manifest = await readFile(resolve(dllDir, `./${lib}-manifest.json`), 'utf-8')
|
||||
t.truthy(JSON.parse(manifest).name)
|
||||
t.true(fs.existsSync(resolve(dllDir, `./${JSON.parse(manifest).name}.js`)))
|
||||
}
|
||||
}
|
||||
|
||||
test.before('Init Nuxt.js', async t => {
|
||||
let config = require(resolve(rootDir, 'nuxt.config.js'))
|
||||
config.rootDir = rootDir
|
||||
config.dev = true
|
||||
const nuxt = new Nuxt(config)
|
||||
await new Builder(nuxt).build()
|
||||
})
|
||||
|
||||
test('Check vue cache', checkCache('vue'))
|
||||
|
||||
test('Check vue-meta cache', checkCache('vue-meta'))
|
||||
|
||||
test('Check vue-router cache', checkCache('vue-router'))
|
5
test/fixtures/dll/nuxt.config.js
vendored
Normal file
5
test/fixtures/dll/nuxt.config.js
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
module.exports = {
|
||||
build: {
|
||||
dll: true
|
||||
}
|
||||
}
|
0
test/fixtures/dll/pages/index.vue
vendored
Normal file
0
test/fixtures/dll/pages/index.vue
vendored
Normal file
Loading…
Reference in New Issue
Block a user