You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

36 lines
705 B

'use strict';
const test = require('tap').test;
const extractStack = require('../lib/extract-stack');
test('strip error message', t => {
const stack = [
'error message',
'Test.t (test.js:1:1)'
].join('\n');
t.is(extractStack(stack), 'Test.t (test.js:1:1)');
t.end();
});
test('strip multiline error message', t => {
const stack = [
'error message',
'with multiple',
'lines',
'',
'Test.t (test.js:1:1)'
].join('\n');
t.is(extractStack(stack), 'Test.t (test.js:1:1)');
t.end();
});
test('strip beginning whitespace from stack', t => {
const stack = [
'error message',
' Test.t (test.js:1:1)'
].join('\n');
t.is(extractStack(stack), 'Test.t (test.js:1:1)');
t.end();
});