From a306b98a52f3edd0c9ce13ae8b41a73663d98da2 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Fri, 19 Apr 2024 12:44:10 -0400 Subject: [PATCH] add test --- test/test.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/test.js b/test/test.js index 1857c6b..ecc786e 100644 --- a/test/test.js +++ b/test/test.js @@ -560,6 +560,21 @@ for (const fn of [uneval, stringify]) { assert.equal(e.path, '.foo.map.get("key")'); } }); + + uvu.test(`${fn.name} populates error.path after maps (#64)`, () => { + try { + fn({ + map: new Map([['key', 'value']]), + object: { + invalid() {} + } + }); + } catch (e) { + assert.equal(e.name, 'DevalueError'); + assert.equal(e.message, 'Cannot stringify a function'); + assert.equal(e.path, '.object.invalid'); + } + }); } uvu.test('does not create duplicate parameter names', () => {