-
Notifications
You must be signed in to change notification settings - Fork 83
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
chore(tests): Convert to typescript and use Jest #188
Conversation
Would you agree on putting in place ESlint rules for jest? What about the recommended preset? |
@wolfy1339 if you need help or want to split some tests together (as branch from your branch) let me know :) |
ESLint isn't used (at least exposed to the user), since Prettier is used |
e48290c
to
7a6ce05
Compare
Found this little bug when doing #188
Found this little bug when doing #188 Co-authored-by: OscarDOM <[email protected]>
63eacc2
to
aab4b4f
Compare
I need some help. I've got things mostly done here. The tests in Relevant logs:
|
@dominguezcelada Care to help me on this? I noted the errors I'm getting in my previous comment |
I opened a PR to this branch which I think is solving the issue with timeouts: #195 If you think this is the solution, feel free to merge it in your branch :) |
#198 WIP Once we finish this, if this is the right approach to follow, what do you think about getting rid of |
btw, before doing merge, I think we should make the first commit (or the resulting squashed one to be |
6022d1d
to
50322a1
Compare
After |
b3f07a9
to
1cd9000
Compare
Hey @wolfy1339 it seems we were overlaping on fixing the changes. If there's something I can help or we can split / pair-program let me know! :) |
Just leave a comment as to what file/what issue you're working on, that should be just fine
|
Getting |
Getting |
Getting |
We only need to fix the coverage for |
@dominguezcelada According to the coverage report, it seems that the lines that aren't being used are related to timeouts, which was added in dfdfc46 From what I can understand of the code, a timeout needs to be simulated and doing so using @gr2m Any ideas how to test that |
I just applied the test coverage. I'm using Jest's Timer Mocks utility. Is that ok @gr2m @wolfy1339 ? |
Fix some types Replace some remaining tap functions Ignore some TypeScript type errors, they are there on purpose to test if the function throws an error
…ed to run are executed
… test to wait until all expect
- Pull in the relevant types package for `@sinonjs/fake-timers` - Convert those tests from tap to Jest - Add some Typescript types to those tests
Adds back the existing error message that was removed
3e77959
to
3825b15
Compare
As sorry, I thought you meant the error was on master. I got a pull request merged into I can look into the error on |
@wolfy1339 @gr2m Solved |
I think we are ready to go now 💪 🍾 |
src/sign/index.ts
Outdated
@@ -1,6 +1,7 @@ | |||
import { createHmac } from "crypto"; | |||
|
|||
export function sign(secret: string, payload: string | object): string { | |||
export function sign(secret?: string, payload?: string | object): string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you revert this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you revert this change?
@gr2m without this change we are not able to give coverage to this
Lines 4 to 6 in d4bd29b
if (!secret || !payload) { | |
throw new TypeError("secret & payload required"); | |
} |
Maybe you prefer this approach on for tests so we give coverage but we bypass the TypeScript check? #237
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Outstanding work @wolfy1339 & @dominguezcelada 🥇🥇🎊
🎉 This PR is included in version 7.11.3 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Fixes #187