Skip to content

Commit

Permalink
fix: detect node modules frames (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
Julien-R44 authored Sep 3, 2022
1 parent e472fad commit a9a115d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Youch.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ class Youch {
* @private
*/
_isNodeModule (frame) {
return (frame.file || '').indexOf('node_modules' + path.sep) > -1
return (frame.file || '').indexOf('node_modules/') > -1
}

/**
Expand Down
2 changes: 1 addition & 1 deletion test/youch.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ test.group('Youch', () => {
const error = new Error('this is bar')
const youch = new Youch(error, {})
const frame = {
file: process.platform === 'win32' ? '.\\node_modules\\hello.js' : './node_modules/hello.js'
file: './node_modules/hello.js'
}
assert.isTrue(youch._isNodeModule(frame))
})
Expand Down
2 changes: 1 addition & 1 deletion test/youch.spec.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ test.group('Youch | ESM', () => {
const error = new Error('this is bar')
const youch = new Youch(error, {})
const frame = {
file: process.platform === 'win32' ? '.\\node_modules\\hello.js' : './node_modules/hello.js'
file: './node_modules/hello.js'
}
assert.isTrue(youch._isNodeModule(frame))
})
Expand Down

0 comments on commit a9a115d

Please sign in to comment.