File: common.js

package info (click to toggle)
node-verror 1.10.0-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 272 kB
  • ctags: 143
  • sloc: makefile: 13; sh: 2
file content (27 lines) | stat: -rw-r--r-- 673 bytes parent folder | download | duplicates (3)
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']));
}