Skip to content
Permalink
Browse files

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: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Demetrios Papadopoulos <dpapad@chromium.org>
Cr-Commit-Position: refs/heads/master@{#719450}
  • Loading branch information
danbeam authored and Commit Bot committed Nov 27, 2019
1 parent 390bc4d commit 35b10c1a1f6b0870ee22eff531d71b54e8867d31
Showing with 6 additions and 3 deletions.
  1. +1 −0 PRESUBMIT_test_mocks.py
  2. +3 −1 tools/web_dev_style/js_checker.py
  3. +2 −2 tools/web_dev_style/js_checker_eslint_test.py
@@ -71,6 +71,7 @@ def __init__(self):
self.python_executable = sys.executable
self.platform = sys.platform
self.subprocess = subprocess
self.sys = sys
self.files = []
self.is_committing = False
self.change = MockChange([])
@@ -68,7 +68,9 @@ def RunEsLintChecks(self, affected_js_files, format="stylish"):
for f in affected_js_files:
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

import eslint
@@ -44,11 +44,11 @@ def _assertError(self, results_json, rule_id, line):
self.assertEqual(line, message.get('line'))

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)

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)


0 comments on commit 35b10c1

Please sign in to comment.
You can’t perform that action at this time.