Skip to content

Commit

Permalink
Make sure we always exclude ourselves
Browse files Browse the repository at this point in the history
  • Loading branch information
mattwynne committed Oct 29, 2021
1 parent 196b339 commit 0a23caf
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@ import { ILineAndUri } from '../types'

export function getDefinitionLineAndUri(
cwd: string,
exclude = isFileNameInCucumber
isExcluded = isFileNameInCucumber
): ILineAndUri {
let line: number
let uri: string
try {
const stackframes = StackTrace.getSync()
const stackframe = stackframes.find((frame) => {
return !exclude(frame.getFileName())
})
const stackframe = stackframes.find(
(frame) =>
frame.getFileName() !== __filename && !isExcluded(frame.getFileName())
)
if (stackframe != null) {
line = stackframe.getLineNumber()
uri = stackframe.getFileName()
Expand Down

0 comments on commit 0a23caf

Please sign in to comment.