1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
/*
* test/common.js: common utility functions used in multiple tests
*/
exports.cleanStack = cleanStack;
exports.oldNode = oldNode;
/*
* Remove full paths and relative line numbers from stack traces so that we can
* compare against "known-good" output.
*/
function cleanStack(stacktxt)
{
var re = new RegExp('\\(/.*/tst.*js:\\d+:\\d+\\)', 'gm');
stacktxt = stacktxt.replace(re, '(dummy filename)');
return (stacktxt);
}
/*
* Node's behavior with respect to Error's names and messages changed
* significantly with v0.12, so a number of tests regrettably need to check for
* that.
*/
function oldNode()
{
return (/^0\.10\./.test(process.versions['node']));
}
|