-
Notifications
You must be signed in to change notification settings - Fork 34
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]: Jest to Vitest migration caravan-psbt
package
#133
[Test]: Jest to Vitest migration caravan-psbt
package
#133
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Out of 4 test 3, tests are passing but 1 test from Error Code textsrc/__tests__/psbtv0/psbt.test.ts [ src/__tests__/psbtv0/psbt.test.ts ]
Error: ecc library invalid
assert ../../node_modules/bitcoinjs-lib-v6/src/ecc_lib.js:70:20
verifyEcc ../../node_modules/bitcoinjs-lib-v6/src/ecc_lib.js:27:3
Proxy.initEccLib ../../node_modules/bitcoinjs-lib-v6/src/ecc_lib.js:11:5
src/psbtv0/psbt.ts:27:9
25| import { autoLoadPSBT } from "./utils";
26|
27| bitcoin.initEccLib(ecc);
| ^
28|
29| export interface PsbtInput {
src/__tests__/psbtv0/psbt.test.ts:2:31```
</details> |
While finding the fix for this I found a similar kind of issue here bitcoinjs/tiny-secp256k1#136 |
Thank you @bucko13, I've found the fix from the readme |
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.
Mostly looks good with some good dependency and configuration cleanup!
I have a question about the globals and if we can avoid the need for the test tooling imports and also adding some documentation for how to handle different js runtime environments.
packages/caravan-psbt/package.json
Outdated
"eslint-plugin-prettier": "^5.1.3", | ||
"jest": "^29.4.1", | ||
"jsdom": "24.0.0", | ||
"jsdom-global": "3.0.2", | ||
"lodash": "^4.17.21", | ||
"react-silence": "^1.0.4", |
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.
I think you replaced the uses of this right? so can probably uninstall.
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.
Yeah, I haven't uninstalled them completely since those modules are shared in other packages, if uninstalled the test suite there will fail.
I'll remove those unwanted modules once every package gets migrated to vitest : )
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.
Huh. That shouldn’t be the case with the monorepo since they should be isolated. Any package that uses this should have it in its own package.json
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.
Yeah, every package has its own package.json but the node_modules and package-lock.json files are shared among them
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.
Right so you should be able to remove it from THIS package.json, re-run npm install to update the package lock accordingly and then everything else should still worn
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.
I've re-run the npm i
command and pushed the changes in package-lock.json
file in my latest commit. I've also checked if the tests are running fine and they are.
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.
Right I don’t imagine anything has changed. It looks like react-silence is still in this packages package.json. I think you can remove it and then re-run everything and it should be fine. If it’s not working then that means another package needs to be explicit about the react silence dev dependency.
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.
I've removed react-silence from package.json of psbt but after doing so the tests in caravan-bitcoin were failing so I've installed the same in its own package.json file
fac329c
to
093d34c
Compare
That's amazing thank you @bucko13
Yeah, I've removed the unwanted imports from both
I've modified the readme section by adding a new testing section there |
packages/caravan-psbt/package.json
Outdated
"@inrupt/jest-jsdom-polyfills": "^3.2.1", | ||
"@jest/globals": "^29.7.0", | ||
"@types/jest": "^29.5.12", | ||
"@vitejs/plugin-react": "^4.3.1", |
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.
why was this necessary?
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.
I had moved that dependency to the root package.json file as of which I've removed it from here
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.
Just one question about the inclusion of @vitejs/plugin-react
otherwise this looks ready to go!
Jest to Vitest migration
caravan-psbt
packageRelated to #115
Screenshot
cc: @bucko13 @Legend101Zz