test(ioredis): test ioredis ESM usage #1752
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.tsfiles. :)A full test run with this patch: