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
+2 -2
View File
@@ -6,8 +6,8 @@
"type": "module",
"scripts": {
"start": "node app.js",
"test:acceptance": "yarn run test:acceptance:_run -- --grep=$MOCHA_GREP",
"test:unit": "yarn run test:unit:_run -- --grep=$MOCHA_GREP",
"test:acceptance": "yarn run test:acceptance:_run -- --grep=$TEST_NAME_PATTERN",
"test:unit": "yarn run test:unit:_run -- --grep=$TEST_NAME_PATTERN",
"nodemon": "node --watch app.js",
"test:acceptance:_run": "mocha --recursive --timeout 15000 --exit --retries=$RETRIES $@ test/acceptance/js",
"test:unit:_run": "mocha --recursive --exit $@ test/unit/js",
+1 -1
View File
@@ -1,7 +1,7 @@
module.exports = {
reporterEnabled: 'spec, mocha-junit-reporter',
mochaJunitReporterReporterOptions: {
mochaFile: `reports/junit-mocha-${process.env.MOCHA_GREP}.xml`,
mochaFile: `reports/junit-mocha-${process.env.TEST_NAME_PATTERN}.xml`,
includePending: true,
jenkinsMode: true,
output: true,
+1 -1
View File
@@ -7,7 +7,7 @@
"scripts": {
"start": "node app.js",
"test:acceptance:_run": "mocha --recursive --timeout 15000 --exit --retries=$RETRIES $@ test/acceptance/js",
"test:acceptance": "yarn run test:acceptance:_run -- --grep=$MOCHA_GREP",
"test:acceptance": "yarn run test:acceptance:_run -- --grep=$TEST_NAME_PATTERN",
"test:unit:_run": "vitest --config ./vitest.config.unit.cjs",
"test:unit": "yarn run test:unit:_run",
"nodemon": "node --watch app.js",
+1 -1
View File
@@ -1,7 +1,7 @@
module.exports = {
reporterEnabled: 'spec, mocha-junit-reporter',
mochaJunitReporterReporterOptions: {
mochaFile: `reports/junit-mocha-${process.env.MOCHA_GREP}.xml`,
mochaFile: `reports/junit-mocha-${process.env.TEST_NAME_PATTERN}.xml`,
includePending: true,
jenkinsMode: true,
output: true,
+1
View File
@@ -20,6 +20,7 @@ module.exports = defineConfig({
include: ['test/unit/js/**/*.test.{js,ts}'],
setupFiles: ['./test/unit/setup.js'],
isolate: false,
testNamePattern: process.env.TEST_NAME_PATTERN || undefined,
...reporterOptions,
},
})
+1 -1
View File
@@ -7,7 +7,7 @@
"scripts": {
"start": "node app.js",
"test:acceptance:_run": "mocha --recursive --timeout 15000 --exit --retries=$RETRIES $@ test/acceptance/js",
"test:acceptance": "yarn run test:acceptance:_run -- --grep=$MOCHA_GREP",
"test:acceptance": "yarn run test:acceptance:_run -- --grep=$TEST_NAME_PATTERN",
"test:unit:_run": "vitest --config ./vitest.config.unit.cjs",
"test:unit": "yarn run test:unit:_run",
"nodemon": "node --watch app.js",
@@ -1,7 +1,7 @@
module.exports = {
reporterEnabled: 'spec, mocha-junit-reporter',
mochaJunitReporterReporterOptions: {
mochaFile: `reports/junit-mocha-${process.env.MOCHA_GREP}.xml`,
mochaFile: `reports/junit-mocha-${process.env.TEST_NAME_PATTERN}.xml`,
includePending: true,
jenkinsMode: true,
output: true,
+1
View File
@@ -20,6 +20,7 @@ module.exports = defineConfig({
include: ['test/unit/js/*.test.{js,ts}'],
setupFiles: ['./test/unit/setup.js'],
isolate: true,
testNamePattern: process.env.TEST_NAME_PATTERN || undefined,
...reporterOptions,
},
})
+2 -2
View File
@@ -6,9 +6,9 @@
"scripts": {
"start": "node app.js",
"test:acceptance:_run": "mocha --recursive --timeout 15000 --exit --retries=$RETRIES $@ test/acceptance/js",
"test:acceptance": "yarn run test:acceptance:_run -- --grep=$MOCHA_GREP",
"test:acceptance": "yarn run test:acceptance:_run -- --grep=$TEST_NAME_PATTERN",
"test:unit:_run": "mocha --recursive --exit $@ test/unit/js",
"test:unit": "yarn run test:unit:_run -- --grep=$MOCHA_GREP",
"test:unit": "yarn run test:unit:_run -- --grep=$TEST_NAME_PATTERN",
"nodemon": "node --watch app.js",
"benchmark:apply": "node benchmarks/apply",
"lint": "eslint --cache --cache-location ../../.cache/eslint/ --max-warnings 0 .",
@@ -1,7 +1,7 @@
module.exports = {
reporterEnabled: 'spec, mocha-junit-reporter',
mochaJunitReporterReporterOptions: {
mochaFile: `reports/junit-mocha-${process.env.MOCHA_GREP}.xml`,
mochaFile: `reports/junit-mocha-${process.env.TEST_NAME_PATTERN}.xml`,
includePending: true,
jenkinsMode: true,
output: true,
+1 -1
View File
@@ -6,7 +6,7 @@
"type": "module",
"scripts": {
"test:acceptance:run": "mocha --recursive --timeout 15000 $@ test/acceptance/js",
"test:acceptance": "yarn run test:acceptance:_run -- --grep=$MOCHA_GREP",
"test:acceptance": "yarn run test:acceptance:_run -- --grep=$TEST_NAME_PATTERN",
"test:unit:run": "mocha --recursive $@ test/unit/js",
"test:unit": "yarn run test:unit:_run",
"start": "node app.js",
@@ -1,7 +1,7 @@
module.exports = {
reporterEnabled: 'spec, mocha-junit-reporter',
mochaJunitReporterReporterOptions: {
mochaFile: `reports/junit-mocha-${process.env.MOCHA_GREP}.xml`,
mochaFile: `reports/junit-mocha-${process.env.TEST_NAME_PATTERN}.xml`,
includePending: true,
jenkinsMode: true,
output: true,
@@ -20,6 +20,7 @@ module.exports = defineConfig({
include: ['test/unit/js/*.test.{js,ts}'],
setupFiles: ['./test/unit/setup.js'],
isolate: true,
testNamePattern: process.env.TEST_NAME_PATTERN || undefined,
...reporterOptions,
},
})
+2 -2
View File
@@ -70,8 +70,8 @@
"start": "node app.js",
"lint": "eslint --cache --cache-location ../../.cache/eslint/ --max-warnings 0 .",
"lint:fix": "eslint --cache --cache-location ../../.cache/eslint/ --fix .",
"test:unit": "yarn run test:unit:_run -- --grep=$MOCHA_GREP",
"test:acceptance": "yarn run test:acceptance:_run -- --grep=$MOCHA_GREP",
"test:unit": "yarn run test:unit:_run -- --grep=$TEST_NAME_PATTERN",
"test:acceptance": "yarn run test:acceptance:_run -- --grep=$TEST_NAME_PATTERN",
"test:unit:_run": "mocha --recursive --exit $@ test/unit/js",
"test:acceptance:_run": "mocha --recursive --timeout 15000 --exit --retries=$RETRIES $@ test/acceptance/js",
"nodemon": "node --watch app.js",
@@ -1,7 +1,7 @@
module.exports = {
reporterEnabled: 'spec, mocha-junit-reporter',
mochaJunitReporterReporterOptions: {
mochaFile: `reports/junit-mocha-${process.env.MOCHA_GREP}.xml`,
mochaFile: `reports/junit-mocha-${process.env.TEST_NAME_PATTERN}.xml`,
includePending: true,
jenkinsMode: true,
output: true,
@@ -19,6 +19,7 @@ module.exports = defineConfig({
test: {
include: ['test/acceptance/js/**/*.test.{js,ts}'],
isolate: false,
testNamePattern: process.env.TEST_NAME_PATTERN || undefined,
...reporterOptions,
},
})
@@ -20,6 +20,7 @@ module.exports = defineConfig({
include: ['test/unit/js/**/*.test.{js,ts}'],
setupFiles: ['./test/setup.js'],
isolate: false,
testNamePattern: process.env.TEST_NAME_PATTERN || undefined,
...reporterOptions,
},
})
+2 -2
View File
@@ -5,8 +5,8 @@
"main": "app.js",
"type": "module",
"scripts": {
"test:acceptance": "yarn run test:acceptance:_run -- --grep=$MOCHA_GREP",
"test:unit": "yarn run test:unit:_run -- --grep=$MOCHA_GREP",
"test:acceptance": "yarn run test:acceptance:_run -- --grep=$TEST_NAME_PATTERN",
"test:unit": "yarn run test:unit:_run -- --grep=$TEST_NAME_PATTERN",
"start": "node app.js",
"nodemon": "node --watch app.js",
"test:acceptance:_run": "mocha --loader=esmock --recursive --timeout 15000 --exit --retries=$RETRIES $@ test/acceptance/js",
@@ -1,7 +1,7 @@
module.exports = {
reporterEnabled: 'spec, mocha-junit-reporter',
mochaJunitReporterReporterOptions: {
mochaFile: `reports/junit-mocha-${process.env.MOCHA_GREP}.xml`,
mochaFile: `reports/junit-mocha-${process.env.TEST_NAME_PATTERN}.xml`,
includePending: true,
jenkinsMode: true,
output: true,
+1 -1
View File
@@ -7,7 +7,7 @@
"scripts": {
"start": "node app.js",
"test:acceptance:_run": "mocha --recursive --timeout 15000 --exit --retries=$RETRIES $@ test/acceptance/js",
"test:acceptance": "yarn run test:acceptance:_run -- --grep=$MOCHA_GREP",
"test:acceptance": "yarn run test:acceptance:_run -- --grep=$TEST_NAME_PATTERN",
"test:unit:_run": "vitest --config ./vitest.config.unit.cjs",
"test:unit": "yarn run test:unit:_run",
"nodemon": "node --watch app.js",
@@ -1,7 +1,7 @@
module.exports = {
reporterEnabled: 'spec, mocha-junit-reporter',
mochaJunitReporterReporterOptions: {
mochaFile: `reports/junit-mocha-${process.env.MOCHA_GREP}.xml`,
mochaFile: `reports/junit-mocha-${process.env.TEST_NAME_PATTERN}.xml`,
includePending: true,
jenkinsMode: true,
output: true,
@@ -20,6 +20,7 @@ module.exports = defineConfig({
include: ['test/unit/js/**/*.test.{js,ts}'],
setupFiles: ['./test/unit/setup.js'],
isolate: false,
testNamePattern: process.env.TEST_NAME_PATTERN || undefined,
...reporterOptions,
},
})
+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,