mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-30 01:17:16 +00:00
test: add e2e plugin ordering assertion
This commit is contained in:
parent
c5e7cc737d
commit
6468452ccb
@ -983,6 +983,11 @@ describe('extends support', () => {
|
|||||||
const html = await $fetch('/foo')
|
const html = await $fetch('/foo')
|
||||||
expect(html).toContain('Plugin | foo: String generated from foo plugin!')
|
expect(html).toContain('Plugin | foo: String generated from foo plugin!')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('respects plugin ordering within layers', async () => {
|
||||||
|
const html = await $fetch('/plugins/ordering')
|
||||||
|
expect(html).toContain('catchall at plugins')
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('server', () => {
|
describe('server', () => {
|
||||||
|
3
test/fixtures/basic/extends/bar/plugins/09.layer-plugin-pre.ts
vendored
Normal file
3
test/fixtures/basic/extends/bar/plugins/09.layer-plugin-pre.ts
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
export default defineNuxtPlugin((nuxtApp) => {
|
||||||
|
nuxtApp.provide('layerPluginPre', 'layer-plugin')
|
||||||
|
})
|
3
test/fixtures/basic/extends/bar/plugins/11.layer-plugin-post.ts
vendored
Normal file
3
test/fixtures/basic/extends/bar/plugins/11.layer-plugin-post.ts
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
export default defineNuxtPlugin((nuxtApp) => {
|
||||||
|
nuxtApp.provide('layerPluginPost', 'layer-plugin')
|
||||||
|
})
|
10
test/fixtures/basic/plugins/10.layer-ordering.ts
vendored
Normal file
10
test/fixtures/basic/plugins/10.layer-ordering.ts
vendored
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
export default defineNuxtPlugin((nuxtApp) => {
|
||||||
|
if (useRoute().path === '/plugins/ordering') {
|
||||||
|
if (!nuxtApp.$layerPluginPre) {
|
||||||
|
throw createError('layer plugin failed to run before end project plugin')
|
||||||
|
}
|
||||||
|
if (nuxtApp.$layerPluginPost) {
|
||||||
|
throw createError('layer plugin failed to run after end project plugin')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
Loading…
Reference in New Issue
Block a user