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

Document how to use source map support #20

Open
novemberborn opened this issue Apr 4, 2020 · 3 comments
Open

Document how to use source map support #20

novemberborn opened this issue Apr 4, 2020 · 3 comments
Labels
documentation Improvements or additions to documentation

Comments

@novemberborn
Copy link
Member

This provider doesn't translate error stack traces using source maps. We should document how you can set that up yourself, by installing source-map-support and adding source-map-support/register to AVA's require configuration.

@jonsadka
Copy link

@novemberborn happy to help document but the steps I've taken thus far don't seem to have changed anything.

After configuring per the README.md, I took your comment to mean:

  1. yarn add source-map-support
  2. Adding this one line to ava.config.js
{
   "ava": {
      require: ['source-map-support/register'],
   }
}

Further discussion

Assuming that we can get the above steps to work, what does source-map-support do beyond what TypeScript already does by adding "sourceMap": true, to the tsconfig.json?

If we building before running Ava, we should be getting the source maps we need, no?

"scripts": {
  "test": "tsc --build tsconfig.tests.json && nyc ava"
}

@jonsadka
Copy link

By chance, I tried running ava without nyc which gets source maps working. 🎉

Seems like the problem is related to issues with nyc that others have reported (avajs/ava#1604 -> istanbuljs/nyc#619) and not the TypeScript plugin.

@novemberborn
Copy link
Member Author

Assuming that we can get the above steps to work, what does source-map-support do beyond what TypeScript already does by adding "sourceMap": true, to the tsconfig.json?

It rewrites stack traces, taking the source map into account.

By chance, I tried running ava without nyc which gets source maps working. 🎉

Seems like the problem is related to issues with nyc that others have reported (avajs/ava#1604 -> istanbuljs/nyc#619) and not the TypeScript plugin.

Yea… this stuff gets complicated fast. nyc transforms the compiled TypeScript to add instrumentation, and probably attempts to rewrite stack traces to hide its work. But now the code that is executing is two transforms away from your source.

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

No branches or pull requests

2 participants