Skip to content

Commit 786de36

Browse files
authored
Replace Jest with Vitest (mozilla#3884)
Skip some EntitiesList tests, to be fixed after React upgrade
1 parent 36a683a commit 786de36

20 files changed

Lines changed: 3688 additions & 7170 deletions

.github/workflows/frontend.yml

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -50,26 +50,7 @@ jobs:
5050
license-checker-rseidelsohn --json | jq -r 'to_entries[] | "\(.key): \(.value.licenses)"'
5151
license-checker-rseidelsohn --summary --failOn 'GPL'
5252
53-
jest:
54-
runs-on: ubuntu-latest
55-
steps:
56-
- uses: actions/checkout@v5
57-
- uses: actions/setup-node@v5
58-
with: { node-version: '22' }
59-
- name: Install globals
60-
run: npm install --global npm@8
61-
- name: Install dependencies
62-
run: npm ci
63-
- name: Test
64-
run: npm test --coverage
65-
working-directory: translate
66-
- uses: codecov/codecov-action@v4
67-
with:
68-
flags: frontend
69-
env:
70-
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
71-
72-
vitest:
53+
test:
7354
runs-on: ubuntu-latest
7455
steps:
7556
- uses: actions/checkout@v5
@@ -78,5 +59,10 @@ jobs:
7859
- name: Install dependencies
7960
run: npm ci
8061
- name: vitest
81-
run: npx vitest run --coverage
82-
working-directory: translate
62+
run: npm test -- --coverage
63+
working-directory: translate
64+
- uses: codecov/codecov-action@v4
65+
with:
66+
flags: frontend
67+
env:
68+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

CONTRIBUTING.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ To run only the ``translate`` tests:
335335

336336
.. code-block:: shell
337337
338-
$ make jest
338+
$ make test-translate
339339
340340
341341
To run only the Python tests:

Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ SITE_URL ?= http://localhost:8000
99
USER_ID?=1000
1010
GROUP_ID?=1000
1111

12-
.PHONY: build build-translate build-server server-env setup run clean shell ci test test-translate test-server jest pytest format lint types eslint prettier check-prettier ruff check-ruff dropdb dumpdb loaddb sync-projects requirements
12+
.PHONY: build build-translate build-server server-env setup run clean shell ci test test-translate test-server vitest pytest format lint types eslint prettier check-prettier ruff check-ruff dropdb dumpdb loaddb sync-projects requirements
1313

1414
help:
1515
@echo "Welcome to Pontoon!\n"
@@ -25,7 +25,7 @@ help:
2525
@echo " shell-root Opens a Bash shell as root in the server docker container"
2626
@echo " ci Test and lint all code"
2727
@echo " test Runs all test suites"
28-
@echo " test-translate Runs the translate frontend test suite (Jest)"
28+
@echo " test-translate Runs the translate frontend test suite (Vitest)"
2929
@echo " test-server Runs the server test suite (Pytest)"
3030
@echo " format Runs all formatters"
3131
@echo " lint Runs all linters"
@@ -102,8 +102,8 @@ ci: test lint
102102

103103
test: test-server test-translate
104104

105-
test-translate: jest
106-
jest:
105+
test-translate: vitest
106+
vitest:
107107
npm test -w translate
108108

109109
test-server: pytest

eslint.config.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import react from 'eslint-plugin-react';
22
import globals from 'globals';
33
import eslint from '@eslint/js';
4+
import vitest from '@vitest/eslint-plugin';
45

56
export default [
67
{
@@ -36,15 +37,14 @@ export default [
3637
languageOptions: {
3738
globals: {
3839
...globals.browser,
39-
...globals.jest,
40+
...vitest.environments.env.globals,
4041
gettext: 'readonly',
4142
ngettext: 'readonly',
4243
interpolate: 'readonly',
4344
l: 'readonly',
4445
expect: 'readonly',
4546
test: 'readonly',
4647
browser: 'readonly',
47-
jest: 'readonly',
4848
Promise: 'readonly',
4949
Set: 'readonly',
5050
URLSearchParameters: 'readonly',

0 commit comments

Comments
 (0)