New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

wdio-json-output-reporter

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

wdio-json-output-reporter - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

LICENSE

2

package.json
{
"name": "wdio-json-output-reporter",
"version": "1.0.0",
"version": "1.1.0",
"description": "wdio json output file reporter",

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

@@ -6,5 +6,5 @@ const EventEmitter = require('events').EventEmitter;

const inherits = require('util').inherits;
const uuidV4 = require('uuid').v4;
function Reporter(baseReporter, config, options) {
const suitesFlatView = [];
const suites = [];

@@ -22,3 +22,2 @@ const pending = [];

let hierarchyMode = false;
let currentSuite = null;

@@ -39,19 +38,33 @@ if (options) {

this.on('suite:start', (suite) => {
if (suite.title) {
const id = uuidV4();
suite.id = id;
const newSuite = {
parentId: null,
const addSuite = (id, title) => {
let suite = suitesFlatView.find((s) => s.id === id);
if (!suite) {
suite = {
id,
title: suite.title,
title,
tests: [],
};
suitesFlatView.push(suite);
}
if (hierarchyMode) {
suite.suites = [];
}
return suite;
};
this.on('suite:start', (suite) => {
if (suite.title) {
const newSuite = addSuite(suite.uid, suite.title);
if (hierarchyMode) {
newSuite.suites = [];
if (currentSuite) {
newSuite.parentId = currentSuite.id;
currentSuite.suites.push(newSuite);
// wdio reports spec file as own suite
if (suite.title === suite.parent) {
newSuite.specHash = suite.specHash;
suites.push(newSuite);
} else {
suites.push(newSuite);
// bug in wdio reporter doesnt actually list
// parentUid as parent describe block
// instead use the specHash for parents
const parentSuite = suitesFlatView.find(
(s) => s.specHash === suite.specHash);
parentSuite.suites.push(newSuite);
}

@@ -61,15 +74,9 @@ } else {

}
currentSuite = newSuite;
}
});
this.on('suite:end', (suite) => {
if (hierarchyMode) {
currentSuite = suites.find((s) => s.id === suite.parentId);
}
});
this.on('test:pass', (test) => {
passes.push(test);
currentSuite.tests.push(passTest(test));
const suite = suitesFlatView.find((s) => s.id === test.parentUid);
suite.tests.push(passTest(test));
});

@@ -79,3 +86,4 @@

failures.push(test);
currentSuite.tests.push(failTest(test));
const suite = suitesFlatView.find((s) => s.id === test.parentUid);
suite.tests.push(failTest(test));
});

@@ -85,3 +93,4 @@

pending.push(test);
currentSuite.tests.push(formatTest(test));
const suite = suitesFlatView.find((s) => s.id === test.parentUid);
suite.tests.push(formatTest(test));
});

@@ -110,3 +119,2 @@

delete suite.id;
delete suite.parentId;
if (suite.suites && suite.suites.length > 0) {

@@ -113,0 +121,0 @@ suite.suites.map(removeIds);

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