Skip to content
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: instanceof Uint8Array does not work correctly for vitest' env jsdom #1531

Merged
merged 11 commits into from
Nov 22, 2024

Conversation

freemanzMrojo
Copy link
Member

@freemanzMrojo freemanzMrojo commented Nov 21, 2024

Description

All details in the issue comments.

Closes #1424.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Go to this branch in DappKit and run the tests as described in the issue. Keep in mind that, in order for them to work:

  1. You have to have the SDK and DappKit codebases in the same folder
  2. You have to build (yarn build) the core package in the SDK
  3. Then you can run the DappKit tests as described in the issue.

Test Configuration:

  • Node.js Version: 20.18.0
  • Yarn Version: 1.22.22

Checklist:

  • My code follows the coding standards of this project
  • I have performed a self-review of my code
  • I have commented on my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • New and existing integration tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • I have not added any vulnerable dependencies to my code

@freemanzMrojo freemanzMrojo requested a review from a team as a code owner November 21, 2024 16:13
Copy link

github-actions bot commented Nov 21, 2024

Test Coverage

Summary

Lines Statements Branches Functions
Coverage: 99%
98.99% (4345/4389) 97.54% (1390/1425) 98.9% (901/911)
Title Tests Skipped Failures Errors Time
core 827 0 💤 0 ❌ 0 🔥 2m 20s ⏱️
network 719 0 💤 0 ❌ 0 🔥 4m 43s ⏱️
errors 42 0 💤 0 ❌ 0 🔥 17.57s ⏱️
logging 3 0 💤 0 ❌ 0 🔥 19.23s ⏱️
hardhat-plugin 19 0 💤 0 ❌ 0 🔥 58.325s ⏱️
aws-kms-adapter 23 0 💤 0 ❌ 0 🔥 1m 26s ⏱️
ethers-adapter 5 0 💤 0 ❌ 0 🔥 1m 12s ⏱️
rpc-proxy 37 0 💤 0 ❌ 0 🔥 1m 1s ⏱️

@freemanzMrojo freemanzMrojo changed the title fix: ensuring string and correct Uint8Array for CommonJS bundle fix: instanceof Uint8Array does not work correctly for the CommonJS bundle Nov 21, 2024
@freemanzMrojo freemanzMrojo changed the title fix: instanceof Uint8Array does not work correctly for the CommonJS bundle fix: instanceof Uint8Array does not work correctly for vitest' env jsdom Nov 21, 2024
@leszek-vechain
Copy link
Collaborator

can we add similar test on our side ? (like the one from the original issue)

@freemanzMrojo
Copy link
Member Author

freemanzMrojo commented Nov 22, 2024

can we add similar test on our side ? (like the one from the original issue)

hi @leszek-vechain just added in the last couple of commits a config to run vitest with jsdom. the config though is much more simpler than the one in DappKit. The way I tested it is described in the PR description 👍

Hope this is enough for you :p . We can build on top of this, since all the vite tests will have both configs.

@freemanzMrojo
Copy link
Member Author

I also added an eslint rule to prevent the usage of instanceof Uint8Array (last commit) 👌 @leszek-vechain

@freemanzMrojo freemanzMrojo merged commit 3d4d8ce into main Nov 22, 2024
16 checks passed
@freemanzMrojo freemanzMrojo deleted the fix/1424-ensuring-string branch November 22, 2024 11:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🐛 [BUG] - jsdom testing environment is not supported by the sdk
2 participants