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(test-d): add test-d files for vitest typechecking: #1248

Merged

Conversation

Blu-J
Copy link
Collaborator

@Blu-J Blu-J commented Dec 20, 2024

Pull Request Checklist


PR-Codex overview

This PR primarily focuses on enhancing type-checking and testing configurations across various packages, while also removing unnecessary code related to AlchemyTransport. It introduces new test files and updates existing tests to ensure better type safety and code quality.

Detailed summary

  • Added test-d.ts files for improved type-checking.
  • Updated package.json files to exclude .test.ts and include .test-d.ts.
  • Modified CI workflow to include type-checking tests.
  • Enhanced CONTRIBUTING.md to reflect new testing practices.
  • Removed AlchemyTransport related code from client.test.ts.
  • Added new tests in client.test-d.ts for type assertions.

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

Copy link

vercel bot commented Dec 20, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
aa-sdk-site ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 10, 2025 5:32pm
aa-sdk-ui-demo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 10, 2025 5:32pm

Copy link
Collaborator Author

Blu-J commented Dec 20, 2024


How to use the Graphite Merge Queue

Add the label graphite-merge-queue to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@@ -102,3 +102,6 @@ jobs:
- name: Unit Test
run: yarn test:ci

- name: Typecheck Test
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We want to make sure that during the run we test our new function

image

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

image

@@ -3,6 +3,11 @@ import { configDefaults, defineConfig } from "vitest/config";

export const sharedConfig = defineConfig({
test: {
typecheck: {
enabled: process.env.TYPECHECK === "true",
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

So using a ENV because I should have been able to pass this as an argument to the vitest.
After hours of it not working, I did this env and it just works. So 🤷‍♀️

typecheck: {
enabled: process.env.TYPECHECK === "true",
only: process.env.TYPECHECK === "true",
ignoreSourceErrors: true,
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

When testing, files that just don't typecheck, ie the multisig account
Will fail this step without this set as true
image

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ah we should just exclude this file from the test sets since later we'll delete this file. That way the other tests can at least get caught as well. We've had cases where code built no prob but it ruined some branch of the types and we didn't notice cuz the tests don't get type checked

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

They already are excluded in the tests btw, just the typecheck will check non test files that are excluded.

@@ -17,6 +17,7 @@
"!vitest.config.ts",
"!.env",
"!src/**/*.test.ts",
"!src/**/*.test-d.ts",
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Anyplace that I found .test.ts I add the test-dvariant

moldy530
moldy530 previously approved these changes Dec 20, 2024
@Blu-J Blu-J force-pushed the 12-20-test_test-d_add_test-d_files_for_vitest_typechecking_ branch from d97b716 to 6269d09 Compare December 20, 2024 16:33
Copy link

vercel bot commented Dec 20, 2024

You must have Developer access to commit code to Alchemy on Vercel. If you contact an administrator and receive Developer access, commit again to see your changes.

Learn more: https://vercel.com/docs/accounts/team-members-and-roles/access-roles#team-level-roles

Copy link

graphite-app bot commented Dec 20, 2024

Merge activity

@Blu-J Blu-J force-pushed the jade/poc-same-client branch from cca9ba3 to e7bcc56 Compare January 7, 2025 16:37
@Blu-J Blu-J force-pushed the 12-20-test_test-d_add_test-d_files_for_vitest_typechecking_ branch from 5374388 to 80c1c59 Compare January 7, 2025 16:37
# Pull Request Checklist

- [x] Did you add new tests and confirm existing tests pass? (`yarn test`)
- [x] Did you update relevant docs? (docs are found in the `site` folder, and guidelines for updating/adding docs can be found in the [contribution guide](https://github.com/alchemyplatform/aa-sdk/blob/main/CONTRIBUTING.md))
- [x] Do your commits follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) standard?
- [x] Does your PR title also follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) standard?
- [x] If you have a breaking change, is it [correctly reflected in your commit message](https://www.conventionalcommits.org/en/v1.0.0/#examples)? (e.g. `feat!: breaking change`)
- [x] Did you run lint (`yarn lint:check`) and fix any issues? (`yarn lint:write`)
- [x] Did you follow the [contribution guidelines](https://github.com/alchemyplatform/aa-sdk/blob/main/CONTRIBUTING.md)?

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on enhancing type checking and testing for the `account-kit` packages, particularly by adding `test-d.ts` files and updating test commands. It also removes unused code related to Alchemy transport.

### Detailed summary
- Added `test-d.ts` files for type definitions in multiple packages.
- Updated `.github/workflows/on-pull-request.yml` to include type checking in tests.
- Modified `package.json` to add a new `test:typecheck` script.
- Updated `CONTRIBUTING.md` to reflect changes in testing commands.
- Removed Alchemy-related code from `client.test.ts`.

> ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}`

<!-- end pr-codex -->
@Blu-J Blu-J force-pushed the jade/poc-same-client branch from 22a2e20 to cd9053b Compare January 10, 2025 17:19
@Blu-J Blu-J force-pushed the 12-20-test_test-d_add_test-d_files_for_vitest_typechecking_ branch from e0db87d to 21acc9f Compare January 10, 2025 17:19
Base automatically changed from jade/poc-same-client to main January 10, 2025 17:34
@graphite-app graphite-app bot dismissed moldy530’s stale review January 10, 2025 17:34

The base branch was changed.

@graphite-app graphite-app bot merged commit 21acc9f into main Jan 10, 2025
8 checks passed
@graphite-app graphite-app bot deleted the 12-20-test_test-d_add_test-d_files_for_vitest_typechecking_ branch January 10, 2025 20:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants