diff options
Diffstat (limited to 'tools/lint/test/test_eslint.py')
-rw-r--r-- | tools/lint/test/test_eslint.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tools/lint/test/test_eslint.py b/tools/lint/test/test_eslint.py new file mode 100644 index 0000000000..01456a4063 --- /dev/null +++ b/tools/lint/test/test_eslint.py @@ -0,0 +1,30 @@ +import mozunit + +from conftest import build + +LINTER = "eslint" + + +def test_lint_with_global_exclude(lint, config, paths): + config["exclude"] = ["subdir", "import"] + results = lint(paths(), config=config, root=build.topsrcdir) + assert len(results) == 0 + + +def test_no_files_to_lint(lint, config, paths): + # A directory with no files to lint. + results = lint(paths("nolint"), root=build.topsrcdir) + assert results == [] + + # Errors still show up even when a directory with no files is passed in. + results = lint(paths("nolint", "subdir/bad.js"), root=build.topsrcdir) + assert len(results) == 1 + + +def test_bad_import(lint, config, paths): + results = lint(paths("import"), config=config, root=build.topsrcdir) + assert results == 1 + + +if __name__ == "__main__": + mozunit.main() |