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

wdio-spec-reporter

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

wdio-spec-reporter - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

71

build/reporter.js

@@ -13,2 +13,6 @@ 'use strict';

var _chalk = require('chalk');
var _chalk2 = _interopRequireDefault(_chalk);
var _humanizeDuration = require('humanize-duration');

@@ -48,2 +52,3 @@

_this.chalk = _chalk2.default;
_this.baseReporter = baseReporter;

@@ -135,3 +140,3 @@ _this.config = config;

case 'pending':
symbol = '-';
symbol = '!!';
break;

@@ -157,7 +162,7 @@ case 'fail':

case 'pending':
color = 'pending';
color = 'cyan';
break;
case 'fail':
case 'failing':
color = 'fail';
color = 'red';
break;

@@ -183,9 +188,9 @@ }

var program = (caps.app || '').replace('sauce-storage:', '') || caps.browserName;
var executing = program ? 'executing ' + program : '';
var executing = program ? `executing ${program}` : '';
if (!verbose) {
return device + ' ' + platform + ' ' + version;
return `${device} ${platform} ${version}`;
}
return (device + ' on ' + platform + ' ' + version + ' ' + executing).trim();
return `${device} on ${platform} ${version} ${executing}`.trim();
}

@@ -197,3 +202,3 @@

return browser + (version ? ' (v' + version + ')' : '') + (platform ? ' on ' + platform : '');
return browser + (version ? ` (v${version})` : '') + (platform ? ` on ${platform}` : '');
}

@@ -218,3 +223,3 @@ }, {

if (specUid.indexOf('"before all"') !== 0) {
output += preface + ' ' + indent + specTitle + '\n';
output += `${preface} ${indent}${specTitle}\n`;
}

@@ -232,3 +237,3 @@

output += ' ' + indent;
output += this.baseReporter.color(this.getColor(test.state), this.getSymbol(test.state));
output += this.chalk[this.getColor(test.state)](this.getSymbol(test.state));
output += ' ' + testTitle + '\n';

@@ -269,4 +274,4 @@ }

output += preface + ' ';
output += this.baseReporter.color(this.getColor(state), testCount);
output += ' ' + this.baseReporter.color(this.getColor(state), state);
output += this.chalk[this.getColor(state)](testCount);
output += ' ' + this.chalk[this.getColor(state)](state);
output += testDuration;

@@ -288,12 +293,12 @@ output += '\n';

var title = typeof test.parent !== 'undefined' ? test.parent + ' ' + test.title : test.title;
output += preface.trim() + '\n';
output += preface + ' ' + _this2.baseReporter.color('error title', i + 1 + ') ' + title + ':') + '\n';
output += preface + ' ' + _this2.baseReporter.color('error message', test.err.message) + '\n';
output += `${preface.trim()}\n`;
output += `${preface} ${i + 1}) ${title}:\n`;
output += `${preface} ${_this2.chalk.red(test.err.message)}\n`;
if (test.err.stack) {
var stack = test.err.stack.split(/\n/g).map(function (l) {
return preface + ' ' + _this2.baseReporter.color('error stack', l);
return `${preface} ${_this2.chalk.gray(l)}`;
}).join('\n');
output += stack + '\n';
output += `${stack}\n`;
} else {
output += preface + ' ' + _this2.baseReporter.color('error stack', 'no stack available') + '\n';
output += `${preface} ${_this2.chalk.gray('no stack available')}\n`;
}

@@ -313,4 +318,4 @@ });

if (results.config.host.indexOf('saucelabs.com') > -1) {
output += preface.trim() + '\n';
output += preface + ' Check out job at https://saucelabs.com/tests/' + results.sessionID + '\n';
output += `${preface.trim()}\n`;
output += `${preface} Check out job at https://saucelabs.com/tests/${results.sessionID}\n`;
return output;

@@ -327,3 +332,3 @@ }

var results = stats.runners[cid];
var preface = '[' + this.getBrowserCombo(results.capabilities, false) + ' #' + cid + ']';
var preface = `[${this.getBrowserCombo(results.capabilities, false)} #${cid}]`;
var specHash = stats.getSpecHash(runner);

@@ -347,12 +352,26 @@ var spec = results.specs[specHash];

