From 56d1fa84f43992097100053c65bbc8671cb639ec Mon Sep 17 00:00:00 2001 From: Yang Jun Date: Thu, 14 May 2026 01:44:35 +0800 Subject: [PATCH] test(e2e): assert constructor filter/tag lookups (node + UMD) Co-authored-by: Cursor --- test/e2e/issues.spec.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/e2e/issues.spec.ts b/test/e2e/issues.spec.ts index 700bbaa8e..2a4932985 100644 --- a/test/e2e/issues.spec.ts +++ b/test/e2e/issues.spec.ts @@ -85,6 +85,14 @@ describe('Issues', function () { expect(Object.getPrototypeOf(umdEngine.filters)).toBeNull() expect(Object.getPrototypeOf(umdEngine.tags)).toBeNull() }) + it('filter/tag lookups ignore Object.prototype keys unless registered (node + UMD)', async () => { + for (const LiquidClass of [Liquid, LiquidUMD]) { + const engine = new LiquidClass() + await expect(engine.parseAndRender('{{ x | constructor }}', { x: 'OK' })).resolves.toBe('OK') + await expect(new LiquidClass({ strictFilters: true }).parseAndRender('{{ x | constructor }}', { x: 'OK' })).rejects.toThrow(/undefined filter/) + expect(() => engine.parse('{% constructor %}')).toThrow('tag "constructor" not found') + } + }) it('lenientIf not working as expected in umd #313', async () => { const engine = new LiquidUMD({ strictVariables: true,