test: add test for youch

This commit is contained in:
Clark Du 2017-10-30 11:31:08 +08:00
parent 72b31a217f
commit cbd73463f8
No known key found for this signature in database
GPG Key ID: D0E5986AF78B86D9
2 changed files with 20 additions and 0 deletions

View File

@ -30,6 +30,14 @@ test('Check /test/_open with error (open-in-editor)', async t => {
t.is(body, 'File is not specified')
})
test('Check /test/error (Youch)', async t => {
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">'))
})
// Close server and ask nuxt to stop listening to file changes
test.after('Closing server and nuxt.js', t => {
nuxt.close()

12
test/fixtures/debug/pages/error.vue vendored Normal file
View File

@ -0,0 +1,12 @@
<template>
<h1>Error page</h1>
</template>
<script>
/* eslint no-undef: 0 */
export default {
data () {
throw new Error('test youch !')
}
}
</script>