Skip to content

Commit 3bf9ab5

Browse files
committed
[WIP] Switch unit tests to use vitest
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).
1 parent 2537b4d commit 3bf9ab5

File tree

194 files changed

+14546
-21483
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

194 files changed

+14546
-21483
lines changed

.eslintrc.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,7 @@ module.exports = {
198198
"import/no-deprecated": "error",
199199
"import/no-extraneous-dependencies": [
200200
"error",
201-
{
202-
devDependencies: false,
203-
},
201+
{ devDependencies: ["**/*.test.ts", "**/__tests__/**"] },
204202
],
205203
"import/no-internal-modules": "off",
206204
"import/order": [

FILES.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,9 +183,7 @@ The rx-player contains multiple type of tests:
183183
- unit tests: test specific parts of the code. The main goal here is to check the
184184
implementation of smaller units of code.
185185

186-
They are written alongside the code, in `__tests__` directories. All its configuration
187-
can be found at the root of the project, in `jest.config.js` (we use the jest library
188-
for unit tests).
186+
They are written alongside the code, in `__tests__` directories.
189187

190188
- memory tests: test the memory usage of the player.
191189

jest.config.js

Lines changed: 0 additions & 29 deletions
This file was deleted.

0 commit comments

Comments
 (0)