Skip to content

Commit

Permalink
test: use mocha CLI directly for node tests
Browse files Browse the repository at this point in the history
I've opted to leave the mocha grunt task alons for now since it's used
for test:webserver and has the configuration to emit JUnit XML in case
we want to set up test-observability in future.
  • Loading branch information
owenpearson committed Feb 29, 2024
1 parent e8180c9 commit 698cf97
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
3 changes: 3 additions & 0 deletions .mocharc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
require: ['test/support/modules_helper.js', 'test/support/test_helper.js']
}
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,17 @@ Run the Mocha test suite

npm run test:node

Or run just one test file
You can pass any Mocha CLI arguments and flags to the test:node script after the `--` separator, for example running one test file:

npm run test:node -- --file=test/realtime/auth.test.js
npm run test:node -- test/realtime/auth.test.js

Or run just one test

npm run test:node -- --file=test/rest/status.test.js --grep=test_name_here
npm run test:node -- --grep=test_name_here

Or run test skipping the build

npm run test:node:skip-build -- --file=test/rest/status.test.js --grep=test_name_here
npm run test:node:skip-build -- test/rest/status.test.js --grep=test_name_here

### Debugging the mocha tests locally with a debugger

Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,9 @@
"scripts": {
"start:react": "npx vite serve",
"grunt": "grunt",
"test": "grunt test",
"test:node": "grunt test:node",
"test:node:skip-build": "grunt mocha",
"test": "npm run test:node",
"test:node": "npm run build:node && mocha",
"test:node:skip-build": "mocha",
"test:webserver": "grunt test:webserver",
"test:playwright": "node test/support/runPlaywrightTests.js",
"test:react": "vitest run",
Expand Down

0 comments on commit 698cf97

Please sign in to comment.