Document how to use source map support
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.
@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:
yarn add source-map-support- 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"
}
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 (https://github.com/avajs/ava/issues/1604 -> https://github.com/istanbuljs/nyc/issues/619) and not the TypeScript plugin.
Assuming that we can get the above steps to work, what does
source-map-supportdo beyond what TypeScript already does by adding"sourceMap": true,to thetsconfig.json?
It rewrites stack traces, taking the source map into account.
By chance, I tried running
avawithoutnycwhich gets source maps working. 🎉Seems like the problem is related to issues with
nycthat 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.