-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Incorrect stack frame name #5180
Comments
I think it's caused by swc target defaulting to es5. |
neither works with es3, nor with es2021, nor without explicit target |
Sourcemapping is correctly working, while difference is how tsc picks up the mapping for the name vs. swc does. For both, see the actual stack frame points swc-jest-stack-frame-name\src\test.ts:4:16
and if we go to the actual source, https://github.com/DerGernTod/swc-jest-stack-frame-name/blob/2f672368aca1d86caac49d4c029779e58dff83ae/src/test.ts#L4= it points to original code
which is actual execution stack. However, even though stack frame points to 4:16, tsc points those name into different mapping at https://github.com/DerGernTod/swc-jest-stack-frame-name/blob/2f672368aca1d86caac49d4c029779e58dff83ae/src/test.ts#L3= instead. If we peek sourcemap generated by SWC, it includes
I'm not able to say which one is correct behavior honestly, but if stack location points 4:16, and SWC's mapping correctly points naming symbol at 4:16 this seems this is |
Though, one thing to consider is in native stack at v8 it seems to pick up fn name correctly.
|
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
I have a test that makes sure the stack trace of an error is correct. When I run the test with @swc/jest, the name of the function is changed to
apply
fromnamedHandlerFn
. It works fine when I run it with ts-jest.Versions:
You can reproduce it yourself with this reproducer: https://github.com/DerGernTod/swc-jest-stack-frame-name
Simply run
npm test
to see the result in ts-jest, andnpm run test-swc
if you want to see the issue.Stacks in comparison:
Expected (something around this, most importantly including
namedHandlerFn
):Actual:
If this is behavior is expected, is there a way I can inspect the files swc generates? If I debug into the test, break right when the error is generated and step into the ts file, is there a way I can see the transpiled file instead? I guess swc gets rid of the name for some reason.
The text was updated successfully, but these errors were encountered: