mirror of https://github.com/lukechilds/ava.git
Dmitry Ananichev
8 years ago
committed by
Sindre Sorhus
11 changed files with 311 additions and 13 deletions
@ -0,0 +1,44 @@ |
|||
var proxyquire = require('proxyquire').noPreserveCache(); |
|||
var test = require('tap').test; |
|||
var beautifyStack = proxyquire('../lib/beautify-stack', { |
|||
debug: function () { |
|||
return { |
|||
enabled: false |
|||
}; |
|||
} |
|||
}); |
|||
|
|||
test('does not strip ava internals and dependencies from stack trace with debug enabled', function (t) { |
|||
var beautify = proxyquire('../lib/beautify-stack', { |
|||
debug: function () { |
|||
return { |
|||
enabled: true |
|||
}; |
|||
} |
|||
}); |
|||
|
|||
var result = beautify( |
|||
'Error: TypeError\n' + |
|||
'at null._onTimeout (node_modules/ava/cli.js:27:11)\n' + |
|||
'at Stub.listOnTimeout (timers.js:119:15)\n' |
|||
); |
|||
|
|||
t.true(result.indexOf('ava/cli.js') !== -1); |
|||
t.end(); |
|||
}); |
|||
|
|||
test('strips ava internals and dependencies from stack trace with debug disabled', function (t) { |
|||
var result = beautifyStack( |
|||
'Error: TypeError\n' + |
|||
'at null._onTimeout (node_modules/ava/cli.js:27:11)\n' + |
|||
'at Stub.listOnTimeout (timers.js:119:15)\n' |
|||
); |
|||
|
|||
t.true(result.indexOf('ava/cli.js') === -1); |
|||
t.end(); |
|||
}); |
|||
|
|||
test('returns empty string without any arguments', function (t) { |
|||
t.is(beautifyStack(), ''); |
|||
t.end(); |
|||
}); |
@ -0,0 +1,7 @@ |
|||
import test from '../../'; |
|||
|
|||
test(t => { |
|||
t.pass(); |
|||
}); |
|||
|
|||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImVzMjAxNS5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLElBQUksTUFBTSxRQUFRLENBQUM7O0FBRTFCLElBQUksQ0FBQyxDQUFDLElBQUk7QUFDVCxFQUFDLENBQUMsSUFBSSxFQUFFLENBQUM7Q0FDVCxDQUFDLENBQUMiLCJmaWxlIjoiZXMyMDE1LXNvdXJjZS1tYXBzLmpzIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHRlc3QgZnJvbSAnLi4vLi4vJztcblxudGVzdCh0ID0+IHtcblx0dC5wYXNzKCk7XG59KTtcbiJdfQ==
|
Loading…
Reference in new issue