-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
decode does not allow stubbing for unit test with libraries such as sinon #870
Comments
Until it gets fixed, you can alter it in the test code as:
|
4 tasks
This does not work, because you cannot redefine a property:
|
Experiencing the same error |
Same here. |
The |
jakelacey2012
added a commit
to jakelacey2012/node-jsonwebtoken
that referenced
this issue
Feb 13, 2023
jakelacey2012
added a commit
that referenced
this issue
Apr 3, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
Changes to how
decode
is defined in 9.0.0 (15a1bc4) prevent it from being altered for unit tests by tools such assinon
, or even direct alteration such asAs a result errors such as
TypeError: Cannot redefine property: decode
are thrown in these scenarios.Other JWT libraries such as
jose
have addedconfigurable: true
to allow this scenario to succeed, which should probably be done here too:Reproduction
Test code such as
results in
Environment
9.0.0
n/a
n/a
n/a
The text was updated successfully, but these errors were encountered: