test: youch without source-map and access publicPath in spa

This commit is contained in:
Clark Du 2017-12-07 17:10:06 +08:00 committed by Pooya Parsa
parent 4cafca0fec
commit 652c3d63d1
2 changed files with 19 additions and 0 deletions

View File

@ -38,6 +38,19 @@ test('/test/error should return error stack trace (Youch)', async t => {
t.true(error.includes('<div class="error-frames">'))
})
test('/test/error no source-map (Youch)', async t => {
const sourceMaps = nuxt.renderer.resources.serverBundle.maps
nuxt.renderer.resources.serverBundle.maps = {}
const { response, error } = await t.throws(nuxt.renderAndGetWindow(url('/test/error')))
t.is(response.statusCode, 500)
t.is(response.statusMessage, 'NuxtServerError')
t.true(error.includes('test youch !'))
t.true(error.includes('<div class="error-frames">'))
nuxt.renderer.resources.serverBundle.maps = sourceMaps
})
test('/test/error should return json format error (Youch)', async t => {
const opts = {
headers: {

View File

@ -47,6 +47,12 @@ test('/custom (call mounted and created once)', async t => {
t.true(mounts.length === 1)
})
test('/_nuxt/ (access publicPath in spa mode)', async t => {
const { response: { statusCode, statusMessage } } = await t.throws(renderRoute('/_nuxt/'))
t.is(statusCode, 404)
t.is(statusMessage, 'ResourceNotFound')
})
// Close server and ask nuxt to stop listening to file changes
test.after('Closing server and nuxt.js', t => {
nuxt.close()