diff --git a/libraries/access-token-encryptor/test/mocha-multi-reporters.cjs b/libraries/access-token-encryptor/test/mocha-multi-reporters.cjs index 674ff0e1cd..00e3d1a7eb 100644 --- a/libraries/access-token-encryptor/test/mocha-multi-reporters.cjs +++ b/libraries/access-token-encryptor/test/mocha-multi-reporters.cjs @@ -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, diff --git a/libraries/logger/test/mocha-multi-reporters.cjs b/libraries/logger/test/mocha-multi-reporters.cjs index 674ff0e1cd..00e3d1a7eb 100644 --- a/libraries/logger/test/mocha-multi-reporters.cjs +++ b/libraries/logger/test/mocha-multi-reporters.cjs @@ -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, diff --git a/libraries/metrics/package.json b/libraries/metrics/package.json index a345463610..4c02200cfe 100644 --- a/libraries/metrics/package.json +++ b/libraries/metrics/package.json @@ -37,7 +37,7 @@ "lint": "eslint --cache --cache-location ../../.cache/eslint/ --ext .cjs,.js,.jsx,.mjs,.ts --max-warnings 0 .", "lint:fix": "eslint --cache --cache-location ../../.cache/eslint/ --fix --ext .cjs,.js,.jsx,.mjs,.ts .", "test:unit": "mocha --exit test/**/*.{js,cjs}", - "test:acceptance": "mocha --recursive --exit --grep=${MOCHA_GREP:-} test/acceptance", + "test:acceptance": "mocha --recursive --exit --grep=${TEST_NAME_PATTERN:-} test/acceptance", "test": "yarn run lint && yarn run types:check && yarn run test:unit", "test:ci": "yarn run test:unit", "types:check": "tsc --noEmit" diff --git a/libraries/metrics/test/mocha-multi-reporters.cjs b/libraries/metrics/test/mocha-multi-reporters.cjs index 674ff0e1cd..00e3d1a7eb 100644 --- a/libraries/metrics/test/mocha-multi-reporters.cjs +++ b/libraries/metrics/test/mocha-multi-reporters.cjs @@ -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, diff --git a/libraries/o-error/test/mocha-multi-reporters.cjs b/libraries/o-error/test/mocha-multi-reporters.cjs index 674ff0e1cd..00e3d1a7eb 100644 --- a/libraries/o-error/test/mocha-multi-reporters.cjs +++ b/libraries/o-error/test/mocha-multi-reporters.cjs @@ -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, diff --git a/libraries/object-persistor/test/mocha-multi-reporters.cjs b/libraries/object-persistor/test/mocha-multi-reporters.cjs index 674ff0e1cd..00e3d1a7eb 100644 --- a/libraries/object-persistor/test/mocha-multi-reporters.cjs +++ b/libraries/object-persistor/test/mocha-multi-reporters.cjs @@ -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, diff --git a/libraries/overleaf-editor-core/test/mocha-multi-reporters.cjs b/libraries/overleaf-editor-core/test/mocha-multi-reporters.cjs index 674ff0e1cd..00e3d1a7eb 100644 --- a/libraries/overleaf-editor-core/test/mocha-multi-reporters.cjs +++ b/libraries/overleaf-editor-core/test/mocha-multi-reporters.cjs @@ -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, diff --git a/libraries/promise-utils/test/mocha-multi-reporters.cjs b/libraries/promise-utils/test/mocha-multi-reporters.cjs index 674ff0e1cd..00e3d1a7eb 100644 --- a/libraries/promise-utils/test/mocha-multi-reporters.cjs +++ b/libraries/promise-utils/test/mocha-multi-reporters.cjs @@ -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, diff --git a/libraries/ranges-tracker/test/mocha-multi-reporters.cjs b/libraries/ranges-tracker/test/mocha-multi-reporters.cjs index 674ff0e1cd..00e3d1a7eb 100644 --- a/libraries/ranges-tracker/test/mocha-multi-reporters.cjs +++ b/libraries/ranges-tracker/test/mocha-multi-reporters.cjs @@ -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, diff --git a/libraries/redis-wrapper/test/mocha-multi-reporters.cjs b/libraries/redis-wrapper/test/mocha-multi-reporters.cjs index 674ff0e1cd..00e3d1a7eb 100644 --- a/libraries/redis-wrapper/test/mocha-multi-reporters.cjs +++ b/libraries/redis-wrapper/test/mocha-multi-reporters.cjs @@ -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, diff --git a/libraries/stream-utils/test/mocha-multi-reporters.cjs b/libraries/stream-utils/test/mocha-multi-reporters.cjs index 674ff0e1cd..00e3d1a7eb 100644 --- a/libraries/stream-utils/test/mocha-multi-reporters.cjs +++ b/libraries/stream-utils/test/mocha-multi-reporters.cjs @@ -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, diff --git a/services/chat/package.json b/services/chat/package.json index c654afcf87..a67a420d98 100644 --- a/services/chat/package.json +++ b/services/chat/package.json @@ -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", diff --git a/services/chat/test/mocha-multi-reporters.cjs b/services/chat/test/mocha-multi-reporters.cjs index 674ff0e1cd..00e3d1a7eb 100644 --- a/services/chat/test/mocha-multi-reporters.cjs +++ b/services/chat/test/mocha-multi-reporters.cjs @@ -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, diff --git a/services/clsi/package.json b/services/clsi/package.json index ca827f942e..ec8a837333 100644 --- a/services/clsi/package.json +++ b/services/clsi/package.json @@ -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", diff --git a/services/clsi/test/mocha-multi-reporters.cjs b/services/clsi/test/mocha-multi-reporters.cjs index 674ff0e1cd..00e3d1a7eb 100644 --- a/services/clsi/test/mocha-multi-reporters.cjs +++ b/services/clsi/test/mocha-multi-reporters.cjs @@ -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, diff --git a/services/clsi/vitest.config.unit.cjs b/services/clsi/vitest.config.unit.cjs index c9b162b45b..ee77ae9c3f 100644 --- a/services/clsi/vitest.config.unit.cjs +++ b/services/clsi/vitest.config.unit.cjs @@ -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, }, }) diff --git a/services/docstore/package.json b/services/docstore/package.json index 955b3c8718..31dcf1a7a7 100644 --- a/services/docstore/package.json +++ b/services/docstore/package.json @@ -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", diff --git a/services/docstore/test/mocha-multi-reporters.cjs b/services/docstore/test/mocha-multi-reporters.cjs index 674ff0e1cd..00e3d1a7eb 100644 --- a/services/docstore/test/mocha-multi-reporters.cjs +++ b/services/docstore/test/mocha-multi-reporters.cjs @@ -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, diff --git a/services/docstore/vitest.config.unit.cjs b/services/docstore/vitest.config.unit.cjs index 9876a60525..7c441445bc 100644 --- a/services/docstore/vitest.config.unit.cjs +++ b/services/docstore/vitest.config.unit.cjs @@ -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, }, }) diff --git a/services/document-updater/package.json b/services/document-updater/package.json index 126bbecb04..5b5a0f8cdf 100644 --- a/services/document-updater/package.json +++ b/services/document-updater/package.json @@ -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 .", diff --git a/services/document-updater/test/mocha-multi-reporters.cjs b/services/document-updater/test/mocha-multi-reporters.cjs index 674ff0e1cd..00e3d1a7eb 100644 --- a/services/document-updater/test/mocha-multi-reporters.cjs +++ b/services/document-updater/test/mocha-multi-reporters.cjs @@ -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, diff --git a/services/filestore/package.json b/services/filestore/package.json index d79fcbb1ad..c39c5b67c1 100644 --- a/services/filestore/package.json +++ b/services/filestore/package.json @@ -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", diff --git a/services/filestore/test/mocha-multi-reporters.cjs b/services/filestore/test/mocha-multi-reporters.cjs index 674ff0e1cd..00e3d1a7eb 100644 --- a/services/filestore/test/mocha-multi-reporters.cjs +++ b/services/filestore/test/mocha-multi-reporters.cjs @@ -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, diff --git a/services/filestore/vitest.config.unit.cjs b/services/filestore/vitest.config.unit.cjs index 9876a60525..7c441445bc 100644 --- a/services/filestore/vitest.config.unit.cjs +++ b/services/filestore/vitest.config.unit.cjs @@ -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, }, }) diff --git a/services/history-v1/package.json b/services/history-v1/package.json index 1b34977685..812959e9ee 100644 --- a/services/history-v1/package.json +++ b/services/history-v1/package.json @@ -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", diff --git a/services/history-v1/test/mocha-multi-reporters.cjs b/services/history-v1/test/mocha-multi-reporters.cjs index 674ff0e1cd..00e3d1a7eb 100644 --- a/services/history-v1/test/mocha-multi-reporters.cjs +++ b/services/history-v1/test/mocha-multi-reporters.cjs @@ -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, diff --git a/services/notifications/vitest.config.acceptance.cjs b/services/notifications/vitest.config.acceptance.cjs index 93942ba54e..23a1e2f6d5 100644 --- a/services/notifications/vitest.config.acceptance.cjs +++ b/services/notifications/vitest.config.acceptance.cjs @@ -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, }, }) diff --git a/services/notifications/vitest.config.unit.cjs b/services/notifications/vitest.config.unit.cjs index 0a6fecd2fa..66ae954019 100644 --- a/services/notifications/vitest.config.unit.cjs +++ b/services/notifications/vitest.config.unit.cjs @@ -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, }, }) diff --git a/services/project-history/package.json b/services/project-history/package.json index 14c318d5f5..f7c10fee71 100644 --- a/services/project-history/package.json +++ b/services/project-history/package.json @@ -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", diff --git a/services/project-history/test/mocha-multi-reporters.cjs b/services/project-history/test/mocha-multi-reporters.cjs index 674ff0e1cd..00e3d1a7eb 100644 --- a/services/project-history/test/mocha-multi-reporters.cjs +++ b/services/project-history/test/mocha-multi-reporters.cjs @@ -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, diff --git a/services/real-time/package.json b/services/real-time/package.json index d30bb64b9a..5abb7e995b 100644 --- a/services/real-time/package.json +++ b/services/real-time/package.json @@ -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", diff --git a/services/real-time/test/mocha-multi-reporters.cjs b/services/real-time/test/mocha-multi-reporters.cjs index 674ff0e1cd..00e3d1a7eb 100644 --- a/services/real-time/test/mocha-multi-reporters.cjs +++ b/services/real-time/test/mocha-multi-reporters.cjs @@ -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, diff --git a/services/real-time/vitest.config.unit.cjs b/services/real-time/vitest.config.unit.cjs index c9b162b45b..ee77ae9c3f 100644 --- a/services/real-time/vitest.config.unit.cjs +++ b/services/real-time/vitest.config.unit.cjs @@ -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, }, }) diff --git a/services/web/README.md b/services/web/README.md index deeb01fb72..e7eb0b3ae5 100644 --- a/services/web/README.md +++ b/services/web/README.md @@ -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 diff --git a/services/web/frontend/js/features/source-editor/lezer-latex/README.md b/services/web/frontend/js/features/source-editor/lezer-latex/README.md index dd9db637f2..ad4d1c15b4 100644 --- a/services/web/frontend/js/features/source-editor/lezer-latex/README.md +++ b/services/web/frontend/js/features/source-editor/lezer-latex/README.md @@ -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 diff --git a/services/web/package.json b/services/web/package.json index 40ff730a99..24bdccdf28 100644 --- a/services/web/package.json +++ b/services/web/package.json @@ -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", diff --git a/services/web/vitest.config.js b/services/web/vitest.config.js index cfbd66f5e0..74b872799a 100644 --- a/services/web/vitest.config.js +++ b/services/web/vitest.config.js @@ -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,