Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

test-js-with-node: Simplify failures for --coverage.

Steve Howelldcffa17e292d
diff --git a/frontend_tests/zjsunit/index.js b/frontend_tests/zjsunit/index.js
index 46f81cc86aa..98dfa25c99e 100644
--- a/frontend_tests/zjsunit/index.js
+++ b/frontend_tests/zjsunit/index.js
@@ -114,7 +114,13 @@ try {
namespace.finish();
}
} catch (error) {
- if (error.stack) {
+ if (process.env.USING_INSTRUMENTED_CODE) {
+ console.info(`
+ TEST FAILED! Before using the --coverage option please make sure that your
+ tests work under normal conditions.
+
+ `);
+ } else if (error.stack) {
console.info(short_tb(error.stack));
} else {
console.info(error);
diff --git a/tools/test-js-with-node b/tools/test-js-with-node
index f7b808dd1d0..ce0107cd1dd 100755
--- a/tools/test-js-with-node
+++ b/tools/test-js-with-node
@@ -312,6 +312,7 @@ def run_tests_via_node_js() -> int:
node_tests_cmd += test_files
if options.coverage:
+ os.environ["USING_INSTRUMENTED_CODE"] = "TRUE"
coverage_dir = os.path.join(ROOT_DIR, "var/node-coverage")
nyc = os.path.join(ROOT_DIR, "node_modules/.bin/nyc")