Commit 35b10c1a authored by Dan Beam's avatar Dan Beam Committed by Commit Bot

Remove --color from ESLint output when running in presubmit

Fixed: 862792
Change-Id: I250e91a1db5f8df71fff33c17c7a04a9fd6c8739
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1937584
Commit-Queue: Dan Beam <dbeam@chromium.org>
Auto-Submit: Dan Beam <dbeam@chromium.org>
Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Reviewed-by: default avatarDemetrios Papadopoulos <dpapad@chromium.org>
Cr-Commit-Position: refs/heads/master@{#719450}
parent 390bc4d7
...@@ -71,6 +71,7 @@ class MockInputApi(object): ...@@ -71,6 +71,7 @@ class MockInputApi(object):
self.python_executable = sys.executable self.python_executable = sys.executable
self.platform = sys.platform self.platform = sys.platform
self.subprocess = subprocess self.subprocess = subprocess
self.sys = sys
self.files = [] self.files = []
self.is_committing = False self.is_committing = False
self.change = MockChange([]) self.change = MockChange([])
......
...@@ -68,7 +68,9 @@ class JSChecker(object): ...@@ -68,7 +68,9 @@ class JSChecker(object):
for f in affected_js_files: for f in affected_js_files:
affected_js_files_paths.append(f.AbsoluteLocalPath()) affected_js_files_paths.append(f.AbsoluteLocalPath())
args = ["--color", "--format", format, "--ignore-pattern '!.eslintrc.js'"] from os import isatty as os_isatty
args = ["--color"] if os_isatty(self.input_api.sys.stdout.fileno()) else []
args += ["--format", format, "--ignore-pattern '!.eslintrc.js'"]
args += affected_js_files_paths args += affected_js_files_paths
import eslint import eslint
......
...@@ -44,11 +44,11 @@ class JsCheckerEsLintTest(unittest.TestCase): ...@@ -44,11 +44,11 @@ class JsCheckerEsLintTest(unittest.TestCase):
self.assertEqual(line, message.get('line')) self.assertEqual(line, message.get('line'))
def testGetElementByIdCheck(self): def testGetElementByIdCheck(self):
results_json = self._runChecks('var a = document.getElementById(\'foo\');') results_json = self._runChecks("const a = document.getElementById('foo');")
self._assertError(results_json, 'no-restricted-properties', 1) self._assertError(results_json, 'no-restricted-properties', 1)
def testPrimitiveWrappersCheck(self): def testPrimitiveWrappersCheck(self):
results_json = self._runChecks('var a = new Number(1);') results_json = self._runChecks('const a = new Number(1);')
self._assertError(results_json, 'no-new-wrappers', 1) self._assertError(results_json, 'no-new-wrappers', 1)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment