Use mocha_path() from devtools_paths in PRESUBMIT
Cleaner and uses a path that is happy on Windows.
Bug: none
Change-Id: Ia1f7952adb7b8a6591a8abc145ad321463f1e6e3
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3165096
Auto-Submit: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Philip Pfaffe <pfaffe@chromium.org>
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
Commit-Queue: Philip Pfaffe <pfaffe@chromium.org>
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
index 2be65f7..4274694 100644
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
@@ -206,6 +206,14 @@
# tests if so.
# We don't do this on every CL as most do not touch the rules, but if we do
# change them we need to make sure all the tests are passing.
+ original_sys_path = sys.path
+ try:
+ sys.path = sys.path + [
+ input_api.os_path.join(input_api.PresubmitLocalPath(), 'scripts')
+ ]
+ import devtools_paths
+ finally:
+ sys.path = original_sys_path
eslint_rules_dir_path = input_api.os_path.join(
input_api.PresubmitLocalPath(), 'scripts', 'eslint_rules')
eslint_rules_affected_files = _getAffectedFiles(input_api,
@@ -215,8 +223,7 @@
if (len(eslint_rules_affected_files) == 0):
return []
- mocha_path = input_api.os_path.join(input_api.PresubmitLocalPath(),
- 'node_modules', '.bin', 'mocha')
+ mocha_path = devtools_paths.mocha_path()
eslint_tests_path = input_api.os_path.join(eslint_rules_dir_path, 'tests',
'*_test.js')