From 2d18db6278320fb97bc8e0bff3518c790566a6a6 Mon Sep 17 00:00:00 2001 From: Milos Djermanovic Date: Mon, 23 Aug 2021 15:02:23 +0200 Subject: [PATCH] Chore: add test for merging `parserOptions` in Linter (#14948) --- tests/lib/linter/linter.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/lib/linter/linter.js b/tests/lib/linter/linter.js index deaaea37baf..c6135faac69 100644 --- a/tests/lib/linter/linter.js +++ b/tests/lib/linter/linter.js @@ -5762,4 +5762,25 @@ var a = "test2"; }); }); }); + + describe("merging 'parserOptions'", () => { + it("should deeply merge 'parserOptions' from an environment with 'parserOptions' from the provided config", () => { + const code = "return
"; + const config = { + env: { + node: true // ecmaFeatures: { globalReturn: true } + }, + parserOptions: { + ecmaFeatures: { + jsx: true + } + } + }; + + const messages = linter.verify(code, config); + + // no parsing errors + assert.strictEqual(messages.length, 0); + }); + }); });