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

grunt-parallel-spec-runner

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grunt-parallel-spec-runner - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

2

package.json
{
"name": "grunt-parallel-spec-runner",
"version": "0.0.2",
"version": "0.0.3",
"description": "Plugin used to configure and launch multiple spec ",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/RallySoftware/grunt-parallel-spec-runner.git",

@@ -13,3 +13,3 @@ /*

var SpecRunner = function(){
var SpecRunner = function(options){
var started = false,

@@ -25,15 +25,4 @@ allDone = false,

var config = arguments[0] || {},
target = config.target,
debug = config.debug || false,
verbose = config.verbose || false,
specs = config.specs || [],
keepalive = config.keepalive || false,
isolatedSpecs = config.isolatedSpecs || [],
isolateAllSpecs = config.isolateAllSpecs || false,
maxRunners = +config.maxRunners > 0 ? +config.maxRunners : 4,
maxSpecFilesPerRunner = +config.maxSpecFilesPerRunner > 0 ? +config.maxSpecFilesPerRunner : Math.ceil(specs.length / maxRunners);
if(isolateAllSpecs){
maxSpecFilesPerRunner = 1;
if(options.isolateAllSpecs){
options.maxSpecFilesPerRunner = 1;
};

@@ -48,6 +37,6 @@

var appendAdditionalOptions = function(args){
if(debug){
if(options.debug){
args.push('--debug');
}
if(verbose){
if(options.verbose){
args.push('--verbose');

@@ -59,4 +48,4 @@ }

var buildSpecRunners = function(){
specs.forEach(function(path) {
if(isolatedSpecs.indexOf(path) == -1){
options.specs.forEach(function(path) {
if(options.isolatedSpecs.indexOf(path) == -1){
buildSpecRunner(path);

@@ -66,5 +55,5 @@ }

if(isolatedSpecs.length > 0){
maxSpecFilesPerRunner = 1;
isolatedSpecs.forEach(function(path) {
if(options.isolatedSpecs.length > 0){
options.maxSpecFilesPerRunner = 1;
options.isolatedSpecs.forEach(function(path) {
grunt.verbose.writeln('Isolating spec: ' + path);

@@ -89,3 +78,3 @@ if(specRunners[specRunnerIndex] && specRunners[specRunnerIndex].specs.length > 0){

specRunners[specRunnerIndex].specs.push(path);
if(specRunners[specRunnerIndex].specs.length >= maxSpecFilesPerRunner){
if(specRunners[specRunnerIndex].specs.length >= options.maxSpecFilesPerRunner){
specRunnerIndex++;

@@ -103,4 +92,3 @@ }

var targetName = 'jasmine:' + target + ':build:' + specRunner.file + ':' + specRunner.specs.join(',');
grunt.verbose.writeln('target:' + targetName);
var targetName = 'jasmine:' + options.target + ':build:' + specRunner.file + ':' + specRunner.specs.join(',');
var spawnOptions =

@@ -119,3 +107,3 @@ {

var i = setInterval(function(){
while(activeRunners <= maxRunners && specRunnerQueue.length > 0){
while(activeRunners <= options.maxSpecRunners && specRunnerQueue.length > 0){
launchSpecRunner(specRunnerQueue.pop())

@@ -148,6 +136,6 @@ }

opts: {stdio: 'inherit'},
args: ['webdriver_jasmine_runner:' + target + ':' + specRunner.file]
args: ['webdriver_jasmine_runner:' + options.target + ':' + specRunner.file]
}
appendAdditionalOptions(opts.args);
if(keepalive){
if(options.keepalive){
opts.args.push('--keepalive');

@@ -170,3 +158,3 @@ }

var cleanUp = function(){
if(!keepalive) {
if(!options.keepalive) {
specRunners.forEach(function(specRunner){

@@ -190,3 +178,2 @@ grunt.file.delete(specRunner.file);

buildSpecRunners();
//writeSpecRunners();
launchSpecRunners();

@@ -203,29 +190,33 @@ waitForDone();

var config = {
target: grunt.task.current.target,
var options = this.options({
specs: [],
excludedSpecs: [],
isolatedSpecs: [],
target: this.target,
debug: grunt.option('debug') || false,
verbose: grunt.option('verbose') || false,
keepalive: grunt.option('keepalive') || false,
maxRunners: grunt.option('maxRunners') > 0 ? +grunt.option('maxRunners') : 4,
maxSpecFilesPerRunner: grunt.option('maxSpecFilesPerRunner'),
isolateAllSpecs: grunt.option('isolateAllSpecs') || false,
maxSpecRunners: grunt.option('maxSpecRunners') > 0 ? +grunt.option('maxSpecRunners') : 4,
isolateAllSpecs: grunt.option('isolateAllSpecs') || false
});
options.specs = grunt.file.expand({filter: 'isFile'}, options.specs);
options.excludedSpecs = grunt.file.expand({filter: 'isFile'}, options.excludedSpecs);
options.isolatedSpecs = grunt.file.expand({filter: 'isFile'}, options.isolatedSpecs);
//TODO: specs should be on the parallel_spec_runner apsdkp options... rather that looking at another task config like this.
excludedSpecs: grunt.file.expand({filter: 'isFile'}, grunt.config('parallel_spec_runner.' + grunt.task.current.target + '.options.excludedSpecs') || []),
isolatedSpecs: grunt.file.expand({filter: 'isFile'}, grunt.config('parallel_spec_runner.' + grunt.task.current.target + '.options.isolatedSpecs') || []),
specs: grunt.file.expand({filter: 'isFile'}, grunt.config('jasmine.options.specs') || [])
};
if(config.excludedSpecs.length > 0){
config.specs = config.specs.filter(function(path){
var keep = config.excludedSpecs.indexOf(path) == -1;
if(!keep){
if(options.excludedSpecs.length > 0){
options.specs = options.specs.filter(function(path){
if(options.excludedSpecs.indexOf(path) != -1){
grunt.verbose.writeln('Excluding spec: ' + path);
return false;
}
return keep;
return true;
});
}
//Use the user defined number of spec files per runner, or split the spec files among the available runners
options.maxSpecFilesPerRunner = +grunt.option('maxSpecFilesPerRunner') > 0 ? +grunt.option('maxSpecFilesPerRunner')
: Math.ceil(options.specs.length / options.maxSpecRunners);
var done = this.async(), me = this;
var specRunner = new SpecRunner(config),
var specRunner = new SpecRunner(options),
i = setInterval(function () {

@@ -240,3 +231,3 @@ if (specRunner.isDone()) {

done(me.errorCount == 0);
if (config.keepalive) {
if (options.keepalive) {
grunt.task.run('express-keepalive');

@@ -243,0 +234,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