Skip to content

Commit

Permalink
add test case for parens in nullish coalescing (#2824)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
Co-authored-by: Aleksey Popov <[email protected]>
  • Loading branch information
3 people authored Jan 10, 2023
1 parent 72d2041 commit 5145dc0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
9 changes: 9 additions & 0 deletions test/server/script-processor-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {' +
Expand Down

0 comments on commit 5145dc0

Please sign in to comment.