Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error opening map file that contains URI encoded symbols in file name #245

Open
albertlaiuste opened this issue Mar 28, 2024 · 0 comments
Open

Comments

@albertlaiuste
Copy link

I ran into an issue where I generated source maps with tsc but after that Jest stopped working for me when trying to open a map file containing curly brackets {orderId}.js.map with error:

Error: An error occurred while trying to read the map file at %7BorderId%7D.js.map
Error: ENOENT: no such file or directory, open '.../build/api/routes/orders/%7BorderId%7D.js.map'
    at Object.readFileUtf8 (node:internal/fs/sync:25:18)
    at readFileSync (node:fs:441:19)
    at V8ToIstanbul._readFileFromDir (.../node_modules/v8-to-istanbul/lib/v8-to-istanbul.js:94:12)

In /lib/v8-to-istanbul.js, when I replaced

  _readFileFromDir(filename) {
    return readFileSync(resolve(dirname(this.path), filename), 'utf-8')
  }

with

  _readFileFromDir(filename) {
    return readFileSync(resolve(dirname(this.path), decodeURIComponent(filename)), 'utf-8')
  }

resolved this for me but I'm unsure of the impact of this change or if it is the correct implementation for this.

I didn't find any issue mentioning this on a quick glance so I thought I'd report on this here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant