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

test(crypto): improve test coverage #4620

Merged
merged 9 commits into from
Apr 22, 2024
Merged

Conversation

mbhrznr
Copy link
Contributor

@mbhrznr mbhrznr commented Apr 21, 2024

working towards #3713.
pushes code coverage of the crypto sub-module closer to 100%.

currently the following files aren't at 100%:

  • _wasm:
    • personally i'm just too unfamiliar w/ what's going on.
    • tried my best to add test cases but nothing seemed to work, so reverted what i had going.
  • crypto:
    • due to the way webCrypto is bound to globalThis.crypto my usual strategy of stubbing didn't seem to work out.
    • would webCrypto.subtle.digest ever be falsy to begin with?
  • unstable_keystack:
    • for Symbol.for("nodejs.util.inspect.custom") i tried to simply import inspect from node:util and compare the outcome, similar on how the test case for Symbol.for("Deno.customInspect") looked like. however this didn't change anything on cov.

@mbhrznr mbhrznr requested a review from kt3k as a code owner April 21, 2024 15:38
Copy link

codecov bot commented Apr 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.99%. Comparing base (06866a6) to head (8651ddb).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4620      +/-   ##
==========================================
+ Coverage   90.89%   90.99%   +0.09%     
==========================================
  Files         475      478       +3     
  Lines       37325    37383      +58     
  Branches     5293     5308      +15     
==========================================
+ Hits        33927    34016      +89     
+ Misses       3336     3305      -31     
  Partials       62       62              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@iuioiua iuioiua left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent work so far! I don't think we can do much about crypto/_wasm/lib/deno_std_wasm_crypto.generated.mjs. Maybe we should just ignore it in Codecov.

crypto/crypto_test.ts Outdated Show resolved Hide resolved
crypto/crypto_test.ts Outdated Show resolved Hide resolved
crypto/crypto_test.ts Outdated Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i've tried by stubbing webCrypto to be able to get into the remaining else block, but no luck so far.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, that last else clause might be redundant. I'll handle this in a separate PR.

crypto/unstable_keystack_test.ts Outdated Show resolved Hide resolved
@mbhrznr mbhrznr requested a review from iuioiua April 22, 2024 19:25
Copy link
Contributor

@iuioiua iuioiua left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great stuff! Thank you.

@iuioiua iuioiua merged commit f5f9ca9 into denoland:main Apr 22, 2024
14 checks passed
@mbhrznr mbhrznr deleted the test/crypto branch May 13, 2024 15:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants