mirror of https://github.com/pelias/api.git
Lily He
7 years ago
3 changed files with 34 additions and 0 deletions
@ -0,0 +1,13 @@
|
||||
'use strict'; |
||||
|
||||
module.exports = () => { |
||||
const stack = new Error().stack.split('\n'); |
||||
let targetLine; |
||||
|
||||
stack.forEach((line) => { |
||||
if(line.indexOf('at controller') !== -1) { |
||||
targetLine = line.trim(); |
||||
} |
||||
}); |
||||
return targetLine; |
||||
}; |
@ -0,0 +1,20 @@
|
||||
const stackTraceLine = require('../../../helper/stackTraceLine'); |
||||
|
||||
module.exports.tests = {}; |
||||
module.exports.tests.stackTrace = (test, common) => { |
||||
test('No exceptions thrown when function is called', (t) => { |
||||
t.doesNotThrow(stackTraceLine, 'No exceptions thrown'); |
||||
t.end(); |
||||
}); |
||||
}; |
||||
|
||||
module.exports.all = function (tape, common) { |
||||
|
||||
function test(name, testFunction) { |
||||
return tape('[helper] stackTraceLine: ' + name, testFunction); |
||||
} |
||||
|
||||
for( var testCase in module.exports.tests ){ |
||||
module.exports.tests[testCase](test, common); |
||||
} |
||||
}; |
Loading…
Reference in new issue