mirror of https://github.com/zulip/zulip.git
test-js-with-node: Simplify failures for --coverage.
When you use nyc, its code instrumentation transforms the code so that line numbers and columns no longer make sense, and the long stack trace is likely to cause more confusion than convenience. We want to encourage a workflow where you debug your node tests using the normal (and much quicker mode) before running `--coverage`.
This commit is contained in:
parent
e17ba5260a
commit
dcffa17e29
|
@ -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);
|
||||
|
|
|
@ -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")
|
||||
|
|
Loading…
Reference in New Issue