Skip to content

Commit

Permalink
fix: normalize all frame filePath to posix format (#46)
Browse files Browse the repository at this point in the history
* fix: normalize all frame `filePath` to posix format

* style: lint error
  • Loading branch information
Julien-R44 authored Sep 2, 2022
1 parent 6b35a4b commit cd66012
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/Youch.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,9 @@ class Youch {
_serializeFrame (frame) {
return {
file: frame.fileRelative,
filePath: frame.file.startsWith('file:') ? fileURLToPath(frame.file) : frame.file,
filePath: frame.file.startsWith('file:')
? fileURLToPath(frame.file).replaceAll('\\', '/')
: frame.file,
line: frame.line,
callee: frame.callee,
calleeShort: frame.calleeShort,
Expand Down
2 changes: 1 addition & 1 deletion test/youch.spec.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ test.group('Youch | ESM', () => {
youch
.toJSON()
.then(({ error }) => {
assert.equal(error.frames[0].filePath, __filename)
assert.equal(error.frames[0].filePath, __filename.replaceAll('\\', '/'))
assert.equal(error.frames[0].isNative, false)
done()
}).catch(done)
Expand Down

0 comments on commit cd66012

Please sign in to comment.