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

chore: integrate vitest matchers globally #3425

Conversation

starc007
Copy link
Contributor

@starc007 starc007 commented Nov 26, 2024

Summary

  • Integrates Vitest matchers globally, improving test maintainability and type safety.

Checklist

  • All changes are covered by tests (or not applicable)
  • All changes are documented (or not applicable)
  • I reviewed the entire PR myself (preferably, on GH UI)
  • I described all Breaking Changes (or there's none)

Copy link

vercel bot commented Nov 26, 2024

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

Name Status Preview Comments Updated (UTC)
fuels-template ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 10, 2024 0:23am
ts-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 10, 2024 0:23am
ts-docs-api ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 10, 2024 0:23am

@CLAassistant
Copy link

CLAassistant commented Nov 26, 2024

CLA assistant check
All committers have signed the CLA.

Copy link

vercel bot commented Nov 26, 2024

@starc007 is attempting to deploy a commit to the Fuel Labs Team on Vercel.

A member of the Team first needs to authorize it.

Copy link

codspeed-hq bot commented Nov 27, 2024

CodSpeed Performance Report

Merging #3425 will improve performances by 47.77%

Comparing starc007:starc007/feat/integrate-vitest-matchers-globally (d7032cf) with master (a3842a5)

Summary

⚡ 1 improvements
✅ 17 untouched benchmarks

Benchmarks breakdown

Benchmark master starc007:starc007/feat/integrate-vitest-matchers-globally Change
Instantiate from an address 576.8 µs 390.3 µs +47.77%

Copy link
Contributor

@Torres-ssf Torres-ssf left a comment

Choose a reason for hiding this comment

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

Hey @starc007,

Thank you so much for this contribution. We really appreciate it 🙏

It appears that the current solution hasn’t resolved the TS errors.

Screenshot 2024-11-27 at 9 13 42 AM

@Torres-ssf Torres-ssf added chore Issue is a chore good first issue Suitable for newcomers looking to contribute and removed feat Issue is a feature labels Nov 27, 2024
@Torres-ssf Torres-ssf changed the title feat: integrate vitest matchers globally chore: integrate vitest matchers globally Nov 27, 2024
Copy link
Contributor

@danielbate danielbate left a comment

Choose a reason for hiding this comment

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

This PR also needs a changeset, please run pnpm changeset from the root directory.

@starc007
Copy link
Contributor Author

Hey @Torres-ssf

Issue:
When running pnpm lint (type:check-tests), the type checker fails because the matchers aren't being recognized globally. However, when importing setupTestMatchers directly in the test file (e.g. abi-coder.test.ts), it works as expected.

This suggests the setupFiles configuration in vitest.shared.config.mts isn't being properly loaded during type checking.

Questions:

  1. Is there a different way we should be configuring the global setup file for both runtime and type checking?
  2. Should we be using a different approach to register global matchers that works with the type system?

Any guidance on the correct way to set this up would be appreciated.

packages/fuel-gauge/tsconfig.json Outdated Show resolved Hide resolved
packages/fuel-gauge/src/abi/vitest.matcher.ts Outdated Show resolved Hide resolved
packages/fuel-gauge/vitest.setup.ts Outdated Show resolved Hide resolved
.changeset/clean-plums-wait.md Outdated Show resolved Hide resolved
@petertonysmith94 petertonysmith94 marked this pull request as draft December 2, 2024 10:49
@starc007
Copy link
Contributor Author

hey @petertonysmith94

pushed those changes

Copy link
Contributor

@petertonysmith94 petertonysmith94 left a comment

Choose a reason for hiding this comment

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

Nice one @starc007 🚀

@Dhaiwat10 Dhaiwat10 closed this Dec 10, 2024
auto-merge was automatically disabled December 10, 2024 12:19

Pull request was closed

@Dhaiwat10 Dhaiwat10 reopened this Dec 10, 2024
@petertonysmith94 petertonysmith94 merged commit 896bf5b into FuelLabs:master Dec 10, 2024
29 of 33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Issue is a chore cla:signed good first issue Suitable for newcomers looking to contribute
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Integrate vitest matchers globally
6 participants