output += '------------------------------------------------------------------\n';
output += preface + ' Session ID: ' + results.sessionID + '\n';
output += preface + ' Spec: ' + this.specs[cid] + '\n';
output += preface + ' Running: ' + combo + '\n';
output += preface + '\n';
/**
* won't be available when running multiremote tests
*/
if (results.sessionID) {
output += `${preface} Session ID: ${results.sessionID}\n`;
}
output += `${preface} Spec: ${this.specs[cid]}\n`;
/**
* won't be available when running multiremote tests
*/
if (combo) {
output += `${preface} Running: ${combo}\n`;
}
output += `${preface}\n`;
output += this.getResultList(cid, spec.suites, preface);
output += preface + '\n';
output += `${preface}\n`;
output += this.getSummary(this.results[cid], spec._duration, preface);
output += this.getFailureList(failures, preface);
output += this.getJobLink(results, preface);
output += preface + '\n';
output += `${preface}\n`;
return output;

@@ -359,0 +378,0 @@ }

import events from 'events'
import chalk from 'chalk'
import humanizeDuration from 'humanize-duration'

@@ -20,2 +21,3 @@

this.chalk = chalk
this.baseReporter = baseReporter

@@ -114,7 +116,7 @@ this.config = config

case 'pending':
color = 'pending'
color = 'cyan'
break
case 'fail':
case 'failing':
color = 'fail'
color = 'red'
break

@@ -180,3 +182,3 @@ }

output += ' ' + indent
output += this.baseReporter.color(this.getColor(test.state), this.getSymbol(test.state))
output += this.chalk[this.getColor(test.state)](this.getSymbol(test.state))
output += ' ' + testTitle + '\n'

@@ -214,4 +216,4 @@ }

output += preface + ' '
output += this.baseReporter.color(this.getColor(state), testCount)
output += ' ' + this.baseReporter.color(this.getColor(state), state)
output += this.chalk[this.getColor(state)](testCount)
output += ' ' + this.chalk[this.getColor(state)](state)
output += testDuration

@@ -231,9 +233,9 @@ output += '\n'

output += `${preface.trim()}\n`
output += preface + ' ' + this.baseReporter.color('error title', `${(i + 1)}) ${title}:`) + '\n'
output += preface + ' ' + this.baseReporter.color('error message', test.err.message) + '\n'
output += `${preface} ${(i + 1)}) ${title}:\n`
output += `${preface} ${this.chalk.red(test.err.message)}\n`
if (test.err.stack) {
const stack = test.err.stack.split(/\n/g).map((l) => `${preface} ${this.baseReporter.color('error stack', l)}`).join('\n')
const stack = test.err.stack.split(/\n/g).map((l) => `${preface} ${this.chalk.gray(l)}`).join('\n')
output += `${stack}\n`
} else {
output += `${preface} ${this.baseReporter.color('error stack', 'no stack available')}\n`
output += `${preface} ${this.chalk.gray('no stack available')}\n`
}

@@ -281,5 +283,19 @@ })

output += '------------------------------------------------------------------\n'
output += `${preface} Session ID: ${results.sessionID}\n`
/**
* won't be available when running multiremote tests
*/
if (results.sessionID) {
output += `${preface} Session ID: ${results.sessionID}\n`
}
output += `${preface} Spec: ${this.specs[cid]}\n`
output += `${preface} Running: ${combo}\n`
/**
* won't be available when running multiremote tests
*/
if (combo) {
output += `${preface} Running: ${combo}\n`
}
output += `${preface}\n`

@@ -286,0 +302,0 @@ output += this.getResultList(cid, spec.suites, preface)

