diff --git a/eslint/babel-eslint-parser/test/integration.js b/eslint/babel-eslint-parser/test/integration.js index ecad41bdd0b7..d2df877c562e 100644 --- a/eslint/babel-eslint-parser/test/integration.js +++ b/eslint/babel-eslint-parser/test/integration.js @@ -16,6 +16,8 @@ const baseEslintOpts = { parser: "current-babel-eslint", parserOptions: { sourceType: "script", + requireConfigFile: false, + babelOptions: { configFile: false } }, }; diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index b1feb30eabb7..63aadea4b33a 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -18,26 +18,20 @@ function verifyAndAssertMessagesWithSpecificESLint( node: true, es6: true, }, + ...overrideConfig, parserOptions: { sourceType, - ecmaFeatures: { - globalReturn: true, - }, + requireConfigFile: false, babelOptions: { configFile: path.resolve( __dirname, "./fixtures/config/babel.config.js", ), }, + ...overrideConfig?.parserOptions, }, }; - if (overrideConfig) { - for (const key in overrideConfig) { - config[key] = overrideConfig[key]; - } - } - const messages = linter.verify(code, config); if (messages.length !== expectedMessages.length) { @@ -1566,7 +1560,7 @@ describe("verify", () => { ); }); - it("no-implicit-globals in script", () => { + it("no-implicit-globals in script: globalReturn is false", () => { verifyAndAssertMessages( "var leakedGlobal = 1;", { "no-implicit-globals": 1 }, @@ -1576,7 +1570,28 @@ describe("verify", () => { "script", { env: {}, - parserOptions: { ecmaVersion: 6, sourceType: "script" }, + parserOptions: { + ecmaVersion: 6, + sourceType: "script", + ecmaFeatures: { globalReturn: false }, + }, + }, + ); + }); + + it("no-implicit-globals in script: globalReturn is true", () => { + verifyAndAssertMessages( + "var leakedGlobal = 1;", + { "no-implicit-globals": 1 }, + [], + "script", + { + env: {}, + parserOptions: { + ecmaVersion: 6, + sourceType: "script", + ecmaFeatures: { globalReturn: true }, + }, }, ); });