From 9fd0f124f7aca9731efe5c687703e8126a3908ea Mon Sep 17 00:00:00 2001 From: Dmitry Gozman Date: Fri, 20 Mar 2020 20:52:33 -0700 Subject: [PATCH] test: add test for Map as eval argument --- test/evaluation.spec.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/evaluation.spec.js b/test/evaluation.spec.js index dc2c28113e024..4a760670104be 100644 --- a/test/evaluation.spec.js +++ b/test/evaluation.spec.js @@ -56,6 +56,10 @@ module.exports.describe = function({testRunner, expect, FFOX, CHROMIUM, WEBKIT, const result = await page.evaluate(a => Array.isArray(a), [1, 2, 3]); expect(result).toBe(true); }); + it('should transfer maps as empty objects', async({page, server}) => { + const result = await page.evaluate(a => a.x.constructor.name + ' ' + JSON.stringify(a.x), {x: new Map([[1, 2]])}); + expect(result).toBe('Object {}'); + }); it('should modify global environment', async({page}) => { await page.evaluate(() => window.globalVar = 123); expect(await page.evaluate('globalVar')).toBe(123);