![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
mocha-reporter-multiplexer
Advanced tools
Mocha reporter that gives you more useful control over output of other Mocha reporters
A shim to make Mocha's reporter api suck less. It allows you to bind multiple reporters and specify streams for them to output to.
It proxies the reporter events and temporarily replaces stdout (but not stderr) on the global process object before calling each reporter's event handler, putting things back when the handler returns.
var Multiplexer = require('mocha-reporter-multiplexer')({
'require-string': stream
});
var mocha = new Mocha({
reporter: Multiplexer
});
// .. etc
mocha.run();
require-string
is a string to be passed to require(), so you could use, for example, mocha/lib/reporters/dot
or mocha-unfunk-reporter
. stream
is a writable stream.
If you're using Mocha programmatically to run multiple sets of tests (multiple instances of Mocha), you might want to be able to label them. You can configure this module with a title for them, which is then emitted on the reporter instances as a 'test group' event, like so:
var Multiplexer = require('mocha-reporter-multiplexer')({ './lib/custom-reporter': process.stdout }, 'Title');
var mocha = new Mocha({ reporter: Multiplexer });
...
reporter.on('test group', function (title) { console.log('-> %s', title); });
Say you want to output an XML report of your test results. If you just run mocha and pipe it to a file, any stray console.log lines or error reports (that shouldn't have used console.log but do) will make your XML invalid. By cleanly segregating outputs, this shim allows you to safely output a separate XML file for use in Jenkins or whatever. It also lets you print one report to the screen and a different report type to a file, or even create multiple report files in different formats.
This module incorrigably messes with globals and "private" properties of classes, and relies on Node implementation specifics. There are no guarantees this will ever work, now or in the future.
In reality, as long as EventEmitter.prototype.emit continues to emit synchronously, and Node's Console class doesn't change the name of its captured stdout reference, things should be fine.
FAQs
Mocha reporter that gives you more useful control over output of other Mocha reporters
The npm package mocha-reporter-multiplexer receives a total of 4 weekly downloads. As such, mocha-reporter-multiplexer popularity was classified as not popular.
We found that mocha-reporter-multiplexer 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.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.