mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-30 17:37:14 +00:00
0f104aa588
- Better insights and inspection for server bundle - Remove all vue related dependencies from vue-renderer package as much as possible to reduce install size of nuxt-start - Support for single file distributions (serverless) - Remove server-bundle.json and use the standard .js files for dist/server - Mitigate CALL_AND_RETRY_LAST Allocation failed errors. Most of the cases happen on JSON.parse() the part when loading bundle. (#4225, #3465, #1728, #1601, #1481) - Reduce server dist size by removing escape characters caused by JSON serialize - Faster dev reloads and production start by removing extra JSON.serialize/JSON.parse time - Less memory usage - General performance improvements and refactors
36 lines
879 B
JavaScript
36 lines
879 B
JavaScript
import fs from 'fs-extra'
|
|
import { consola, mockGetNuxtStart, mockGetNuxtConfig, NuxtCommand } from '../utils'
|
|
|
|
describe('start', () => {
|
|
let start
|
|
|
|
beforeAll(async () => {
|
|
start = await import('../../src/commands/start').then(m => m.default)
|
|
})
|
|
|
|
afterEach(() => {
|
|
if (fs.existsSync.mockRestore) {
|
|
fs.existsSync.mockRestore()
|
|
}
|
|
jest.resetAllMocks()
|
|
})
|
|
|
|
test('has run function', () => {
|
|
expect(typeof start.run).toBe('function')
|
|
})
|
|
|
|
test('no error if dist dir exists', async () => {
|
|
mockGetNuxtStart()
|
|
mockGetNuxtConfig()
|
|
await NuxtCommand.from(start).run()
|
|
expect(consola.fatal).not.toHaveBeenCalled()
|
|
})
|
|
|
|
test('no error on ssr and server bundle exists', async () => {
|
|
mockGetNuxtStart(true)
|
|
mockGetNuxtConfig()
|
|
await NuxtCommand.from(start).run()
|
|
expect(consola.fatal).not.toHaveBeenCalled()
|
|
})
|
|
})
|