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

test-agent

Package Overview
Dependencies
Maintainers
6
Versions
108
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

test-agent - npm Package Compare versions

Comparing version 0.22.15 to 0.22.16

12

lib/node/bin/server.js

@@ -34,8 +34,2 @@ var server = new (require('../websocket-server')),

option('coverage-thresholds', {
alias: 't',
desc: "Array of paths to coverage thresholds files",
default: './metadata.json'
}).
option('growl', {

@@ -97,9 +91,7 @@ desc: "Enables growl notifications for server"

use(Enhancements.MochaTestEvents).
use(Enhancements.BlanketConsoleReporter).
use(Enhancements.QueueTests).
use(Enhancements.StartCoverages).
use(Enhancements.EventMirror).
use(Enhancements.Watcher).
use(Enhancements.BlanketConsoleReporter, {
paths: argv['coverage-thresholds'].split(' ')
});
use(Enhancements.Watcher);

@@ -106,0 +98,0 @@ if(argv.growl){

var Client = require('../../node/client'),
Apps = require('../../node/server'),
optimist = require('optimist'),
fsPath = require('path'),
argv,

@@ -54,7 +53,2 @@ reporters,

}).
option('coverage-thresholds', {
alias: 't',
desc: "Array of paths to coverage thresholds files",
default: './metadata.json'
}).
option('server', {

@@ -124,5 +118,3 @@ desc: 'Location of the websocket server to connect to.',

if (enableCoverage) {
client.use(Apps.BlanketConsoleReporter, {
paths: argv['coverage-thresholds'].split(' ')
});
client.use(Apps.BlanketConsoleReporter);
}

@@ -129,0 +121,0 @@

(function() {
'use strict';
function BlanketConsoleReporter(options) {
for (var key in options) {
if (options.hasOwnProperty(key)) {
this[key] = options[key];
}
}
function BlanketConsoleReporter() {
this.setupThresholds();
this.totalPasses = 0;
this.totalFailures = 0;
}

@@ -20,3 +12,2 @@

server.on('coverage report', this._onCoverageData.bind(this));
server.on('test runner end', this._printCoverageSummary.bind(this));
},

@@ -39,3 +30,3 @@

var percentage = function(covered, total) {
return Math.round(((covered / total) * 100) * 100) / 100;
return (Math.round(((covered / total) * 100) * 100) / 100) + ' %';
};

@@ -81,19 +72,14 @@

_printConsoleFormat: function _printConsoleFormat(coverResults) {
var appName = coverResults[0].filename.match(/[A-Za-z0-9_-]+/gi)[1],
titleColor = '\u001b[1;36m',
var titleColor = '\u001b[1;36m',
fileNameColor = '\u001b[0;37m',
stmtColor = '\u001b[0;33m',
passColor = '\u001b[0;32m',
failColor = '\u001b[0;31m',
thresholdColor = '\u001b[0;34m',
percentageColor = '\u001b[0;36m',
originColor = '\u001b[0m',
outputFormat,
fails = 0,
totals = coverResults.length - 1;
outputFormat;
// Print title
console.log('\n%s-- Test Coverage for %s%s%s --\n', titleColor, stmtColor,
(appName[0].toUpperCase() + appName.slice(1)), titleColor);
console.log('%sFile Name%s - %sCovered/Total Smts%s - %sCoverage (%)\n',
fileNameColor, originColor, stmtColor, originColor, passColor);
console.log('\n%s-- Blanket.js Test Coverage Result --\n', titleColor);
console.log('%sFile Name%s - %sCovered/Total Smts%s - %sCoverage(%)%s\n',
fileNameColor, originColor, stmtColor, originColor, percentageColor,
originColor);

@@ -104,16 +90,4 @@ // Print coverage result for each file

formatPrefix = (filename === 'Global Total' ? '\n' : ' '),
seperator = ' - ',
isPassThreshold = this.validateThreshold(appName, dataItem),
arrow = isPassThreshold ? ' > ' : ' < ',
covColor = isPassThreshold ? passColor : failColor;
seperator = ' - ';
if (filename !== 'Global Total') {
if (!isPassThreshold) {
fails++;
this.totalFailures++;
} else {
this.totalPasses++;
}
}
filename = (filename === 'Global Total' ? filename :

@@ -124,56 +98,7 @@ (filename.substr(0, filename.indexOf('?')) || filename));

outputFormat += stmtColor + dataItem.stmts + originColor + seperator;
outputFormat += covColor + dataItem.percentage + ' %' + originColor;
outputFormat += percentageColor + dataItem.percentage + originColor;
console.log(outputFormat);
}, this);
outputFormat = thresholdColor + '\nThreshold=' +
this.getAppThreshold(appName) + '%, ';
if (fails === 0) {
outputFormat += passColor + 'COVERAGE PASS';
} else {
outputFormat += failColor + 'COVERAGE FAIL: ' + fails + '/' +
totals + ' files failed coverage';
}
console.log(outputFormat);
},
_printCoverageSummary: function _printCoverageSummary() {
var passColor = '\u001b[0;32m',
failColor = '\u001b[0;31m',
originColor = '\u001b[0m',
passes = this.totalPasses,
fails = this.totalFailures,
totals = passes + fails,
output;
if (this.totalFailures === 0) {
output = passColor + 'SUMMARY COVERAGE PASS: ' + passes + '/' + totals;
output += ' files passed coverage';
} else {
output = failColor + 'SUMMARY COVERAGE FAILS: ' + fails + '/' + totals;
output += ' files failed coverage';
}
console.log(output + originColor);
},
setupThresholds: function setupThresholds() {
this.thresholds = {};
if (this.path) {
this.thresholds = require(this.path);
}
},
getAppThreshold: function getAppThreshold(appName) {
return this.thresholds[appName] || 0;
},
validateThreshold: function validateThreshold(appName, dataItem) {
return (dataItem.percentage > this.getAppThreshold(appName));
});
}
};

@@ -180,0 +105,0 @@

18

lib/test-agent/browser-worker/mocha-driver.js

@@ -16,2 +16,6 @@ (function(window) {

}
this.setup = this.setup || {};
this.setup.ui = this.setup.ui || this.ui;
this.setup.timeout = this.setup.timeout || this.timeout;
}

@@ -138,16 +142,6 @@

// due to a bug in mocha, iframes added to the DOM are
// detected as global leaks in FF 21+, these global ignores
// are a workaround. see also:
// https://developer.mozilla.org/en-US/docs/Site_Compatibility_for_Firefox_21
var globalIgnores = ['0', '1', '2', '3', '4', '5'];
self.setup.reporter = self.getReporter(box);
//setup mocha
box.mocha.setup({
ignoreLeaks: true,
globals: globalIgnores,
ui: self.ui,
reporter: self.getReporter(box),
timeout: self.timeout
});
box.mocha.setup(self.setup);
});

@@ -154,0 +148,0 @@

{
"name": "test-agent",
"version": "0.22.15",
"version": "0.22.16",
"author": "James Lal",

@@ -5,0 +5,0 @@ "description": "execute client side tests from browser report back to cli",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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