зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1623862 - Properly handle errors when the ESLint process fails. r=ahal
In the failure case, errors has value, but output doesn't. So previously we were printing the errors but returning success to the lint handler. Differential Revision: https://phabricator.services.mozilla.com/D67670 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
156fc636e7
Коммит
b9bfdfd17c
|
@ -102,7 +102,10 @@ def lint(paths, config, binary=None, fix=None, setup=None, **lintargs):
|
|||
|
||||
if errors:
|
||||
errors = errors.decode(encoding, "replace")
|
||||
print(errors)
|
||||
print(ESLINT_ERROR_MESSAGE.format(errors))
|
||||
|
||||
if proc.returncode >= 2:
|
||||
return 1
|
||||
|
||||
if not output:
|
||||
return [] # no output means success
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
/* import-globals-from notpresent/notpresent.js */
|
|
@ -6,7 +6,7 @@ LINTER = 'eslint'
|
|||
|
||||
|
||||
def test_lint_with_global_exclude(lint, config, paths):
|
||||
config['exclude'] = ['subdir']
|
||||
config['exclude'] = ['subdir', 'import']
|
||||
results = lint(paths(), config=config, root=build.topsrcdir)
|
||||
assert len(results) == 0
|
||||
|
||||
|
@ -21,5 +21,10 @@ def test_no_files_to_lint(lint, config, paths):
|
|||
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()
|
||||
|
|
Загрузка…
Ссылка в новой задаче