{
"name": "wdio-spec-reporter",
"version": "0.1.2",
"version": "0.1.3",
"description": "A WebdriverIO plugin. Report results in 'spec' format.",

@@ -44,4 +44,5 @@ "main": "build/reporter.js",

"dependencies": {
"babel-runtime": "~6.25.0",
"humanize-duration": "~3.10.0"
"babel-runtime": "~6.26.0",
"chalk": "^2.3.0",
"humanize-duration": "~3.12.0"
},

@@ -51,5 +52,5 @@ "devDependencies": {

"babel-core": "^6.25.0",
"babel-eslint": "^7.2.2",
"babel-eslint": "^8.0.0",
"babel-plugin-add-module-exports": "^0.2.1",
"babel-preset-es2015": "^6.24.1",
"babel-preset-env": "^1.6.1",
"babel-preset-stage-0": "^6.24.1",

@@ -66,7 +67,7 @@ "codeclimate-test-reporter": "^0.4.1",

"istanbul": "^0.4.5",
"mocha": "^3.4.0",
"mocha": "^4.0.0",
"np": "^2.13.2",
"npm-run-all": "^4.0.2",
"should": "^11.2.1",
"sinon": "^3.0.0"
"should": "^13.0.0",
"sinon": "^4.0.0"
},

@@ -73,0 +74,0 @@ "contributors": [

@@ -146,61 +146,39 @@ export const SUITE = {

export const COLORS = {
'pass': 90,
'fail': 31,
'bright pass': 92,
'bright fail': 91,
'bright yellow': 93,
'pending': 36,
'suite': 0,
'error title': 0,
'error message': 31,
'error stack': 90,
'checkmark': 32,
'fast': 90,
'medium': 33,
'slow': 31,
'green': 32,
'light': 90,
'diff gutter': 90,
'diff added': 32,
'diff removed': 31
}
export const RESULTLIST = `kuckkuck> some foobar test
kuckkuck> \u001b[32m✓\u001b[0m foo
kuckkuck> \u001b[36m-\u001b[0m bar
kuckkuck> ✓ foo
kuckkuck> - bar
kuckkuck>
kuckkuck> some other foobar test
kuckkuck> \u001b[32m✓\u001b[0m that is a test
kuckkuck> \u001b[31m28)\u001b[0m and another test
kuckkuck> ✓ that is a test
kuckkuck> 28) and another test
kuckkuck>
kuckkuck> some spec title
kuckkuck> \u001b[31m29)\u001b[0m some last test
kuckkuck> \u001b[31m30)\u001b[0m really last
kuckkuck> 29) some last test
kuckkuck> 30) really last
kuckkuck>
`
export const SUMMARY = `kuckkuck> \u001b[32m3\u001b[0m \u001b[32mpassing\u001b[0m (2m, 19s)
kuckkuck> \u001b[36m1\u001b[0m \u001b[36mpending\u001b[0m
kuckkuck> \u001b[31m2\u001b[0m \u001b[31mfailing\u001b[0m
export const SUMMARY = `kuckkuck> 3 passing (2m, 19s)
kuckkuck> 1 pending
kuckkuck> 2 failing
`
export const ERRORLIST = `kuckkuck>
kuckkuck> \u001b[0m1) some parent some title:\u001b[0m
kuckkuck> \u001b[31mOoops\u001b[0m
kuckkuck> \u001b[90mHi\u001b[0m
kuckkuck> \u001b[90mwhat up\u001b[0m
kuckkuck> \u001b[90mthere?\u001b[0m
kuckkuck> 1) some parent some title:
kuckkuck> Ooops
kuckkuck> Hi
kuckkuck> what up
kuckkuck> there?
kuckkuck>
kuckkuck> \u001b[0m2) some other title:\u001b[0m
kuckkuck> \u001b[31moh shit\u001b[0m
kuckkuck> \u001b[90msomething\u001b[0m
kuckkuck> \u001b[90mwent\u001b[0m
kuckkuck> \u001b[90mwrong\u001b[0m
kuckkuck> 2) some other title:
kuckkuck> oh shit
kuckkuck> something
kuckkuck> went
kuckkuck> wrong
`
export const ERRORLIST_NO_STACK = `kuckkuck>
kuckkuck> \u001b[0m1) some parent some title:\u001b[0m
kuckkuck> \u001b[31mOoops\u001b[0m
kuckkuck> \u001b[90mno stack available\u001b[0m
kuckkuck> 1) some parent some title:
kuckkuck> Ooops
kuckkuck> no stack available
`

@@ -207,0 +185,0 @@

import sinon from 'sinon'
import chalk from 'chalk'
import SpecReporter from '../lib/reporter'
import {
SUITE, COLORS, RESULTLIST, SUMMARY, ERRORS, ERRORLIST,
SUITE, RESULTLIST, SUMMARY, ERRORS, ERRORLIST,
STATS, STATS_WITH_NO_SPECS, SUITERESULT, JOBLINKRESULT,

@@ -16,5 +17,2 @@ ERRORS_NO_STACK, ERRORLIST_NO_STACK, SUITES_SUMMARY,

error: 'F'
},
color (type, str) {
return `\u001b[${COLORS[type]}m${str}\u001b[0m`
}

@@ -24,2 +22,7 @@ }

/**
* disable colors for testing purposes
*/
reporter.chalk = new chalk.constructor({level: 0})
describe('spec reporter', () => {

@@ -148,6 +151,6 @@ describe('the runner:start event', () => {

reporter.getColor('passing').should.be.equal('green')
reporter.getColor('pending').should.be.equal('pending')
reporter.getColor('fail').should.be.equal('fail')
reporter.getColor('fail').should.be.equal('fail')
reporter.getColor('failing').should.be.equal('fail');
reporter.getColor('pending').should.be.equal('cyan')
reporter.getColor('fail').should.be.equal('red')
reporter.getColor('fail').should.be.equal('red')
reporter.getColor('failing').should.be.equal('red');
(reporter.getColor('foobar') === null).should.be.true()

@@ -154,0 +157,0 @@ })

Sorry, the diff of this file is not supported yet

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