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

Use Vitest names for testing globals #999

Merged
merged 3 commits into from May 13, 2024
Merged

Use Vitest names for testing globals #999

merged 3 commits into from May 13, 2024

Conversation

matthew-white
Copy link
Member

@matthew-white matthew-white commented May 10, 2024

Vitest offers much of the functionality that Mocha does. It provides a describe() function, it(), as well as hooks like beforeEach() and afterEach(). However, there are some differences:

  • The Mocha before() hook maps to Vitest beforeAll().
  • The Mocha after() hook maps to Vitest afterAll().
  • In Mocha, it() and specify() are synonyms. In Vitest, it's it() and test(). We use specify() for one test where it was awkward to start the test title with "it". I've replaced that use of specify() with test().

A future PR will actually replace Mocha with Vitest. However, it'll reduce the size of that PR to start renaming these globals now. This PR uses Vitest names for testing globals, making replacements along the lines of what's described above. It then specifies those names in the ESLint config. Related issue: #671

What has been done to verify that this works as intended?

Testing and linting continue to pass.

Before submitting this PR, please make sure you have:

  • run npm run test and npm run lint and confirmed all checks still pass OR confirm CircleCI build passes
  • verified that any code or assets from external sources are properly credited in comments or that everything is internally sourced

@matthew-white matthew-white requested a review from ktuite May 10, 2024 17:53
@matthew-white matthew-white merged commit 7742154 into master May 13, 2024
1 check passed
@matthew-white matthew-white deleted the vitest-globals branch May 13, 2024 19:45
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.

None yet

2 participants