From adb2d610e63c106f51e9522d3ddea6dbf0aba36c Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Mon, 9 May 2016 15:50:56 +0200 Subject: [PATCH] test: include component in tap output Print test name as (for example) "parallel/test-assert". Tests that are scraped from the addons documentation are all named test.js, making it hard to decipher what test is running when only the filename is printed. Fixes: https://github.com/nodejs/node/issues/6651 PR-URL: https://github.com/nodejs/node/pull/6653 Reviewed-By: James M Snell --- tools/test.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tools/test.py b/tools/test.py index 68141ee1ecb58f..675f58366991d6 100755 --- a/tools/test.py +++ b/tools/test.py @@ -269,7 +269,15 @@ def AboutToRun(self, case): def HasRun(self, output): self._done += 1 - command = basename(output.command[-1]) + + # Print test name as (for example) "parallel/test-assert". Tests that are + # scraped from the addons documentation are all named test.js, making it + # hard to decipher what test is running when only the filename is printed. + prefix = abspath(join(dirname(__file__), '../test')) + '/' + command = output.command[-1] + if command.endswith('.js'): command = command[:-3] + if command.startswith(prefix): command = command[len(prefix):] + if output.UnexpectedOutput(): status_line = 'not ok %i %s' % (self._done, command) if FLAKY in output.test.outcomes and self.flaky_tests_mode == DONTCARE: