tools: Fix running test-js-with-node from arbitrary paths.

This commit is contained in:
Tim Abbott 2020-12-15 12:16:10 -08:00
parent c235b6b8e3
commit 90354c4e5f
1 changed files with 7 additions and 3 deletions

View File

@ -20,8 +20,12 @@ sanity_check.check_venv(__file__)
import orjson import orjson
from zulint.printer import BOLDRED, CYAN, ENDC, GREEN from zulint.printer import BOLDRED, CYAN, ENDC, GREEN
INDEX_JS = 'frontend_tests/zjsunit/index.js' INDEX_JS = os.path.join(ROOT_DIR, 'frontend_tests/zjsunit/index.js')
NODE_COVERAGE_PATH = 'var/node-coverage/coverage-final.json' NODE_COVERAGE_PATH = os.path.join(ROOT_DIR, 'var/node-coverage/coverage-final.json')
# Ideally, we wouldn't need this line, but it seems to be required to
# avoid problems finding node_modules when running `cd tools; ./test-js-with-node`.
os.chdir(ROOT_DIR)
USAGE = ''' USAGE = '''
tools/test-js-with-node - to run all tests tools/test-js-with-node - to run all tests
@ -230,7 +234,7 @@ def run_tests_via_node_js() -> int:
if individual_files: if individual_files:
files = individual_files files = individual_files
else: else:
files = sorted(glob.glob("frontend_tests/node_tests/*.js")) files = sorted(glob.glob(os.path.join(ROOT_DIR, "frontend_tests/node_tests/*.js")))
node_tests_cmd += clean_files(files) node_tests_cmd += clean_files(files)
if options.coverage: if options.coverage: