-
Notifications
You must be signed in to change notification settings - Fork 499
Add LiteSVM Tests for Checking Accounts (Anchor) #467
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
base: main
Are you sure you want to change the base?
Add LiteSVM Tests for Checking Accounts (Anchor) #467
Conversation
- Change module system to 'nodenext' - Update target to 'es2020' - Enable JSON module resolution
- Upgrade @solana/web3.js to version 1.98.4 - Add litesvm as a new dependency with version 0.4.0 - Update pnpm-lock.yaml to reflect changes in dependency versions and resolutions
- Introduce a new test script for LiteSVM in the Anchor.toml configuration file.
- Remove anchor-bankrun and solana-bankrun dependencies from package.json and pnpm-lock.yaml. - Delete the bankrun.test.ts file as it is no longer needed, It's deprecated.
|
|
||
| [scripts] | ||
| test = "pnpm ts-mocha -p ./tsconfig.json -t 1000000 tests/**/*.ts" | ||
| litesvm-test = "node --test tests/litesvm.test.ts" |
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.
the test script should work for tests/litesvm.test.ts too
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.
Thank you for the review 🙌🏼.
Yes, litesvm-test is a separate script, but it uses the Node test runner, not Mocha.
Running anchor test will execute both test suites (litesvm-test.ts and test.ts).
Running anchor run litesvm-test will execute only the LiteSVM tests using the Node test runner.
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.
if litesvm.test.ts is the only test, what's the point of having two scripts that run it.
just the test script should be fine.
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.
Good point. To clarify: there are two different test files at tests directory with different purposes.
- Anchor test — full validator (Mocha + Chai)
- LiteSVM test — fast lightweight test (Node test runner)
That’s why both scripts currently exist.
If you prefer combining or simplifying them, I can update the PR 🙌🏼
|
Thanks for this and the other PR @sol-warrior , clean up the scripts and we'll run the workflows |
|
hey @sol-warrior could please finish this up? remove bankrun, just use litesvm |
- Change the import path for CheckingAccountProgram to include the .ts extension. - Rename the test suite description to "Anchor: Checking accounts" for clarity.
… assertion library - Replace Node's strict assert with Chai's assert for improved testing capabilities. - Remove unused imports in litesvm.test.ts for cleaner code. - Ensure consistency in Anchor.toml by maintaining the test script format.
Thanks — I cleaned up the test script. Now there is only one script that runs both tests and keeps it consistent with the other examples. Changes are pushed. |
This PR modernizes the
checking-accounts Anchor exampleby replacing deprecated Bankrun tests with a new LiteSVM test suite and aligning the project with current Solana testing practices as @Perelyn-sama mentioned in prev PR , bankrun is deprecated.Changes Included
Anchor.toml.Request
@jacobcreech When you have a moment, I’d appreciate your review on this update.
Any suggestions or adjustments are most welcome — I’m happy to refine anything as needed.
Thank you for your time and support 🙌🏼