diff --git a/packages/compiler-core/__tests__/transforms/vFor.spec.ts b/packages/compiler-core/__tests__/transforms/vFor.spec.ts index 94f75f2a63b..6989dc8994d 100644 --- a/packages/compiler-core/__tests__/transforms/vFor.spec.ts +++ b/packages/compiler-core/__tests__/transforms/vFor.spec.ts @@ -253,6 +253,20 @@ describe('compiler: v-for', () => { ) }) + test('key property missing expression', () => { + const onError = vi.fn() + parseWithForTransform('', { + onError, + }) + + expect(onError).toHaveBeenCalledTimes(1) + expect(onError).toHaveBeenCalledWith( + expect.objectContaining({ + code: ErrorCodes.X_V_BIND_NO_EXPRESSION, + }), + ) + }) + test('missing source', () => { const onError = vi.fn() parseWithForTransform('', { onError }) diff --git a/packages/compiler-core/__tests__/transforms/vIf.spec.ts b/packages/compiler-core/__tests__/transforms/vIf.spec.ts index 2c2fedab0d5..4432daec020 100644 --- a/packages/compiler-core/__tests__/transforms/vIf.spec.ts +++ b/packages/compiler-core/__tests__/transforms/vIf.spec.ts @@ -323,6 +323,32 @@ describe('compiler: v-if', () => { }, ]) }) + + test('error on template key', () => { + const onError = vi.fn() + // dynamic + parseWithIfTransform( + `