folke / esbuild-runner

⚡️ Super-fast on-the-fly transpilation of modern JS, TypeScript and JSX using esbuild

Home Page:https://www.npmjs.com/package/esbuild-runner

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

paths in `Error.stack` "multiply" ...?

mindplay-dk opened this issue · comments

I tried switching from ts-node to esbuild-runner, as you can see here.

In this project, and I obtain paths from Error.stack, very simply, as you can see here:

        const location = new Error().stack!
          .split("\n")[2]
          .replace(/^\s+at /, "");

For some reason, the paths in stack-traces appear to... multiply?

For example, if you run npm run test, you'll see test output like this:

  × [equal] it produces the expected test results
  └ /home/mindplay/workspace/funky-test/test/test/test.ts:76:10

That path is /home/mindplay/workspace/funky-test/test/test.ts:76:10, so there's a /test too many in there.

As there is test coverage for that fact, you will see failing tests as well:

   ×          "location": "/home/mindplay/workspace/funky-test/test/test/cases.ts:9:6",
   √          "location": "/home/mindplay/workspace/funky-test/test/cases.ts:9:6",

Something appears to be not right with the run-time path resolution of this loader?