From 0bc13553d44e962b416d602da779364515d3df28 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Mon, 30 Sep 2024 13:43:45 +0700 Subject: [PATCH] [Tests] `no-default-export`, `no-named-export`: add test cases with non-module `sourceType` --- tests/src/rules/no-default-export.js | 6 ++++++ tests/src/rules/no-named-export.js | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/tests/src/rules/no-default-export.js b/tests/src/rules/no-default-export.js index eef8b1322..8434ee148 100644 --- a/tests/src/rules/no-default-export.js +++ b/tests/src/rules/no-default-export.js @@ -7,6 +7,12 @@ const rule = require('rules/no-default-export'); ruleTester.run('no-default-export', rule, { valid: [ + test({ + code: 'module.exports = function foo() {}', + parserOptions: { + sourceType: 'script', + }, + }), test({ code: 'module.exports = function foo() {}', }), diff --git a/tests/src/rules/no-named-export.js b/tests/src/rules/no-named-export.js index c592189f5..41f8e8f02 100644 --- a/tests/src/rules/no-named-export.js +++ b/tests/src/rules/no-named-export.js @@ -6,6 +6,12 @@ const rule = require('rules/no-named-export'); ruleTester.run('no-named-export', rule, { valid: [].concat( + test({ + code: 'module.export.foo = function () {}', + parserOptions: { + sourceType: 'script', + }, + }), test({ code: 'module.export.foo = function () {}', }),