Socket
Socket
Sign inDemoInstall

jasmine

Package Overview
Dependencies
Maintainers
4
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jasmine - npm Package Compare versions

Comparing version 3.5.0 to 3.6.0

.idea/jasmine-npm.iml

21

bin/jasmine.js
#!/usr/bin/env node
var path = require('path'),
Command = require('../lib/command.js'),
Jasmine = require('../lib/jasmine.js');
var cluster = require('cluster'),
path = require('path'),
Jasmine = require("../lib/jasmine");
var jasmine = new Jasmine({ projectBaseDir: path.resolve() });
var examplesDir = path.join(path.dirname(require.resolve('jasmine-core')), 'jasmine-core', 'example', 'node_example');
var command = new Command(path.resolve(), examplesDir, console.log);
command.run(jasmine, process.argv.slice(2));
if (cluster.isMaster) {
var Command = require('../lib/command.js');
var examplesDir = path.join(path.dirname(require.resolve('jasmine-core')), 'jasmine-core', 'example', 'node_example');
var command = new Command(path.resolve(), examplesDir, console.log);
command.run(jasmine, process.argv.slice(2));
} else if (cluster.isWorker) {
var loadConfig = require('../lib/loadConfig');
var runWorkerJasmine = require('../lib/worker');
runWorkerJasmine(jasmine, loadConfig);
}

