Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

karma-json-reporter

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

karma-json-reporter - npm Package Compare versions

Comparing version 1.0.1 to 1.1.0

24

index.js
/* jshint node: true */
'use strict';
var path = require('path');
var fs = require('fs');
//
var JSONReporter = function (baseReporterDecorator) {
var JSONReporter = function (baseReporterDecorator, config, helper) {
baseReporterDecorator(this);

@@ -15,2 +18,6 @@

var reporterConfig = config.jsonReporter || {};
var stdout = reporterConfig.stdout || true;
var outputFile = (reporterConfig.outputFile) ? helper.normalizeWinPath(path.resolve(config.basePath, reporterConfig.outputFile )) : null;
this.onSpecComplete = function(browser, result) {

@@ -25,3 +32,14 @@ history.result[browser.id] = history.result[browser.id] || [];

history.summary = result;
process.stdout.write(JSON.stringify(history));
if(stdout) process.stdout.write(JSON.stringify(history));
if(outputFile) {
helper.mkdirIfNotExists(path.dirname(outputFile), function() {
fs.writeFile(outputFile, JSON.stringify(history), function(err) {
if (err) {
log.warn('Cannot write JSON\n\t' + err.message);
} else {
log.debug('JSON written to "%s".', outputFile);
}
});
});
}
history.result = {};

@@ -31,3 +49,3 @@ };

JSONReporter.$inject = ['baseReporterDecorator'];
JSONReporter.$inject = ['baseReporterDecorator','config','helper'];

@@ -34,0 +52,0 @@ // PUBLISH DI MODULE

2

package.json
{
"name": "karma-json-reporter",
"version": "1.0.1",
"version": "1.1.0",
"description": "JSON reporter for Karma",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -14,3 +14,3 @@ # karma-json-reporter [![NPM version](https://badge.fury.io/js/karma-json-reporter.png)](http://badge.fury.io/js/karma-json-reporter)

"karma": "~0.10",
"karma-json-reporter": "~1.0"
"karma-json-reporter": "~1.1"
}

@@ -36,2 +36,6 @@ }

reporters: ['json'],
jsonReporter: {
stdout: true,
outputFile: 'results.json' // defaults to none
}

@@ -38,0 +42,0 @@ // ...

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc