Skip to content

Commit

Permalink
use vitest for integration tests (#1444)
Browse files Browse the repository at this point in the history
* install vitest

* add chrome flags for autoplay policy

* add vitest import

* change timeout config to be compatible with vitest API

* fixup installation

* upgrade package.json

* change xit to supported api  for vitest

* use timeout api for vitest

* WIP

* delete deprecated tslint and add rule for type export

* apply eslint fix for import type

* add global variable to vitest config

* remove webdriver lib from tsconfig

* update memory test to be compliant with vitest API

* update package script to run memory test wiht vitest

* add missing import for vitest

* remove chai from project and replace it by vitest assertion lib

* try to upgrade node version in CI to fix bug

* remove chai types

* bump package version

* add a vitest config

* create a globalSetup for vitest

* change to new timeout api

* change require to import for raw and arraybuffer file

* fix: enable browser mode

* rename tests files to .test.js

* update package.json scripts

* lint

* update CI to use npm script

* Remove now unneeded dependencies

* Re-add @vitest/browser

* Remove notion of mocha chai and sinon from CONTRIBUTING.md, replacing it by vitest

* Remove reliance on sinon for fake timers and stubs

* parametrize test config so it can run on firefox

* use cross-env for compatibility

* delete useless files and lint

* increase timeout for a flaky test

* skip problematic test on firefox

* fix

* skip test

* delete file globalSetup

* PR feedback

* specify the folder scenario for integration tests

* rename files

* make port param optional

---------

Co-authored-by: Paul Berberian <[email protected]>
  • Loading branch information
Florent-Bouisset and peaBerberian authored Jun 14, 2024
1 parent 424ff17 commit 6be1683
Show file tree
Hide file tree
Showing 82 changed files with 13,361 additions and 9,276 deletions.
31 changes: 2 additions & 29 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,7 @@ module.exports = {
project: "tsconfig.eslint.json",
sourceType: "module",
},
plugins: [
"eslint-plugin-import",
"eslint-plugin-jsdoc",
"ban",
"@typescript-eslint",
"@typescript-eslint/tslint",
],
plugins: ["eslint-plugin-import", "eslint-plugin-jsdoc", "ban", "@typescript-eslint"],
rules: {
"ban/ban": [
2,
Expand Down Expand Up @@ -80,6 +74,7 @@ module.exports = {
},
],
"@typescript-eslint/consistent-type-imports": "error",
"@typescript-eslint/consistent-type-exports": "error",
"@typescript-eslint/naming-convention": [
"error",
{
Expand Down Expand Up @@ -309,27 +304,5 @@ module.exports = {
"use-isnan": "error",
"valid-typeof": "error",
yoda: "error",
"@typescript-eslint/tslint/config": [
"error",
{
rules: {
encoding: true,
"import-spacing": true,
"prefer-while": true,
"return-undefined": true,
whitespace: [
true,
"check-branch",
"check-decl",
"check-operator",
"check-module",
"check-separator",
"check-type",
"check-typecast",
"check-preblock",
],
},
},
],
},
};
10 changes: 5 additions & 5 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:

strategy:
matrix:
node-version: [16.x]
node-version: [20.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
Expand All @@ -57,7 +57,7 @@ jobs:

strategy:
matrix:
node-version: [16.x]
node-version: [20.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
Expand All @@ -75,7 +75,7 @@ jobs:

strategy:
matrix:
node-version: [16.x]
node-version: [20.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
Expand All @@ -93,14 +93,14 @@ jobs:
- run: npm run build
# Firefox seems to have issue with integration tests on GitHub actions only
# TODO to check
- run: node tests/integration/run.mjs --bchromehl
- run: npm run test:integration

memory_linux:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [16.x]
node-version: [20.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ New integration tests are not required when a new code is added. Just make sure
those tests pass before doing a pull request by running: `npm run test:integration`.

It you want to improve our integration tests, you are welcome to do so. Those are wrote in
`tests/integration` with the help of the Mocha, Chai and Sinon libraries.
`tests/integration` with the help of the `vitest` library.

We also use a homemade library and server to serve media contents to our tests. If you
want to know how it works, we invite you to rely on the already created tests and to read
Expand All @@ -240,7 +240,7 @@ the corresponding files.
Memory tests replicate simple scenarios and try to detect memory leaks.

You can also help us improving our memory tests. Those are written in `test/memory`. The
testing stack used is Mocha, Chai and Sinon.
testing library used is `vitest`.

## Documentation

Expand Down
Loading

0 comments on commit 6be1683

Please sign in to comment.