Browse Source

Fix failed line missing from TAP output

babel-plugin-for-integration-tests
Juan Soto 9 years ago
parent
commit
d00aa7e8dc
  1. 4
      lib/reporters/tap.js
  2. 4
      test/reporters/tap.js

4
lib/reporters/tap.js

@ -7,7 +7,7 @@ function getSourceFromStack(stack, index) {
.split('\n')
.slice(index, index + 1)
.join('')
.replace(/^\s+at /, '');
.replace(/^\s+ /, '');
}
function TapReporter() {
@ -35,7 +35,7 @@ TapReporter.prototype.test = function (test) {
' operator: ' + test.error.operator,
' expected: ' + test.error.expected,
' actual: ' + test.error.actual,
' at: ' + getSourceFromStack(test.error.stack, 3),
' at: ' + getSourceFromStack(test.error.stack, 1),
' ...'
];
} else {

4
test/reporters/tap.js

@ -35,7 +35,7 @@ test('failing test', function (t) {
operator: '==',
expected: true,
actual: false,
stack: ['', '', '', ' at Test.fn (test.js:1:2)'].join('\n')
stack: ['', 'Test.fn (test.js:1:2)'].join('\n')
}
});
@ -60,7 +60,7 @@ test('unhandled error', function (t) {
var actualOutput = reporter.unhandledError({
message: 'unhandled',
name: 'TypeError',
stack: ['', ' at Test.fn (test.js:1:2)'].join('\n')
stack: ['', 'Test.fn (test.js:1:2)'].join('\n')
});
var expectedOutput = [

Loading…
Cancel
Save