@@ -34,3 +34,3 @@ module.exports = function(grunt) {

var done = this.async(),
commands = ['git tag ' + versionString, 'git push origin master --tags', 'npm publish'];
commands = ['git tag ' + versionString, 'git push origin main --tags', 'npm publish'];

@@ -37,0 +37,0 @@ runCommands(commands, done);

@@ -78,5 +78,7 @@ var path = require('path'),

random,
seed;
seed,
workerCount;
argv.forEach(function(arg) {
for (var i in argv) {
var arg = argv[i];
if (arg === '--no-color') {

@@ -86,2 +88,4 @@ color = false;

color = true;
} else if (arg.match("^--worker-count=")) {
workerCount = parseInt(arg.match("^--worker-count=(.*)")[1]);
} else if (arg.match("^--filter=")) {

@@ -105,2 +109,4 @@ filter = arg.match("^--filter=(.*)")[1];

reporter = arg.match("^--reporter=(.*)")[1];
} else if (arg === '--') {
break;
} else if (isFileArg(arg)) {

@@ -111,3 +117,3 @@ files.push(arg);

}
});
}
return {

@@ -125,2 +131,3 @@ color: color,

seed: seed,
workerCount: workerCount,
unknownOptions: unknownOptions

@@ -131,35 +138,10 @@ };

function runJasmine(jasmine, env, print) {
jasmine.loadConfigFile(env.configPath || process.env.JASMINE_CONFIG_PATH);
if (env.stopOnFailure !== undefined) {
jasmine.stopSpecOnExpectationFailure(env.stopOnFailure);
var loadConfig = require('./loadConfig');
if (!env.workerCount || env.workerCount < 2) {
loadConfig(jasmine, env, print);
jasmine.execute(env.files, env.filter);
} else {
var runMasterJasmine = require('./master');
runMasterJasmine(jasmine, env, print, loadConfig);
}
if (env.failFast !== undefined) {
jasmine.stopOnSpecFailure(env.failFast);
}
if (env.seed !== undefined) {
jasmine.seed(env.seed);
}
if (env.random !== undefined) {
jasmine.randomizeTests(env.random);
}
if (env.helpers !== undefined && env.helpers.length) {
jasmine.addHelperFiles(env.helpers);
}
if (env.requires !== undefined && env.requires.length) {
jasmine.addRequires(env.requires);
}
if (env.reporter !== undefined) {
try {
var Report = require(env.reporter);
var reporter = new Report();
jasmine.clearReporters();
jasmine.addReporter(reporter);
} catch(e) {
print('failed to register reporter "' + env.reporter + '"');
print(e.message);
print(e.stack);
}
}
jasmine.showColors(env.color);
jasmine.execute(env.files, env.filter);
}

@@ -210,3 +192,3 @@

var print = options.print;
print('Usage: jasmine [command] [options] [files]');
print('Usage: jasmine [command] [options] [files] [--]');
print('');

@@ -236,2 +218,4 @@ print('Commands:');

print('%s\tpath to reporter to use instead of the default Jasmine reporter', lPad('--reporter=', 18));
print('%s\tnumber of workers to run the tests in parallel. Default is 1', lPad('--worker-count=', 18));
print('%s\tmarker to signal the end of options meant for Jasmine', lPad('--', 18));
print('');

@@ -238,0 +222,0 @@ print('The given arguments take precedence over options in your jasmine.json');

var path = require('path'),
util = require('util'),
glob = require('glob'),
fg = require('fast-glob'),
CompletionReporter = require('./reporters/completion_reporter'),

@@ -89,2 +89,3 @@ ConsoleSpecFilter = require('./filters/console_spec_filter');

this.specFiles.forEach(function(file) {
delete require.cache[require.resolve(file)];
require(file);

@@ -96,2 +97,3 @@ });

this.helperFiles.forEach(function(file) {
delete require.cache[require.resolve(file)];
require(file);

@@ -103,2 +105,3 @@ });

this.requires.forEach(function(r) {
delete require.cache[require.resolve(r)];
require(r);

@@ -123,2 +126,6 @@ });

if (config.failSpecWithNoExpectations !== undefined) {
configuration.failSpecWithNoExpectations = config.failSpecWithNoExpectations;
}
if (config.stopSpecOnExpectationFailure !== undefined) {

@@ -166,31 +173,28 @@ configuration.oneFailurePerSpec = config.stopSpecOnExpectationFailure;

var jasmineRunner = this;
var fileArr = this[kind];
files = files.map(function(file) {
var hasNegation = file[0] === "!";
var includeFiles = [];
var excludeFiles = [];
files.forEach(function(file) {
if (file.startsWith('!')) {
var excludeFile = file.substring(1);
if(!(path.isAbsolute && path.isAbsolute(excludeFile))) {
excludeFile = path.join(jasmineRunner.projectBaseDir, jasmineRunner.specDir, excludeFile);
}
if (hasNegation) {
file = file.substring(1);
}
excludeFiles.push(excludeFile);
} else {
includeFiles.push(file);
if (!path.isAbsolute(file)) {
file = path.join(jasmineRunner.projectBaseDir, jasmineRunner.specDir, file);
}
if (hasNegation) {
file = '!' + file;
}
return file;
});
includeFiles.forEach(function(file) {
if(!(path.isAbsolute && path.isAbsolute(file))) {
file = path.join(jasmineRunner.projectBaseDir, jasmineRunner.specDir, file);
var fileArr = this[kind];
fg.sync(this[kind].concat(files), { 'unique': true }).forEach(function(file) {
// glob will always output '/' as a segment separator but the fileArr may use \ on windows
// fileArr needs to be checked for both versions
if(fileArr.indexOf(file) === -1 && fileArr.indexOf(path.normalize(file)) === -1) {
fileArr.push(file);
}
var filePaths = glob.sync(file, { ignore: excludeFiles });
filePaths.forEach(function(filePath) {
// glob will always output '/' as a segment separator but the fileArr may use \ on windows
// fileArr needs to be checked for both versions
if(fileArr.indexOf(filePath) === -1 && fileArr.indexOf(path.normalize(filePath)) === -1) {
fileArr.push(filePath);
}
});
});

@@ -249,3 +253,3 @@ };

if(filterString) {
if (filterString) {
var specFilter = new ConsoleSpecFilter({

@@ -252,0 +256,0 @@ filterString: filterString

@@ -205,2 +205,17 @@ module.exports = exports = ConsoleReporter;

}
// When failSpecWithNoExpectations = true and a spec fails because of no expectations found,
// jasmine-core reports it as a failure with no message.
//
// Therefore we assume that when there are no failed or passed expectations,
// the failure was because of our failSpecWithNoExpectations setting.
//
// Same logic is used by jasmine.HtmlReporter, see https://github.com/jasmine/jasmine/blob/master/src/html/HtmlReporter.js
if (result.failedExpectations.length === 0 &&
result.passedExpectations.length === 0) {
printNewline();
print(indent('Message:', 2));
printNewline();
print(colored('red', indent('Spec has no expectations', 4)));
}

@@ -207,0 +222,0 @@ printNewline();

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

"license": "MIT",
"version": "3.5.0",
"version": "3.6.0",
"repository": {

@@ -22,4 +22,4 @@ "type": "git",

"dependencies": {
"glob": "^7.1.4",
"jasmine-core": "~3.5.0"
"fast-glob": "^2.2.6",
"jasmine-core": "~3.6.0"
},

@@ -26,0 +26,0 @@ "bin": "./bin/jasmine.js",

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