-
Notifications
You must be signed in to change notification settings - Fork 531
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
test(ioredis): test ioredis ESM usage #1752
Conversation
This is an attempt to test ESM usage of ioredis based on Marc's comment at open-telemetry#1731 (comment) This *passes*, but the thing that scares me is enabling the ESM hook for .test.ts tests as well. The IORedisInstrumentation patch method is being called *both* for ESM and CommonJS for ioredis.test.ts -- I don't understand that. Refs: open-telemetry#1731 Refs: open-telemetry#1735
Codecov Report
@@ Coverage Diff @@
## main #1752 +/- ##
==========================================
+ Coverage 90.98% 91.46% +0.47%
==========================================
Files 129 139 +10
Lines 6448 7172 +724
Branches 1296 1446 +150
==========================================
+ Hits 5867 6560 +693
- Misses 581 612 +31
|
I actually had two different scripts
That had a few problems though:
TL;DR: it was not ideal to say the least, and needed a lot of modifications to the current setup to get it to work. Even then it may not have been accurate as we don't publish ESM files with our instrumentations. Thank you for trying this out too, though. I think once tooling catches up we may be able to re-visit this approach, but right not it does not seem like a feasible solution as there are a lot of moving parts. I'll put on my list to polish what I did and then push a branch for future reference. |
I've opened a draft to show what I did in my testing: #1794 |
This is no longer needed now that the alternative ESM testing option (#1735) has been merged. |
This PR is not intended for merging. It is to support discussion of #1731. Maintainers can unassign themselves, and perhaps assign me.
This is an attempt to test ESM usage of ioredis based on Marc's comment at #1731 (comment)
This passes, but the thing that scares me is enabling the ESM hook for .test.ts tests as well. The IORedisInstrumentation patch method is being called both for ESM and CommonJS for ioredis.test.ts -- I don't understand that.
Refs: #1731
Refs: #1735
This would be an alternative to #1735.
@pichlermarc Is this close to what you tried for your ESM testing experiements? This runs and passes, however I don't grok the:
output for the execution of "test/ioredis.test.ts" -- for what should be just CommonJS. It would scare me a little bit to turn on
NODE_OPTIONS='--loader @opentelemetry/instrumentation/hook.mjs'
for all*.test.ts
files. :)A full test run with this patch: