Skip to content

Commit a3fdba8

Browse files
authored
chore(vue-app): improve missing inject value error message (nuxt#7032)
1 parent 5781c6e commit a3fdba8

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

packages/vue-app/template/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ async function createApp (ssrContext) {
168168
throw new Error('inject(key, value) has no key provided')
169169
}
170170
if (value === undefined) {
171-
throw new Error('inject(key, value) has no value provided')
171+
throw new Error(`inject('${key}', value) has no value provided`)
172172
}
173173

174174
key = '$' + key

test/dev/basic.plugins.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ describe('with-config', () => {
2222

2323
test('inject fails if value is undefined', async () => {
2424
// inject('injectedProperty', undefined)
25-
await expect(nuxt.renderRoute('/?injectValue=undefined')).rejects.toThrowError('inject(key, value) has no value provided')
25+
await expect(nuxt.renderRoute('/?injectValue=undefined')).rejects.toThrowError('inject(\'injectedProperty\', value) has no value provided')
2626
})
2727

2828
test('inject succeeds if value is defined but evaluates to false', async () => {

0 commit comments

Comments
 (0)