Skip to content

Commit 2b92db5

Browse files
committed
Add mocha multi-reporters and junit reporter support
Update test scripts to use mocha-multi-reporters with JUnit output. Add junit-results/ to .gitignore and cleanup script.
1 parent 539780c commit 2b92db5

16 files changed

+163
-7
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ node_modules/
88
dump.rdb
99
documentation/
1010
tsconfig.tsbuildinfo
11+
junit-results/

package-lock.json

Lines changed: 98 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
],
1414
"scripts": {
1515
"test-single": "TS_NODE_PROJECT='./packages/test-utils/tsconfig.json' mocha --require ts-node/register/transpile-only ",
16-
"test": "npm run test -ws --if-present",
16+
"cleanup": "rm -rf junit-results",
17+
"test": "npm run cleanup && npm run test -ws --if-present",
1718
"build": "tsc --build",
1819
"documentation": "typedoc --out ./documentation",
1920
"gh-pages": "gh-pages -d ./documentation -e ./documentation -u 'documentation-bot <documentation@bot>'",
@@ -26,6 +27,8 @@
2627
"@types/node": "^20.11.16",
2728
"gh-pages": "^6.1.1",
2829
"mocha": "^10.2.0",
30+
"mocha-junit-reporter": "^2.2.1",
31+
"mocha-multi-reporters": "^1.5.1",
2932
"nyc": "^15.1.0",
3033
"release-it": "^19.0.2",
3134
"ts-node": "^10.9.2",
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"reporterEnabled": "spec, mocha-junit-reporter",
3+
"mochaJunitReporterReporterOptions": {
4+
"mochaFile": "../../junit-results/bloom.xml",
5+
"toConsole": false,
6+
"testsuitesTitle": "@redis/bloom"
7+
}
8+
}

packages/bloom/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"!dist/tsconfig.tsbuildinfo"
1010
],
1111
"scripts": {
12-
"test": "nyc -r text-summary -r lcov mocha -r tsx './lib/**/*.spec.ts'",
12+
"test": "nyc -r text-summary -r lcov mocha -r tsx --reporter mocha-multi-reporters --reporter-options configFile=mocha-multi-reporter-config.json --exit './lib/**/*.spec.ts'",
1313
"release": "release-it"
1414
},
1515
"peerDependencies": {
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"reporterEnabled": "spec, mocha-junit-reporter",
3+
"mochaJunitReporterReporterOptions": {
4+
"mochaFile": "../../junit-results/client.xml",
5+
"toConsole": false,
6+
"testsuitesTitle": "@redis/client"
7+
}
8+
}

packages/client/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"!dist/tsconfig.tsbuildinfo"
1010
],
1111
"scripts": {
12-
"test": "nyc -r text-summary -r lcov mocha -r tsx './lib/**/*.spec.ts'",
12+
"test": "nyc -r text-summary -r lcov mocha -r tsx --reporter mocha-multi-reporters --reporter-options configFile=mocha-multi-reporter-config.json --exit './lib/**/*.spec.ts'",
1313
"release": "release-it"
1414
},
1515
"dependencies": {
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"reporterEnabled": "spec, mocha-junit-reporter",
3+
"mochaJunitReporterReporterOptions": {
4+
"mochaFile": "../../junit-results/entraid.xml",
5+
"toConsole": false,
6+
"testsuitesTitle": "@redis/entraid"
7+
}
8+
}

packages/entraid/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"start:auth-pkce": "tsx --tsconfig tsconfig.samples.json ./samples/auth-code-pkce/index.ts",
1515
"start:interactive-browser": "tsx --tsconfig tsconfig.samples.json ./samples/interactive-browser/index.ts",
1616
"test-integration": "mocha -r tsx --tsconfig tsconfig.integration-tests.json './integration-tests/**/*.spec.ts'",
17-
"test": "nyc -r text-summary -r lcov mocha -r tsx './lib/**/*.spec.ts'",
17+
"test": "nyc -r text-summary -r lcov mocha -r tsx --reporter mocha-multi-reporters --reporter-options configFile=mocha-multi-reporter-config.json --exit './lib/**/*.spec.ts'",
1818
"release": "release-it"
1919
},
2020
"dependencies": {
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"reporterEnabled": "spec, mocha-junit-reporter",
3+
"mochaJunitReporterReporterOptions": {
4+
"mochaFile": "../../junit-results/json.xml",
5+
"toConsole": false,
6+
"testsuitesTitle": "@redis/json"
7+
}
8+
}

0 commit comments

Comments
 (0)