Replace MOCHA_GREP with TEST_NAME_PATTERN (#34404)

GitOrigin-RevId: b1b2d1be3d0725f930d83ef035836482ffb72dcd
This commit is contained in:
Anna Claire Fields
2026-09-17 11:45:29 +00:00
committed by Copybot
parent daf4a0e412
commit a63fd554c3
37 changed files with 47 additions and 40 deletions
+6 -6
View File
@@ -46,7 +46,7 @@ make test_unit
During development it is often useful to only run a subset of tests, which can be configured with arguments to the mocha CLI:
```
make test_unit MOCHA_GREP='AuthorizationManager'
make test_unit TEST_NAME_PATTERN='AuthorizationManager'
```
To run only the unit tests for a single module do:
@@ -55,10 +55,10 @@ To run only the unit tests for a single module do:
make test_unit_module MODULE=saas-authentication
```
Module tests can also use a MOCHA_GREP argument:
Module tests can also use a TEST_NAME_PATTERN argument:
```
make test_unit_module MODULE=saas-authentication MOCHA_GREP=SSO
make test_unit_module MODULE=saas-authentication TEST_NAME_PATTERN=SSO
```
### Acceptance Tests
@@ -84,7 +84,7 @@ make test_acceptance_app_stop_service
During development it is often useful to only run a subset of tests, which can be configured with arguments to the mocha CLI:
```
make test_acceptance_run MOCHA_GREP='AuthorizationManager'
make test_acceptance_run TEST_NAME_PATTERN='AuthorizationManager'
```
To run only the acceptance tests for a single module do:
@@ -93,10 +93,10 @@ To run only the acceptance tests for a single module do:
make test_acceptance_module MODULE=saas-authentication
```
Module tests can also use a MOCHA_GREP argument:
Module tests can also use a TEST_NAME_PATTERN argument:
```
make test_acceptance_module MODULE=saas-authentication MOCHA_GREP=SSO
make test_acceptance_module MODULE=saas-authentication TEST_NAME_PATTERN=SSO
```
## Routes
@@ -54,7 +54,7 @@ Unit tests for the parser live in `web/test/unit/src/LezerLatex`. There are thre
These tests run as part of `test_frontend`. You can run these tests alone by invoking:
```sh
make test_unit MOCHA_GREP='lezer-latex'
make test_unit TEST_NAME_PATTERN='lezer-latex'
```
## Trying the parser
+2 -2
View File
@@ -14,7 +14,7 @@
"test:acceptance:run_dir": "bin/test_acceptance_run_dir",
"test:acceptance:app": "yarn run test:acceptance:run_dir -- test/acceptance/src",
"test:acceptance:app:debug": "yarn run test:acceptance:debug:run_dir -- test/acceptance/src",
"test:acceptance:debug:run_dir": "mocha --recursive --timeout 25000 --grep=${MOCHA_GREP:-} --require test/acceptance/bootstrap.js --inspect=0.0.0.0:19999 --inspect-brk",
"test:acceptance:debug:run_dir": "mocha --recursive --timeout 25000 --grep=${TEST_NAME_PATTERN:-} --require test/acceptance/bootstrap.js --inspect=0.0.0.0:19999 --inspect-brk",
"test:unit:run_dir": "bin/test_unit_run_dir",
"test:unit:all": "yarn run test:unit:run_dir test/unit/src modules/*/test/unit/src",
"test:unit:all:silent": "yarn run test:unit:all --reporter dot",
@@ -23,7 +23,7 @@
"test:unit:parallel": "vitest run --project=Parallel",
"test:unit:sequential": "vitest run --project=Sequential",
"test:unit:watch": "vitest",
"test:frontend": "NODE_ENV=test TZ=GMT mocha --recursive --timeout 5000 --exit --extension js,jsx,mjs,ts,tsx --grep=${MOCHA_GREP:-} --require test/frontend/bootstrap.js --ignore '**/*.spec.{js,jsx,ts,tsx}' --ignore '**/helpers/**/*.{js,jsx,ts,tsx}' test/frontend modules/*/test/frontend",
"test:frontend": "NODE_ENV=test TZ=GMT mocha --recursive --timeout 5000 --exit --extension js,jsx,mjs,ts,tsx --grep=${TEST_NAME_PATTERN:-} --require test/frontend/bootstrap.js --ignore '**/*.spec.{js,jsx,ts,tsx}' --ignore '**/helpers/**/*.{js,jsx,ts,tsx}' test/frontend modules/*/test/frontend",
"test:frontend:coverage": "c8 --all --include 'frontend/js' --include 'modules/*/frontend/js' --exclude 'frontend/js/vendor' --reporter=lcov --reporter=text-summary yarn run test:frontend",
"test:writefull": "vitest --run --config modules/writefull/frontend/js/integration/vitest.config.ts",
"start": "node app.mjs",
+1
View File
@@ -25,6 +25,7 @@ module.exports = defineConfig({
globals: false,
isolate: false,
passWithNoTests: true, // in case there are no tests from one project or other in a module
testNamePattern: process.env.TEST_NAME_PATTERN || undefined,
projects: [
{
extends: true,