mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-06 21:10:38 +00:00
refactor: move nuxt.close to afterAll
This commit is contained in:
parent
050ed02fee
commit
005f3cb9db
@ -191,11 +191,11 @@ describe('basic browser', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
// Close server and ask nuxt to stop listening to file changes
|
// Close server and ask nuxt to stop listening to file changes
|
||||||
test('Closing server and nuxt.js', async () => {
|
afterAll('Closing server and nuxt.js', async () => {
|
||||||
await nuxt.close()
|
await nuxt.close()
|
||||||
})
|
})
|
||||||
|
|
||||||
test('Stop browser', async () => {
|
afterAll('Stop browser', async () => {
|
||||||
await page.close()
|
await page.close()
|
||||||
await browser.close()
|
await browser.close()
|
||||||
})
|
})
|
||||||
|
@ -121,11 +121,11 @@ describe('children patch (browser)', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
// Close server and ask nuxt to stop listening to file changes
|
// Close server and ask nuxt to stop listening to file changes
|
||||||
test('Closing server and nuxt.js', async () => {
|
afterAll('Closing server and nuxt.js', async () => {
|
||||||
await nuxt.close()
|
await nuxt.close()
|
||||||
})
|
})
|
||||||
|
|
||||||
test('Stop browser', async () => {
|
afterAll('Stop browser', async () => {
|
||||||
await page.close()
|
await page.close()
|
||||||
await browser.close()
|
await browser.close()
|
||||||
})
|
})
|
||||||
|
@ -48,7 +48,7 @@ describe('basic dev', () => {
|
|||||||
// })
|
// })
|
||||||
|
|
||||||
// Close server and ask nuxt to stop listening to file changes
|
// Close server and ask nuxt to stop listening to file changes
|
||||||
test('Closing server and nuxt.js', async () => {
|
afterAll('Closing server and nuxt.js', async () => {
|
||||||
await nuxt.close()
|
await nuxt.close()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -181,7 +181,7 @@ describe('basic generate', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
// Close server and ask nuxt to stop listening to file changes
|
// Close server and ask nuxt to stop listening to file changes
|
||||||
test('Closing server', async () => {
|
afterAll('Closing server', async () => {
|
||||||
await server.close()
|
await server.close()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -266,7 +266,7 @@ describe('basic ssr', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
// Close server and ask nuxt to stop listening to file changes
|
// Close server and ask nuxt to stop listening to file changes
|
||||||
test('Closing server and nuxt.js', async () => {
|
afterAll('Closing server and nuxt.js', async () => {
|
||||||
await nuxt.close()
|
await nuxt.close()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -48,7 +48,7 @@ describe('children', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
// Close server and ask nuxt to stop listening to file changes
|
// Close server and ask nuxt to stop listening to file changes
|
||||||
test('Closing server and nuxt.js', async () => {
|
afterAll('Closing server and nuxt.js', async () => {
|
||||||
await nuxt.close()
|
await nuxt.close()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -42,7 +42,7 @@ describe('custom-dirs', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
// Close server and ask nuxt to stop listening to file changes
|
// Close server and ask nuxt to stop listening to file changes
|
||||||
test('Closing server and nuxt.js', async () => {
|
afterAll('Closing server and nuxt.js', async () => {
|
||||||
await nuxt.close()
|
await nuxt.close()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -89,7 +89,7 @@ describe.skip('debug', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
// Close server and ask nuxt to stop listening to file changes
|
// Close server and ask nuxt to stop listening to file changes
|
||||||
test('Closing server and nuxt.js', async () => {
|
afterAll('Closing server and nuxt.js', async () => {
|
||||||
await nuxt.close()
|
await nuxt.close()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -15,7 +15,7 @@ describe('deprecate', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
// Close server and ask nuxt to stop listening to file changes
|
// Close server and ask nuxt to stop listening to file changes
|
||||||
test('Closing server and nuxt.js', async () => {
|
afterAll('Closing server and nuxt.js', async () => {
|
||||||
await nuxt.close()
|
await nuxt.close()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -39,7 +39,7 @@ describe('error', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
// Close server and ask nuxt to stop listening to file changes
|
// Close server and ask nuxt to stop listening to file changes
|
||||||
test('Closing server and nuxt.js', async () => {
|
afterAll('Closing server and nuxt.js', async () => {
|
||||||
await nuxt.close()
|
await nuxt.close()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -32,7 +32,7 @@ describe('express', () => {
|
|||||||
expect(html.includes('<h1>My component!</h1>')).toBe(true)
|
expect(html.includes('<h1>My component!</h1>')).toBe(true)
|
||||||
})
|
})
|
||||||
|
|
||||||
test('close server', async () => {
|
afterAll('close server', async () => {
|
||||||
await nuxt.close()
|
await nuxt.close()
|
||||||
await new Promise((resolve, reject) => {
|
await new Promise((resolve, reject) => {
|
||||||
server.close(err => err ? reject(err) : resolve())
|
server.close(err => err ? reject(err) : resolve())
|
||||||
|
@ -75,7 +75,7 @@ describe('fallback generate', () => {
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Close server and ask nuxt to stop listening to file changes
|
// Close server and ask nuxt to stop listening to file changes
|
||||||
test('Closing server', async () => {
|
afterAll('Closing server', async () => {
|
||||||
await server.close()
|
await server.close()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -7,52 +7,54 @@ const url = route => 'http://localhost:' + port + route
|
|||||||
let nuxt = null
|
let nuxt = null
|
||||||
// let buildSpies = null
|
// let buildSpies = null
|
||||||
|
|
||||||
beforeAll(async () => {
|
describe.skip('module', () => {
|
||||||
|
beforeAll(async () => {
|
||||||
const config = loadFixture('module')
|
const config = loadFixture('module')
|
||||||
nuxt = new Nuxt(config)
|
nuxt = new Nuxt(config)
|
||||||
port = await getPort()
|
port = await getPort()
|
||||||
await nuxt.listen(port, 'localhost')
|
await nuxt.listen(port, 'localhost')
|
||||||
})
|
})
|
||||||
|
|
||||||
test('Plugin', async () => {
|
test('Plugin', async () => {
|
||||||
expect(normalize(nuxt.options.plugins[0].src).includes(
|
expect(normalize(nuxt.options.plugins[0].src).includes(
|
||||||
normalize('fixtures/module/.nuxt/basic.reverse.')
|
normalize('fixtures/module/.nuxt/basic.reverse.')
|
||||||
)).toBe(true)
|
)).toBe(true)
|
||||||
const { html } = await nuxt.renderRoute('/')
|
const { html } = await nuxt.renderRoute('/')
|
||||||
expect(html.includes('<h1>TXUN</h1>')).toBe(true)
|
expect(html.includes('<h1>TXUN</h1>')).toBe(true)
|
||||||
})
|
})
|
||||||
|
|
||||||
test('Layout', async () => {
|
test('Layout', async () => {
|
||||||
expect(nuxt.options.layouts.layout.includes('layout')).toBe(true)
|
expect(nuxt.options.layouts.layout.includes('layout')).toBe(true)
|
||||||
|
|
||||||
const { html } = await nuxt.renderRoute('/layout')
|
const { html } = await nuxt.renderRoute('/layout')
|
||||||
expect(html.includes('<h1>Module Layouts</h1>')).toBe(true)
|
expect(html.includes('<h1>Module Layouts</h1>')).toBe(true)
|
||||||
})
|
})
|
||||||
|
|
||||||
test('Hooks', async () => {
|
test('Hooks', async () => {
|
||||||
expect(nuxt.__module_hook).toBe(1)
|
expect(nuxt.__module_hook).toBe(1)
|
||||||
expect(nuxt.__renderer_hook).toBe(2)
|
expect(nuxt.__renderer_hook).toBe(2)
|
||||||
})
|
})
|
||||||
|
|
||||||
test('Hooks - Functional', async () => {
|
test('Hooks - Functional', async () => {
|
||||||
expect(nuxt.__ready_called__).toBe(true)
|
expect(nuxt.__ready_called__).toBe(true)
|
||||||
})
|
})
|
||||||
|
|
||||||
// test('Hooks - Error', async () => {
|
// test('Hooks - Error', async () => {
|
||||||
// expect(buildSpies.error.calledWithMatch(/build:extendRoutes/)).toBe(true)
|
// expect(buildSpies.error.calledWithMatch(/build:extendRoutes/)).toBe(true)
|
||||||
// })
|
// })
|
||||||
|
|
||||||
test('Middleware', async () => {
|
test('Middleware', async () => {
|
||||||
let response = await rp(url('/api'))
|
let response = await rp(url('/api'))
|
||||||
expect(response).toBe('It works!')
|
expect(response).toBe('It works!')
|
||||||
})
|
})
|
||||||
|
|
||||||
test('Hooks - Use external middleware before render', async () => {
|
test('Hooks - Use external middleware before render', async () => {
|
||||||
let response = await rp(url('/use-middleware'))
|
let response = await rp(url('/use-middleware'))
|
||||||
expect(response).toBe('Use external middleware')
|
expect(response).toBe('Use external middleware')
|
||||||
})
|
})
|
||||||
|
|
||||||
// Close server and ask nuxt to stop listening to file changes
|
// Close server and ask nuxt to stop listening to file changes
|
||||||
test('Closing server and nuxt.js', async () => {
|
afterAll('Closing server and nuxt.js', async () => {
|
||||||
await nuxt.close()
|
await nuxt.close()
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
@ -71,7 +71,7 @@ describe.skip('spa', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
// Close server and ask nuxt to stop listening to file changes
|
// Close server and ask nuxt to stop listening to file changes
|
||||||
test('Closing server and nuxt.js', async () => {
|
afterAll('Closing server and nuxt.js', async () => {
|
||||||
await nuxt.close()
|
await nuxt.close()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -102,7 +102,7 @@ describe('ssr', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
// Close server and ask nuxt to stop listening to file changes
|
// Close server and ask nuxt to stop listening to file changes
|
||||||
test('Closing server and nuxt.js', async () => {
|
afterAll('Closing server and nuxt.js', async () => {
|
||||||
await nuxt.close()
|
await nuxt.close()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -179,7 +179,7 @@ describe('with-config', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
// Close server and ask nuxt to stop listening to file changes
|
// Close server and ask nuxt to stop listening to file changes
|
||||||
test('Closing server and nuxt.js', async () => {
|
afterAll('Closing server and nuxt.js', async () => {
|
||||||
await nuxt.close()
|
await nuxt.close()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user