Skip to content
This repository has been archived by the owner on Jan 13, 2022. It is now read-only.

Commit

Permalink
Fix JUnit report format for thrown error (non SyntaxError).
Browse files Browse the repository at this point in the history
Thrown error should also be formatted as testsuite>testcase>error,
just like a SyntaxError, so that tools like Jenkins JUnit report
visualisation includes the thrown error.

There is no parsing performance impact since this only affects
esvalidate error thrown per file.

http://code.google.com/p/esprima/issues/detail?id=374
  • Loading branch information
cliffano authored and ariya committed Nov 14, 2012
1 parent d1e51f4 commit 1209b06
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion bin/esvalidate.js 100644 → 100755
Expand Up @@ -171,7 +171,18 @@ fnames.forEach(function (fname) {
}
} catch (e) {
++count;
console.log('Error: ' + e.message);
if (options.format === 'junit') {
console.log('<testsuite name="' + fname + '" errors="1" failures="0" tests="1" ' +
' time="' + Math.round((Date.now() - timestamp) / 1000) + '">');
console.log(' <testcase name="' + e.message + '" ' + ' time="0">');
console.log(' <error type="ParseError" message="' + e.message + '">' +
e.message + '(' + fname + ((e.lineNumber) ? ':' + e.lineNumber : '') +
')</error>');
console.log(' </testcase>');
console.log('</testsuite>');
} else {
console.log('Error: ' + e.message);
}
}
});

Expand Down

0 comments on commit 1209b06

Please sign in to comment.