mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-27 08:02:01 +00:00
fix(cli): remove duplicate error message in start and build (#4258)
This commit is contained in:
parent
12151d81d6
commit
17e0890c90
@ -56,9 +56,6 @@ export default {
|
||||
await cmd.getNuxtConfig(argv, { dev: false })
|
||||
)
|
||||
|
||||
// Setup hooks
|
||||
nuxt.hook('error', err => consola.fatal(err))
|
||||
|
||||
let builderOrGenerator
|
||||
if (nuxt.options.mode !== 'spa' || argv.generate === false) {
|
||||
// Build only
|
||||
|
@ -30,9 +30,6 @@ export default {
|
||||
await cmd.getNuxtConfig(argv, { dev: false })
|
||||
)
|
||||
|
||||
// Setup hooks
|
||||
nuxt.hook('error', err => consola.fatal(err))
|
||||
|
||||
// Check if project is built for production
|
||||
const distDir = path.resolve(
|
||||
nuxt.options.rootDir,
|
||||
|
@ -34,8 +34,8 @@ export default class Hookable {
|
||||
try {
|
||||
await sequence(this._hooks[name], fn => fn(...args))
|
||||
} catch (err) {
|
||||
consola.error(err)
|
||||
this.callHook('error', err)
|
||||
name !== 'error' && this.callHook('error', err)
|
||||
consola.fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,7 @@ describe('error', () => {
|
||||
})
|
||||
|
||||
test('Error: callHook()', async () => {
|
||||
consola.error.mockClear()
|
||||
consola.fatal.mockClear()
|
||||
|
||||
const errorHook = jest.fn()
|
||||
const error = new Error('test hook error')
|
||||
@ -50,8 +50,8 @@ describe('error', () => {
|
||||
|
||||
expect(errorHook).toHaveBeenCalledTimes(1)
|
||||
expect(errorHook).toHaveBeenCalledWith(error)
|
||||
expect(consola.error).toHaveBeenCalledTimes(1)
|
||||
expect(consola.error).toHaveBeenCalledWith(error)
|
||||
expect(consola.fatal).toHaveBeenCalledTimes(1)
|
||||
expect(consola.fatal).toHaveBeenCalledWith(error)
|
||||
})
|
||||
|
||||
// Close server and ask nuxt to stop listening to file changes
|
||||
|
Loading…
Reference in New Issue
Block a user