-
-
Notifications
You must be signed in to change notification settings - Fork 232
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
Installing 'source-map-support' package results in wrong call stack #1067
Comments
Steps to Reproduce: Run a test (using Jest or similar test framework) without importing source-map-support. it('test', () => { Run the same test with the require('source-map-support').install() line added before the test. it('test', () => { Expected Behavior: Importing @asyncapi/generator or any package that imports it should not impact the call stack of failing tests. The call stack should remain correct regardless of the imported packages. Suggested Solution: Remove the source-map-support package from @asyncapi/generator, as it is no longer needed for Node versions greater than or equal to 12.12.0. This change should resolve the issue without causing any further disruptions, but it is recommended to thoroughly test the functionality after making this change to ensure compatibility and stability. |
This issue has been automatically marked as stale because it has not had recent activity 😴 It will be closed in 120 days if no further activity occurs. To unstale this issue, add a comment with a detailed explanation. There can be many reasons why some specific issue has no activity. The most probable cause is lack of time, not lack of interest. AsyncAPI Initiative is a Linux Foundation project not owned by a single for-profit company. It is a community-driven initiative ruled under open governance model. Let us figure out together how to push this issue forward. Connect with us through one of many communication channels we established here. Thank you for your patience ❤️ |
Could anyone please look into this? |
isn't it fixed with #1165 ? |
I don't think so, because #1165 only removed As I mentioned before, |
yup, with latest major version we dropped node 12 support. could you open a PR that removes not needed code? |
Describe the bug
I originally stumbled upon this bug when I started using
nestjs-asyncapi
package (flamewow/nestjs-asyncapi#516).Importing one of their decorators resulted in wrong call stack for failing tests.
I narrowed it down a bit to a place where
nestjs-asyncapi
importsimport Generator from '@asyncapi/generator'
- commenting out that line resulted in correct call stacks.Then I dug deeper and found the actual cause: https://github.com/asyncapi/generator/blob/master/lib/utils.js#L155 - commenting out just that one line resulted in correct call stacks.
Apparently, https://github.com/evanw/node-source-map-support#installation-and-usage is not needed anymore for Node >=12.12.0.
My suggestion is to remove
source-map-support
package from@asyncapi/generator
, but I don't know whether that would break anything.P.S.: this is a second bug (#1030) which is caused by executing code outside the constructor. From the user/developer perspective, merely importing a function or a decorator (or anything else for that matter) from a package should not DO anything until you call or apply what you imported.
How to Reproduce
Run a simple test (I use
jest
):the resulting call stack is correct:
Now run the same test with
require('source-map-support').install()
line added:the resulting call stack is incorrect:
Expected behavior
Importing
@asyncapi/generator
(or any other library that imports it) should not impact the call stack of failing tests.The text was updated successfully, but these errors were encountered: