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

Run a Codeshift to move away from the custom test runner #1274

Closed
wants to merge 6 commits into from

Conversation

yeoffrey
Copy link
Contributor

@yeoffrey yeoffrey commented Aug 20, 2024

Related: #1244

This PR does a few things to the testing suite:

  • It removes the old test runner and instead turns each test, which was previously a configuration for a test, into its own vitest test.
  • it adds a custom matcher to compare StructErrors, since there is extra logic on comparing StructErrors in the old test runner and its worth not redefining that check everywhere.

In a follow up I'd like to move all the tests into one file per struct, but that can be done by hand later.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here is the script for renaming the files to end with .test.ts

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here is my script for running the Codeshift (warning its actually terrible but whatever)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Adding a vitest configuration file for adding the custom matcher

Copy link
Contributor Author

Choose a reason for hiding this comment

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

File for adding custom matchers, which includes .toMatchStructError

The old test runner would check for a failure, and check that the StructError gave the right failures but also that the StructError's properties (only the FILTERED_PROPS ones) matched the first Failure returned by the failures generator on the StructError

@yeoffrey yeoffrey closed this by deleting the head repository Dec 3, 2024
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.

1 participant