From 5145dc0114a1725de643e0d691fb24e178e1c1f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Maniecki?= <969645+P4@users.noreply.github.com> Date: Tue, 10 Jan 2023 02:28:06 +0100 Subject: [PATCH] add test case for parens in nullish coalescing (#2824) * add test case for parens in nullish coalescing test case for DevExpress/esotope-hammerhead#19 * use locally packaged esotope-hammerhead for duration of testing * Update package.json * fix: removed file esotope-hammerhead-0.6.2.tgz Co-authored-by: Mikhail Losev Co-authored-by: Aleksey Popov --- package.json | 2 +- test/server/script-processor-test.js | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 79ad9ed22..ca601f242 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "crypto-md5": "^1.0.0", "css": "2.2.3", "debug": "4.3.1", - "esotope-hammerhead": "0.6.2", + "esotope-hammerhead": "0.6.3", "http-cache-semantics": "^4.1.0", "iconv-lite": "0.5.1", "lodash": "^4.17.20", diff --git a/test/server/script-processor-test.js b/test/server/script-processor-test.js index 10afcda8e..d99c38725 100644 --- a/test/server/script-processor-test.js +++ b/test/server/script-processor-test.js @@ -1513,6 +1513,15 @@ describe('Script processor', () => { }); }); + it('Should not lose parentheses around logical expressions inside nullish coalescing', () => { + testProcessing([ + { + src: 'i[s]=n[s]??(a&&a[s])', + expected: '__set$(i,s,__get$(n,s)??(a&&__get$(a,s)))', + }, + ]); + }); + it('Should not lose the await keyword in "for await...of" loop', () => { testProcessing({ src: 'i[j] = async () => {' +