test: correct test according to #25305. Failing on main branch

This commit is contained in:
julien huang 2024-01-19 18:22:43 +01:00
parent e231357dbb
commit 57fe967f14
1 changed files with 26 additions and 7 deletions

View File

@ -244,24 +244,43 @@ describe('plugin dependsOn', () => {
'end B' 'end B'
]) ])
}) })
it('expect B to execute after A, C when B depends on A and C', async () => { it('expect B to execute after A, C when B depends on A and C #25305', async () => {
const nuxtApp = useNuxtApp() const nuxtApp = useNuxtApp()
const sequence: string[] = [] const sequence: string[] = []
const plugins = [ const plugins = [
pluginFactory('A', undefined, sequence), defineNuxtPlugin({
pluginFactory('B', ['A', 'C'], sequence), name: 'A',
pluginFactory('C', undefined, sequence) async setup () {
sequence.push('start A')
sequence.push('end A')
}
}),
defineNuxtPlugin({
name: 'B',
dependsOn: ['A', 'C'],
async setup () {
sequence.push('start B')
sequence.push('end B')
}
}),
defineNuxtPlugin({
name: 'C',
async setup () {
sequence.push('start C')
sequence.push('end C')
}
})
] ]
await applyPlugins(nuxtApp, plugins) await applyPlugins(nuxtApp, plugins)
expect(sequence).toMatchObject([ expect(sequence).toMatchObject([
'start A', 'start A',
'start C',
'end A', 'end A',
'start C',
'end C', 'end C',
'start B', 'start B',
'end B' 'end B',
]) ])
}) })
}) })