Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
tools: Fix running test-js-with-node from arbitrary paths.
Tim Abbott90354c4e5f15
diff --git a/tools/test-js-with-node b/tools/test-js-with-nodeindex 92818be938c..2c224031fbd 100755--- a/tools/test-js-with-node+++ b/tools/test-js-with-node@@ -20,8 +20,12 @@ sanity_check.check_venv(__file__)import orjsonfrom zulint.printer import BOLDRED, CYAN, ENDC, GREEN-INDEX_JS = 'frontend_tests/zjsunit/index.js'-NODE_COVERAGE_PATH = 'var/node-coverage/coverage-final.json'+INDEX_JS = os.path.join(ROOT_DIR, 'frontend_tests/zjsunit/index.js')+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 = '''tools/test-js-with-node - to run all tests@@ -230,7 +234,7 @@ def run_tests_via_node_js() -> int:if individual_files:files = individual_fileselse:- 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)if options.coverage: