From 1b76a3e991a58c605a92a2ac43925ac41045ce22 Mon Sep 17 00:00:00 2001 From: Marcelo Shima Date: Sun, 4 Dec 2022 07:50:14 -0300 Subject: [PATCH 1/3] fix: don't try to make relative an absolute url --- index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index f567133..eeb69b8 100644 --- a/index.js +++ b/index.js @@ -79,7 +79,9 @@ class StackUtils { } } - st = st.replace(`${this._cwd}/`, ''); + if (!/file:/.test(st)) { + st = st.replace(`${this._cwd}/`, ''); + } if (st) { if (isAtLine) { From 01074fa1f6d07e064c8b8184f50c8184d55e7fa8 Mon Sep 17 00:00:00 2001 From: Marcelo Shima Date: Sun, 4 Dec 2022 07:55:58 -0300 Subject: [PATCH 2/3] add test for url stack --- test/test.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/test.js b/test/test.js index 8721f6c..a03a671 100644 --- a/test/test.js +++ b/test/test.js @@ -40,6 +40,7 @@ t.test('clean: truncates cwd', t => { 'foo (foo.js:3:8)', 'bar (foo.js:7:2)', 'bar (bar.js:4:2)', + 'url (file:///user/dev/project/bar.mjs:8:9)', 'Object. (bar.js:7:1)', 'ontimeout (timers.js:365:14)', 'tryOnTimeout (timers.js:237:5)', @@ -392,6 +393,7 @@ function linuxStack1() { ' at foo (/user/dev/project/foo.js:3:8)', ' at bar (/user/dev/project/foo.js:7:2)', ' at bar (/user/dev/project/bar.js:4:2)', + ' at url (file:///user/dev/project/bar.mjs:8:9)', ' at Object. (/user/dev/project/bar.js:7:1)' ]; } @@ -402,6 +404,7 @@ function windowsStack1() { ' at foo (Z:\\user\\dev\\project\\foo.js:3:8)', ' at bar (Z:\\user\\dev\\project\\foo.js:7:2)', ' at bar (Z:\\user\\dev\\project\\bar.js:4:2)', + ' at url (file:///user/dev/project/bar.mjs:8:9)', ' at Object. (Z:\\user\\dev\\project\\bar.js:7:1)' ]; } From e8b96918b8dcd159026e0e7e7e46df245af5f97e Mon Sep 17 00:00:00 2001 From: Marcelo Shima Date: Sun, 4 Dec 2022 07:58:09 -0300 Subject: [PATCH 3/3] add missing test --- test/test.js | 1 + 1 file changed, 1 insertion(+) diff --git a/test/test.js b/test/test.js index a03a671..caeba3e 100644 --- a/test/test.js +++ b/test/test.js @@ -81,6 +81,7 @@ t.test('clean: eliminates internals', t => { 'foo (project/foo.js:3:8)', 'bar (project/foo.js:7:2)', 'bar (project/bar.js:4:2)', + 'url (file:///user/dev/project/bar.mjs:8:9)', 'Object. (project/bar.js:7:1)' ]); t.equal(stack.clean(LinuxStack1), expected);