mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-11 19:28:05 +00:00
test: externals and deprecated dev in build.extend
This commit is contained in:
parent
0fd9774d11
commit
adc6884ed1
6
test/fixtures/with-config/nuxt.config.js
vendored
6
test/fixtures/with-config/nuxt.config.js
vendored
@ -1,3 +1,5 @@
|
|||||||
|
const path = require('path')
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
srcDir: __dirname,
|
srcDir: __dirname,
|
||||||
router: {
|
router: {
|
||||||
@ -14,6 +16,7 @@ module.exports = {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
modulesDir: path.join(__dirname, '..', '..', '..', 'node_modules'),
|
||||||
transition: 'test',
|
transition: 'test',
|
||||||
layoutTransition: 'test',
|
layoutTransition: 'test',
|
||||||
offline: true,
|
offline: true,
|
||||||
@ -43,6 +46,9 @@ module.exports = {
|
|||||||
generateStatsFile: true
|
generateStatsFile: true
|
||||||
},
|
},
|
||||||
extend(config, options) {
|
extend(config, options) {
|
||||||
|
if (options.dev) {
|
||||||
|
// Please use isDev instead of dev
|
||||||
|
}
|
||||||
return Object.assign({}, config, {
|
return Object.assign({}, config, {
|
||||||
devtool: 'nosources-source-map'
|
devtool: 'nosources-source-map'
|
||||||
})
|
})
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import test from 'ava'
|
import test from 'ava'
|
||||||
import { resolve } from 'path'
|
import { resolve } from 'path'
|
||||||
|
import stdMocks from 'std-mocks'
|
||||||
import rp from 'request-promise-native'
|
import rp from 'request-promise-native'
|
||||||
import { Nuxt, Builder } from '../index.js'
|
import { Nuxt, Builder } from '../index.js'
|
||||||
|
|
||||||
@ -7,6 +8,7 @@ const port = 4007
|
|||||||
const url = (route) => 'http://localhost:' + port + route
|
const url = (route) => 'http://localhost:' + port + route
|
||||||
|
|
||||||
let nuxt = null
|
let nuxt = null
|
||||||
|
let builtErr = null
|
||||||
|
|
||||||
// Init nuxt.js and create server listening on localhost:4000
|
// Init nuxt.js and create server listening on localhost:4000
|
||||||
test.before('Init Nuxt.js', async t => {
|
test.before('Init Nuxt.js', async t => {
|
||||||
@ -15,7 +17,14 @@ test.before('Init Nuxt.js', async t => {
|
|||||||
config.rootDir = rootDir
|
config.rootDir = rootDir
|
||||||
config.dev = false
|
config.dev = false
|
||||||
nuxt = new Nuxt(config)
|
nuxt = new Nuxt(config)
|
||||||
|
|
||||||
|
stdMocks.use({
|
||||||
|
stdout: false,
|
||||||
|
stderr: true
|
||||||
|
})
|
||||||
await new Builder(nuxt).build()
|
await new Builder(nuxt).build()
|
||||||
|
stdMocks.restore()
|
||||||
|
builtErr = stdMocks.flush().stderr
|
||||||
|
|
||||||
await nuxt.listen(port, 'localhost')
|
await nuxt.listen(port, 'localhost')
|
||||||
})
|
})
|
||||||
@ -124,6 +133,12 @@ test('Check /test.txt should return 404', async t => {
|
|||||||
t.is(err.response.statusCode, 404)
|
t.is(err.response.statusCode, 404)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test('Check deprecated dev in build.extend()', async t => {
|
||||||
|
const deprecatedMsg = 'dev has been deprecated in build.extend(), please use isDev\n'
|
||||||
|
const errors = builtErr.filter(value => value === deprecatedMsg)
|
||||||
|
t.true(errors.length === 2)
|
||||||
|
})
|
||||||
|
|
||||||
// Close server and ask nuxt to stop listening to file changes
|
// Close server and ask nuxt to stop listening to file changes
|
||||||
test.after('Closing server and nuxt.js', t => {
|
test.after('Closing server and nuxt.js', t => {
|
||||||
nuxt.close()
|
nuxt.close()
|
||||||
|
Loading…
Reference in New Issue
Block a user