
Product
Introducing Tier 1 Reachability: Precision CVE Triage for Enterprise Teams
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.
apb-mocha-reporter
Advanced tools
A zero-dependency tool that displays your unit test results in a nifty HTML page.
Note: This package requires the Node fs module. It does not work in the browser.
Obviously, you need an existing mocha test suite
npm install apb-mocha-reporter --save-dev
mocha ./**.test.js --reporter apb-mocha-reporter
This reporter replaces the default Mocha console output with a more minimal console output.
The html dashboard is generated each time you run Mocha and is written to:
/yourProject/apb-mocha-reporter-report/apb-mocha-reporter.html
Just open up the html file in a browser, and it will auto-refresh every 60 seconds.
Pass the silent
reporter option to prevent the runner from printing to the console.
mocha ./**.test.js --reporter apb-mocha-reporter --reporter-options silent"
Pass the savejson
reporter option to save a detailed report as JSON.
EG:
mocha ./**.test.js --reporter apb-mocha-reporter --reporter-options savejson"
An optional filename may be passed. Otherwise, the output will be in:
yourProject/apb-mocha-reporter-report/apb-mocha-reporter-YYYYMMDD-HHMMSS.json
You may want to pass a file name to prevent logs from building up.
EG:
mocha ./**.test.js --reporter apb-mocha-reporter --reporter-options savejson=filename.json"
Pass the outputdir
reporter option with a value to change the output directory.
mocha ./**.test.js --reporter apb-mocha-reporter --reporter-options outputdir='customOutputDir'
To pass multiple options, for example, to be both silent and to save json, reporter-options should be in a comma separated list without spaces.
EG:
mocha ./**.test.js --reporter apb-mocha-reporter --reporter-options silent,savejson=filename.json"
If you want to fiddle around with the template, you will find apbmochareporter_TEMPLATE.html in the src directory of this package. The output html dashboard is generated using this template.
I didn't want to bloat the package by adding unnecessary templating dependencies, so it currently uses a potentially fragile (but lightweight!) regex based solution that replaces the strings surrounded by double curly braces (eg. {{string}}
).
PRs welcome.
Have a look at the github issue tracker for suggested updates.
FAQs
A simple dashboard to report mocha test runs.
We found that apb-mocha-reporter demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.
Research
/Security News
Ongoing npm supply chain attack spreads to DuckDB: multiple packages compromised with the same wallet-drainer malware.
Security News
The MCP Steering Committee has launched the official MCP Registry in preview, a central hub for discovering and publishing MCP servers.