Socket
Socket
Sign inDemoInstall

jasmine

Package Overview
Dependencies
13
Maintainers
3
Versions
53
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.5.2 to 2.5.3

MIT.LICENSE

8

lib/command.js

@@ -60,2 +60,3 @@ var path = require('path'),

var files = [],
helpers = [],
color = process.stdout.isTTY || false,

@@ -72,2 +73,4 @@ filter,

filter = arg.match("^--filter=(.*)")[1];
} else if (arg.match("^--helper=")) {
helpers.push(arg.match("^--helper=(.*)")[1]);
} else if (arg.match("^--stop-on-failure=")) {

@@ -87,2 +90,3 @@ stopOnFailure = arg.match("^--stop-on-failure=(.*)")[1] === 'true';

stopOnFailure: stopOnFailure,
helpers: helpers,
files: files,

@@ -105,2 +109,5 @@ random: random,

}
if (env.helpers !== undefined && env.helpers.length) {
jasmine.addHelperFiles(env.helpers);
}
jasmine.showColors(env.color);

@@ -171,2 +178,3 @@ jasmine.execute(env.files, env.filter);

print('%s\tfilter specs to run only those that match the given string', lPad('--filter=', 18));
print('%s\tload helper files that match the given string', lPad('--helper=', 18));
print('%s\t[true|false] stop spec execution on expectation failure', lPad('--stop-on-failure=', 18));

@@ -173,0 +181,0 @@ print('');

4

lib/filters/console_spec_filter.js
module.exports = exports = ConsoleSpecFilter;
function ConsoleSpecFilter(options) {
var filterString = options && options.filterString && options.filterString.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
var filterString = options && options.filterString;
var filterPattern = new RegExp(filterString);

@@ -10,2 +10,2 @@

};
}
}

@@ -18,2 +18,3 @@ var path = require('path'),

this.printDeprecation = options.printDeprecation || require('./printDeprecation');
this.specDir = '';
this.specFiles = [];

@@ -29,2 +30,3 @@ this.helperFiles = [];

this.env.addReporter(this.reporter);
this.defaultReporterConfigured = false;

@@ -78,2 +80,3 @@ var jasmineRunner = this;

this.reporter.setOptions(options);
this.defaultReporterConfigured = true;
};

@@ -108,36 +111,36 @@

Jasmine.prototype.loadConfig = function(config) {
var jasmineRunner = this;
jasmineRunner.specDir = config.spec_dir || '';
this.specDir = config.spec_dir || this.specDir;
this.env.throwOnExpectationFailure(config.stopSpecOnExpectationFailure);
this.env.randomizeTests(config.random);
if(config.helpers) {
config.helpers.forEach(function(helperFile) {
var filePaths = glob.sync(path.join(jasmineRunner.projectBaseDir, jasmineRunner.specDir, helperFile));
filePaths.forEach(function(filePath) {
if(jasmineRunner.helperFiles.indexOf(filePath) === -1) {
jasmineRunner.helperFiles.push(filePath);
}
});
});
this.addHelperFiles(config.helpers);
}
this.env.throwOnExpectationFailure(config.stopSpecOnExpectationFailure);
this.env.randomizeTests(config.random);
if(config.spec_files) {
jasmineRunner.addSpecFiles(config.spec_files);
this.addSpecFiles(config.spec_files);
}
};
Jasmine.prototype.addSpecFiles = function(files) {
var jasmineRunner = this;
Jasmine.prototype.addHelperFiles = addFiles('helperFiles');
Jasmine.prototype.addSpecFiles = addFiles('specFiles');
files.forEach(function(specFile) {
var filePaths = glob.sync(path.join(jasmineRunner.projectBaseDir, jasmineRunner.specDir, specFile));
filePaths.forEach(function(filePath) {
if(jasmineRunner.specFiles.indexOf(filePath) === -1) {
jasmineRunner.specFiles.push(filePath);
function addFiles(kind) {
return function (files) {
var jasmineRunner = this;
var fileArr = this[kind];
files.forEach(function(file) {
if(!(path.isAbsolute && path.isAbsolute(file))) {
file = path.join(jasmineRunner.projectBaseDir, jasmineRunner.specDir, file);
}
var filePaths = glob.sync(file);
filePaths.forEach(function(filePath) {
if(fileArr.indexOf(filePath) === -1) {
fileArr.push(filePath);
}
});
});
});
};
};
}

@@ -163,3 +166,5 @@ Jasmine.prototype.onComplete = function(onCompleteCallback) {

this.loadHelpers();
this.configureDefaultReporter({ showColors: this.showingColors });
if (!this.defaultReporterConfigured) {
this.configureDefaultReporter({ showColors: this.showingColors });
}

@@ -166,0 +171,0 @@ if(filterString) {

@@ -30,13 +30,23 @@ module.exports = exports = ConsoleReporter;

this.setOptions = function(options) {
print = options.print;
if (options.print) {
print = options.print;
}
showColors = options.showColors || false;
timer = options.timer || noopTimer;
jasmineCorePath = options.jasmineCorePath;
printDeprecation = options.printDeprecation || require('../printDeprecation');
stackFilter = options.stackFilter || defaultStackFilter;
if (options.timer) {
timer = options.timer;
}
if (options.jasmineCorePath) {
jasmineCorePath = options.jasmineCorePath;
}
if (options.printDeprecation) {
printDeprecation = options.printDeprecation;
}
if (options.stackFilter) {
stackFilter = options.stackFilter;
}
if(options.onComplete) {
printDeprecation('Passing in an onComplete function to the ConsoleReporter is deprecated.');
onComplete = options.onComplete;
}
onComplete = options.onComplete || function() {};
};

@@ -173,2 +183,6 @@

function defaultStackFilter(stack) {
if (!stack) {
return '';
}
var filteredStack = stack.split('\n').filter(function(stackLine) {

@@ -175,0 +189,0 @@ return stackLine.indexOf(jasmineCorePath) === -1;

@@ -12,3 +12,3 @@ {

"license": "MIT",
"version": "2.5.2",
"version": "2.5.3",
"repository": {

@@ -15,0 +15,0 @@ "type": "git",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc