Socket
Socket
Sign inDemoInstall

jasmine

Package Overview
Dependencies
12
Maintainers
4
Versions
53
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.6.1 to 3.6.2

lib/loader.js

21

bin/jasmine.js
#!/usr/bin/env node
var cluster = require('cluster'),
path = require('path'),
Jasmine = require("../lib/jasmine");
var path = require('path'),
Command = require('../lib/command'),
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);
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);
}
command.run(jasmine, process.argv.slice(2));

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

grunt.initConfig({
pkg: pkg,
jshint: {all: ['lib/**/*.js', 'spec/**/*.js']}
pkg: pkg
});

@@ -30,3 +29,2 @@

// depend on jshint:all, specs?
grunt.registerTask('release',

@@ -41,7 +39,3 @@ 'Create tag ' + versionString + ' and push jasmine-' + pkg.version + ' to NPM',

grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadTasks('tasks');
grunt.registerTask('default', ['jshint:all', 'specs']);
};

@@ -78,4 +78,3 @@ var path = require('path'),

random,
seed,
workerCount;
seed;

@@ -88,4 +87,2 @@ for (var i in argv) {

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

@@ -129,3 +126,2 @@ filter = arg.match("^--filter=(.*)")[1];

seed: seed,
workerCount: workerCount,
unknownOptions: unknownOptions

@@ -137,9 +133,4 @@ };

var loadConfig = require('./loadConfig');
if (!env.workerCount || env.workerCount < 2) {
loadConfig(jasmine, env, print);
jasmine.execute(env.files, env.filter);
} else {
var runManagerJasmine = require('./manager');
runManagerJasmine(jasmine, env, print, loadConfig);
}
loadConfig(jasmine, env, print);
jasmine.execute(env.files, env.filter);
}

@@ -215,3 +206,2 @@

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));

@@ -218,0 +208,0 @@ print('');

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

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

options = options || {};
this.loader = options.loader || new Loader();
var jasmineCore = options.jasmineCore || require('jasmine-core');

@@ -88,13 +90,12 @@ this.jasmineCorePath = path.join(jasmineCore.files.path, 'jasmine.js');

Jasmine.prototype.loadSpecs = function() {
this.specFiles.forEach(function(file) {
require(file);
});
Jasmine.prototype.loadSpecs = async function() {
for (const file of this.specFiles) {
await this.loader.load(file);
}
};
Jasmine.prototype.loadHelpers = function() {
this.helperFiles.forEach(function(file) {
delete require.cache[require.resolve(file)];
require(file);
});
Jasmine.prototype.loadHelpers = async function() {
for (const file of this.helperFiles) {
await this.loader.load(file);
}
};

@@ -104,3 +105,2 @@

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

@@ -171,5 +171,7 @@ });

var jasmineRunner = this;
files = files.map(function(file) {
var hasNegation = file[0] === "!";
var fileArr = this[kind];
var {includeFiles, excludeFiles} = files.reduce(function(ongoing, file) {
var hasNegation = file.startsWith('!');
if (hasNegation) {

@@ -183,17 +185,20 @@ file = file.substring(1);

if (hasNegation) {
file = '!' + file;
}
return {
includeFiles: ongoing.includeFiles.concat(!hasNegation ? [file] : []),
excludeFiles: ongoing.excludeFiles.concat(hasNegation ? [file] : [])
};
}, { includeFiles: [], excludeFiles: [] });
return file;
});
includeFiles.forEach(function(file) {
var filePaths = glob
.sync(file, { ignore: excludeFiles })
.filter(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
return fileArr.indexOf(filePath) === -1 && fileArr.indexOf(path.normalize(filePath)) === -1;
});
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);
}
filePaths.forEach(function(filePath) {
fileArr.push(filePath);
});
});

@@ -243,7 +248,7 @@ };

Jasmine.prototype.execute = function(files, filterString) {
Jasmine.prototype.execute = async function(files, filterString) {
this.completionReporter.exitHandler = this.checkExit;
this.loadRequires();
this.loadHelpers();
await this.loadHelpers();
if (!this.defaultReporterConfigured) {

@@ -268,6 +273,9 @@ this.configureDefaultReporter({ showColors: this.showingColors });

this.loadSpecs();
await this.loadSpecs();
this.addReporter(this.completionReporter);
this.env.execute();
await new Promise(resolve => {
this.env.execute(null, resolve);
});
};

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

"license": "MIT",
"version": "3.6.1",
"version": "3.6.2",
"repository": {

@@ -19,6 +19,7 @@ "type": "git",

"scripts": {
"test": "./node_modules/.bin/grunt && ./bin/jasmine.js"
"test": "./bin/jasmine.js",
"posttest": "eslint \"bin/**/*.js\" \"lib/**/*.js\" \"spec/**/*.js\""
},
"dependencies": {
"fast-glob": "^2.2.6",
"glob": "^7.1.6",
"jasmine-core": "~3.6.0"

@@ -29,8 +30,34 @@ },

"devDependencies": {
"eslint": "^6.8.0",
"grunt": "^1.0.4",
"grunt-cli": "^1.3.2",
"grunt-contrib-jshint": "^2.1.0",
"shelljs": "^0.8.3",
"slash": "^2.0.0"
"slash": "^3.0.0"
},
"eslintConfig": {
"parserOptions": {
"ecmaVersion": 11
},
"rules": {
"no-unused-vars": [
"error",
{
"args": "none"
}
],
"block-spacing": "error",
"func-call-spacing": [
"error",
"never"
],
"key-spacing": "error",
"no-tabs": "error",
"no-whitespace-before-property": "error",
"semi": [
"error",
"always"
],
"space-before-blocks": "error"
}
}
}

Sorry, the diff of this file is not supported yet

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