You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Source maps get confusing real fast. I'd like to handle them more explicitly, removing the installation of source-map-support.
This means that any processing of stack traces should assume they have not been corrected for source maps. We should avoid unnecessarily processing stack traces in the worker processes. That means delaying source extraction:
I'm really not too bothered about the stack traces that end up in the TAP output.
Line number selection attempts to find the original position of a test declaration. This does rely on a stack trace underneath. We should still convert using source maps, like we do now… though the current implementation probably breaks in certain conditions:
That just leaves us with pre-compiled files that are not loaded through our providers, and files loaded with things like ts-node/register. Hopefully, those tools either already rewrite the stack traces for us, or source-map-support/register can be required by the user.
But, we do need an option to "assume stack traces are correct" which disables any source mapping. Otherwise we may and up mapping call sites twice.
My apologies for this issue being a bit of a brain dump. We can hash out the specifics together! The nice thing of this approach is that AVA won't change how your code runs (with automatic stack trace rewriting…), so your tests will better reflect what happens in live code.
The text was updated successfully, but these errors were encountered:
Source maps get confusing real fast. I'd like to handle them more explicitly, removing the installation of
source-map-support
.This means that any processing of stack traces should assume they have not been corrected for source maps. We should avoid unnecessarily processing stack traces in the worker processes. That means delaying source extraction:
ava/lib/serialize-error.js
Line 76 in 1222ce9
Instead the main process should rewrite the stack trace. We should focus on the mini and verbose reporters (#2217 notwithstanding):
ava/lib/reporters/beautify-stack.js
Lines 68 to 72 in 1222ce9
I'm really not too bothered about the stack traces that end up in the TAP output.
Line number selection attempts to find the original position of a test declaration. This does rely on a stack trace underneath. We should still convert using source maps, like we do now… though the current implementation probably breaks in certain conditions:
ava/lib/worker/line-numbers.js
Lines 74 to 81 in 1222ce9
It should be possible to ask our
@ava/babel
and@ava/typescript
providers to reverse-map a call site to the original source location.We could do the same in the snapshot manager:
ava/lib/snapshot-manager.js
Lines 399 to 405 in 1222ce9
That just leaves us with pre-compiled files that are not loaded through our providers, and files loaded with things like
ts-node/register
. Hopefully, those tools either already rewrite the stack traces for us, orsource-map-support/register
can be required by the user.But, we do need an option to "assume stack traces are correct" which disables any source mapping. Otherwise we may and up mapping call sites twice.
My apologies for this issue being a bit of a brain dump. We can hash out the specifics together! The nice thing of this approach is that AVA won't change how your code runs (with automatic stack trace rewriting…), so your tests will better reflect what happens in live code.
The text was updated successfully, but these errors were encountered: