Skip to content

Commit 6be1683

Browse files
use vitest for integration tests (#1444)
* 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]>
1 parent 424ff17 commit 6be1683

File tree

82 files changed

+13361
-9276
lines changed

Some content is hidden

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

82 files changed

+13361
-9276
lines changed

.eslintrc.js

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,7 @@ module.exports = {
1414
project: "tsconfig.eslint.json",
1515
sourceType: "module",
1616
},
17-
plugins: [
18-
"eslint-plugin-import",
19-
"eslint-plugin-jsdoc",
20-
"ban",
21-
"@typescript-eslint",
22-
"@typescript-eslint/tslint",
23-
],
17+
plugins: ["eslint-plugin-import", "eslint-plugin-jsdoc", "ban", "@typescript-eslint"],
2418
rules: {
2519
"ban/ban": [
2620
2,
@@ -80,6 +74,7 @@ module.exports = {
8074
},
8175
],
8276
"@typescript-eslint/consistent-type-imports": "error",
77+
"@typescript-eslint/consistent-type-exports": "error",
8378
"@typescript-eslint/naming-convention": [
8479
"error",
8580
{
@@ -309,27 +304,5 @@ module.exports = {
309304
"use-isnan": "error",
310305
"valid-typeof": "error",
311306
yoda: "error",
312-
"@typescript-eslint/tslint/config": [
313-
"error",
314-
{
315-
rules: {
316-
encoding: true,
317-
"import-spacing": true,
318-
"prefer-while": true,
319-
"return-undefined": true,
320-
whitespace: [
321-
true,
322-
"check-branch",
323-
"check-decl",
324-
"check-operator",
325-
"check-module",
326-
"check-separator",
327-
"check-type",
328-
"check-typecast",
329-
"check-preblock",
330-
],
331-
},
332-
},
333-
],
334307
},
335308
};

.github/workflows/checks.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939

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

4545
steps:
@@ -57,7 +57,7 @@ jobs:
5757

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

6363
steps:
@@ -75,7 +75,7 @@ jobs:
7575

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

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

9898
memory_linux:
9999
runs-on: ubuntu-latest
100100

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

106106
steps:

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ New integration tests are not required when a new code is added. Just make sure
229229
those tests pass before doing a pull request by running: `npm run test:integration`.
230230

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

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

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

245245
## Documentation
246246

0 commit comments

Comments
 (0)