node-tests: Log file name and test label on failure.

This commit is contained in:
Rohitt Vashishtha 2020-07-07 05:11:03 +00:00 committed by Steve Howell
parent 1d3234b6c6
commit 4a62cae0b7
1 changed files with 11 additions and 1 deletions

View File

@ -89,8 +89,11 @@ function short_tb(tb) {
// Set up markdown comparison helper
global.markdown_assert = require('./markdown_assert.js');
let current_file_name;
function run_one_module(file) {
console.info('running tests for ' + file.name);
current_file_name = file.name;
require(file.full_name);
}
@ -98,7 +101,14 @@ global.run_test = (label, f) => {
if (files.length === 1) {
console.info(' test: ' + label);
}
f();
try {
f();
} catch (error) {
console.info('-'.repeat(50));
console.info(`test failed: ${current_file_name} > ${label}`);
console.info();
throw error;
}
// defensively reset blueslip after each test.
blueslip.reset();
};