From 2f9ba90677fd40baa22f617466b961be23ae7ecb Mon Sep 17 00:00:00 2001 From: AdriAt360 Date: Thu, 16 Jun 2022 10:25:09 +0200 Subject: [PATCH] test: fix broken tests the current file name is now computed from the existing files, so - the file must exist - there should be a filename defined in all tests --- tests/files/restricted-paths/client/b.js | 0 tests/src/rules/no-restricted-paths.js | 20 ++++++++++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) create mode 100644 tests/files/restricted-paths/client/b.js diff --git a/tests/files/restricted-paths/client/b.js b/tests/files/restricted-paths/client/b.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/src/rules/no-restricted-paths.js b/tests/src/rules/no-restricted-paths.js index c69a36280c..b0b3933266 100644 --- a/tests/src/rules/no-restricted-paths.js +++ b/tests/src/rules/no-restricted-paths.js @@ -230,7 +230,10 @@ ruleTester.run('no-restricted-paths', rule, { }), // irrelevant function calls - test({ code: 'notrequire("../server/b.js")' }), + test({ + code: 'notrequire("../server/b.js")', + filename: testFilePath('./restricted-paths/client/a.js'), + }), test({ code: 'notrequire("../server/b.js")', filename: testFilePath('./restricted-paths/client/a.js'), @@ -247,11 +250,20 @@ ruleTester.run('no-restricted-paths', rule, { }), // no config - test({ code: 'require("../server/b.js")' }), - test({ code: 'import b from "../server/b.js"' }), + test({ + code: 'require("../server/b.js")', + filename: testFilePath('./restricted-paths/client/a.js'), + }), + test({ + code: 'import b from "../server/b.js"', + filename: testFilePath('./restricted-paths/client/a.js'), + }), // builtin (ignore) - test({ code: 'require("os")' }), + test({ + code: 'require("os")', + filename: testFilePath('./restricted-paths/client/a.js'), + }), ], invalid: [