From c709b22612eb3f29d401e4429a84f008b22b965a Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Sat, 5 Aug 2017 12:17:30 +0430 Subject: [PATCH] update error tests --- lib/core/renderer.js | 2 +- test/error.test.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/core/renderer.js b/lib/core/renderer.js index 2590e754e7..053e22c9e0 100644 --- a/lib/core/renderer.js +++ b/lib/core/renderer.js @@ -280,7 +280,7 @@ export default class Renderer extends Tapable { // ensure statusCode, message and name fields err.statusCode = err.statusCode || 500 err.message = err.message || 'Nuxt Server Error' - err.name = err.name || 'Nuxt Server Error' + err.name = (!err.name || err.name === 'Error') ? 'Nuxt Server Error' : err.name const sendResponse = (content, type = 'text/html') => { // Set Headers diff --git a/test/error.test.js b/test/error.test.js index 9a7952ccc6..b65a6b3a59 100644 --- a/test/error.test.js +++ b/test/error.test.js @@ -34,8 +34,8 @@ test('/404 should display an error too', async t => { test('/ with renderAndGetWindow()', async t => { const err = await t.throws(nuxt.renderAndGetWindow(url('/'))) - t.true(String(err).includes('Error: socket hang up')) - // t.is(err.response.statusCode, 500) + t.is(err.response.statusCode, 500) + t.is(err.response.statusMessage, 'Nuxt Server Error') }) // Close server and ask nuxt to stop listening to file changes