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:
[x] run npm run test and npm run lint and confirmed all checks still pass OR confirm CircleCI build passes
[x] verified that any code or assets from external sources are properly credited in comments or that everything is internally sourced
Vitest offers much of the functionality that Mocha does. It provides a
describe()
function,it()
, as well as hooks likebeforeEach()
andafterEach()
. However, there are some differences:before()
hook maps to VitestbeforeAll()
.after()
hook maps to VitestafterAll()
.it()
andspecify()
are synonyms. In Vitest, it'sit()
andtest()
. We usespecify()
for one test where it was awkward to start the test title with "it". I've replaced that use ofspecify()
withtest()
.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:
npm run test
andnpm run lint
and confirmed all checks still pass OR confirm CircleCI build passes