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.25.0 to 0.26.0

14

lib/node/bin/test.js

@@ -63,2 +63,10 @@ var Client = require('../../node/client'),

}).
option('this-chunk', {
desc: 'Current chunk number to run',
default: 1
}).
option('total-chunks', {
desc: 'Total number of chunks to run',
default: 1
}).
argv;

@@ -109,3 +117,7 @@

client.send(launchEvent, {files: files});
client.send(launchEvent, {
files: files,
thisChunk: argv['this-chunk'],
totalChunks: argv['total-chunks']
});
});

@@ -112,0 +124,0 @@

33

lib/node/server/queue-tests.js

@@ -22,3 +22,3 @@ /**

enhance: function enhance(server) {
enhance: function (server) {
server.on(this.eventNames.connect, this._onWorkerReady.bind(this, server));

@@ -28,3 +28,3 @@ server.on(this.eventNames.start, this._startTests.bind(this, server));

_onWorkerReady: function _onWorkerReady(server) {
_onWorkerReady: function (server) {
this.clientReady = true;

@@ -39,3 +39,7 @@ var testData = null;

_startTests: function _startTests(server, data) {
_startTests: function (server, data) {
data = data || {};
var totalChunks = data.totalChunks || 1;
var thisChunk = data.thisChunk || 1;
// if there are no clients connected

@@ -48,7 +52,7 @@ // simply store the test data for now

if (data && data.files && data.files.length > 0) {
this._broadCastFiles(server, data.files);
if (data.files && data.files.length > 0) {
this._broadCastFiles(server, data.files, totalChunks, thisChunk);
} else {
server.suite.findTestFiles(function(err, files) {
this._broadCastFiles(server, files);
this._broadCastFiles(server, files, totalChunks, thisChunk);
}.bind(this));

@@ -58,8 +62,19 @@ }

_broadCastFiles: function _broadCastFiles(server, files) {
/**
Tell the clients to run a particular set of tests this function also handles
chunking logic.
*/
_broadCastFiles: function (server, files, totalChunks, thisChunk) {
// Generate a sorted list of files...
var list = files.map(function(file) {
var result = server.suite.testFromPath(file);
return result.testUrl;
});
}).sort();
// Chunking logic this allows running a subset of tests...
var chunkLength = Math.ceil(list.length / totalChunks);
var chunk = (thisChunk - 1) * chunkLength;
list = list.slice(chunk, chunk + chunkLength);
console.log('Running tests: ', list);
server.broadcast(server.stringify(this.eventNames.sendEvent, {tests: list}));

@@ -66,0 +81,0 @@ }

{
"name": "test-agent",
"version": "0.25.0",
"version": "0.26.0",
"author": "James Lal",

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

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