How to use js-reporters - 2 common examples

To help you get started, we’ve selected a few js-reporters examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github qunitjs / qunit / src / cli / find-reporter.js View on Github external
function findReporter( reporterName ) {
	if ( !reporterName ) {
		return JSReporters.TapReporter;
	}

	// First, check if the reporter is one of the standard js-reporters ones

	const capitalizedName = utils.capitalize( reporterName );
	const jsReporterName = `${capitalizedName}Reporter`;

	if ( JSReporters[ jsReporterName ] ) {
		return JSReporters[ jsReporterName ];
	}

	// Second, check if the reporter is an npm package
	try {
		return require( reporterName );
	} catch ( e ) {
		if ( e.code !== "MODULE_NOT_FOUND" ) {
github qunitjs / qunit / test / cli / custom-reporter.js View on Github external
QUnit.test( "correctly finds js-reporters reporter by name", function( assert ) {
		const reporter = findReporter( "tap" );
		assert.strictEqual( reporter, JSReporters.TapReporter );
	} );

js-reporters

Common reporter interface for JavaScript testing frameworks.

MIT
Latest version published 3 years ago

Package Health Score

57 / 100
Full package analysis

Popular js-reporters functions

Similar packages