mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-27 16:12:12 +00:00
update tests
This commit is contained in:
parent
9226f606b5
commit
b02dfc7ebc
4
test/fixtures/module/modules/basic/index.js
vendored
4
test/fixtures/module/modules/basic/index.js
vendored
@ -23,8 +23,8 @@ module.exports = function basicModule (options, resolve) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
// Require same module twice
|
// Require same module twice
|
||||||
this.requireModule('@/modules/empty/index.js')
|
this.requireModule('~/modules/empty/index.js')
|
||||||
this.requireModule('@/modules/empty/index.js')
|
this.requireModule('~/modules/empty/index.js')
|
||||||
|
|
||||||
resolve()
|
resolve()
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
module.exports = function middlewareModule (options) {
|
module.exports = function middlewareModule (options) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
// Add /api endpoint
|
// Add /api endpoint
|
||||||
@ -9,14 +8,14 @@ module.exports = function middlewareModule (options) {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
// Add local middleware js
|
// Add local middleware js
|
||||||
this.addServerMiddleware('@modules/middleware/log.js')
|
this.addServerMiddleware('~/modules/middleware/log.js')
|
||||||
// Add plain middleware
|
// Add plain middleware
|
||||||
this.addServerMiddleware((req, res, next) => {
|
this.addServerMiddleware((req, res, next) => {
|
||||||
res.setHeader('x-nuxt', 'hello')
|
res.setHeader('x-nuxt', 'hello')
|
||||||
next()
|
next()
|
||||||
})
|
})
|
||||||
// Add file middleware
|
// Add file middleware
|
||||||
this.addServerMiddleware('@modules/middleware/midd1')
|
this.addServerMiddleware('~/modules/middleware/midd1')
|
||||||
resolve()
|
resolve()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
module.exports = function (req, res, next) {
|
module.exports = function (req, res, next) {
|
||||||
res.setHeader('x-midd-1', 'ok')
|
res.setHeader('x-midd-1', 'ok')
|
||||||
next()
|
next()
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
module.exports = function (req, res, next) {
|
module.exports = function (req, res, next) {
|
||||||
res.setHeader('x-midd-2', 'ok')
|
res.setHeader('x-midd-2', 'ok')
|
||||||
next()
|
next()
|
||||||
}
|
}
|
4
test/fixtures/module/nuxt.config.js
vendored
4
test/fixtures/module/nuxt.config.js
vendored
@ -1,9 +1,9 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
loading: true,
|
loading: true,
|
||||||
modules: [
|
modules: [
|
||||||
'~modules/basic', // Use ~ for deprication warning coverage
|
'~/modules/basic', // Use ~ for deprication warning coverage
|
||||||
{
|
{
|
||||||
src: '@/modules/middleware',
|
src: '~/modules/middleware',
|
||||||
options: {
|
options: {
|
||||||
foo: 'bar'
|
foo: 'bar'
|
||||||
}
|
}
|
||||||
|
4
test/fixtures/module/router.js
vendored
4
test/fixtures/module/router.js
vendored
@ -9,12 +9,12 @@ export function createRouter () {
|
|||||||
routes: [
|
routes: [
|
||||||
{
|
{
|
||||||
path: '/',
|
path: '/',
|
||||||
component: require('~/views/index.vue'),
|
component: require('~/views/index.vue').default,
|
||||||
name: 'index'
|
name: 'index'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/about',
|
path: '/about',
|
||||||
component: require('~/views/about.vue'),
|
component: require('~/views/about.vue').default,
|
||||||
name: 'about'
|
name: 'about'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
10
test/fixtures/with-config/nuxt.config.js
vendored
10
test/fixtures/with-config/nuxt.config.js
vendored
@ -7,17 +7,17 @@ module.exports = {
|
|||||||
routes.push({
|
routes.push({
|
||||||
name: 'about-bis',
|
name: 'about-bis',
|
||||||
path: '/about-bis',
|
path: '/about-bis',
|
||||||
component: '@pages/about.vue'
|
component: '~/pages/about.vue'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
transition: 'test',
|
transition: 'test',
|
||||||
offline: true,
|
offline: true,
|
||||||
plugins: [
|
plugins: [
|
||||||
'~plugins/test.js', // Use ~ for deprication warning coverage
|
'~/plugins/test.js', // Use ~ for deprication warning coverage
|
||||||
{ src: '@plugins/only-client.js', ssr: false }
|
{ src: '~/plugins/only-client.js', ssr: false }
|
||||||
],
|
],
|
||||||
loading: '@components/loading',
|
loading: '~/components/loading',
|
||||||
env: {
|
env: {
|
||||||
bool: true,
|
bool: true,
|
||||||
num: 23,
|
num: 23,
|
||||||
@ -35,7 +35,7 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
css: [
|
css: [
|
||||||
{ src: '@assets/app.css' }
|
{ src: '~/assets/app.css' }
|
||||||
],
|
],
|
||||||
render: {
|
render: {
|
||||||
http2: {
|
http2: {
|
||||||
|
Loading…
Reference in New Issue
Block a user