mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-23 14:15:13 +00:00
chore(vue-app): improve missing inject value error message (#7032)
This commit is contained in:
parent
5781c6e640
commit
a3fdba885e
@ -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
|
||||
|
@ -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 () => {
|
||||
|
Loading…
Reference in New Issue
Block a user