-
Notifications
You must be signed in to change notification settings - Fork 132
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
Switch unit tests to use vitest #1445
Conversation
0df9add
to
83fdeb6
Compare
import { describe, beforeEach, afterEach, it, expect, vi } from "vitest"; | ||
import arrayFindIndex from "../array_find_index"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if the copyright header needs to be on every file, but it seems it has been removed by mistake ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No I originally added them because it was there in other files, kind of out of respect for my elders basically :p
Yet we already have a global LICENSE file and those notices clutter the files too much, so now that we technically refactor those files, I profit from it by removing those - silently enough as not to wake up any potential over-zealous lawyer 🤫
3fdcc38
to
e5734e5
Compare
d1422a2
to
63d295e
Compare
7e2ea17
to
fb29c1f
Compare
abc6a78
to
4d40b98
Compare
6bd98b5
to
9828d1d
Compare
64250eb
to
c554adb
Compare
e368c3d
to
b4fe9e7
Compare
2938954
to
d40a343
Compare
b4fe9e7
to
f38e196
Compare
To extrapolate on #1444, this PR shows how it would look like to switch from relying on Jest to rely on vitest for our unit tests. The end goal being to simplify our codebase by relying on a single testing framework. --- I only done so for testing files in the `src/compat` directory in this demo. It can be tested right now by calling `npm run test:unit:vitest`. --- Sadly for now, we are still forced to rely on a JSDom-ed Node.js environment for unit tests and a browser environment for integration tests - meaning we have very different configs for both. This is because we want to mock imported files in unit tests - something that is not possible for now in browser environment through vitest (though vitest/5765 seems to have been merged very recently so maybe we could rely on the browser for both soon), yet we want to replicate as much as a real browser as possible in our integration tests (because we're also testing that media playback on the tested browsers goes as expected).
f38e196
to
38b8163
Compare
To extrapolate on #1444, this PR shows how it would look like to switch from relying on Jest to rely on vitest for our unit tests.
The end goal being to simplify our codebase by relying on a single testing framework.
It can be tested right now by calling
npm run test:unit
.Sadly for now, we are still forced to rely on a JSDom-ed Node.js environment for unit tests and a browser environment for integration tests - meaning we have very different configs for both.
This is because we want to mock imported files in unit tests - something that is not possible for now in browser environment through vitest (though vitest/5765 [any real link seems to spam their GitHub page, even with a random anchor added to it] seems to have been merged very recently so maybe we could rely on the browser for both soon), yet we want to replicate as much as a real browser as possible in our integration tests (because we're also testing that media playback on the tested browsers goes as expected).