chore(vue-app): improve missing inject value error message (#7032)

This commit is contained in:
Jonas Galvez 2020-02-29 16:16:43 -03:00 committed by GitHub
parent 5781c6e640
commit a3fdba885e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -168,7 +168,7 @@ async function createApp (ssrContext) {
throw new Error('inject(key, value) has no key provided')
}
if (value === undefined) {
throw new Error('inject(key, value) has no value provided')
throw new Error(`inject('${key}', value) has no value provided`)
}
key = '$' + key

View File

@ -22,7 +22,7 @@ describe('with-config', () => {
test('inject fails if value is undefined', async () => {
// inject('injectedProperty', undefined)
await expect(nuxt.renderRoute('/?injectValue=undefined')).rejects.toThrowError('inject(key, value) has no value provided')
await expect(nuxt.renderRoute('/?injectValue=undefined')).rejects.toThrowError('inject(\'injectedProperty\', value) has no value provided')
})
test('inject succeeds if value is defined but evaluates to false', async () => {