-
Notifications
You must be signed in to change notification settings - Fork 28
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
fix: do nothing if target does not exist in getters map #155
fix: do nothing if target does not exist in getters map #155
Conversation
Sorry the changes are causing issues, the test cases and libraries we cover are quite extensive! Do you know what library or module cause this? I see a couple of large projects linked that I can test. |
Feel free to fork https://github.com/opengovsg/starter-kit and test. The current vitest tests are failing due to v1.11.1. |
Co-authored-by: Brad Adams <hi@breadadams.com>
I haven't debugged this yet but guess this is caused by the code checking for a default export and there is none so it should return undefined rather than throw. |
I think a suitable test case could be added to the the end of test I added and it would check for an export that doesn't exist and confirm it's undefined without throwing. const imp = await import('../fixtures/foo.mjs')
strictEqual(imp.foo(), 'foo-first-second')
// This should not throw!
strictEqual(imp.doesNotExist, undefined) |
That test case does not fail even before this fix, so might not be useful to add! |
Found a test case that passes with this fix but not previously. Unsure if that's expected behaviour though. Will leave it to you to decide |
`import-in-the-middle` v1.11.0 release broke datadog's vitest test visibility tracing. This PR temporarily disables the visibility harness for unit tests (playwright not affected) until it's fixed. Related: * DataDog/dd-trace-js#4732 * nodejs/import-in-the-middle#155 ## Solution This change disables the Datadog Test Visibility configuration and tracing in the CI workflow for the isomer-studio project. **Breaking Changes** - [x] No - this PR is backwards compatible **Improvements**: - Removed Datadog Test Visibility configuration step from the CI workflow - Commented out Datadog-related environment variables for the test run ## Tests No new tests are required for this change. Existing tests should continue to run without Datadog tracing.
Thanks @bizob2828. We had agreed on at least 2 approvals before merging so I'd still like an approval from another maintainer before merging! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks for fixing this 👍
#153 introduced the
getters
map to allow for multiple hooks. However, there may exist edge cases where the name does not exist in the target, resulting in the following error:I am unable to trace why this happens, and thus am unable to create a test case. However, a hooked package resulted in the following
target
andname
values when I logged it.typeof getters.get(target)[name]
could also beundefined
and cause a type error. I've made the type check stricter before invoking the function.See DataDog/dd-trace-js#4713 (comment) for context