jasmine
Advanced tools
Comparing version 3.6.1 to 3.6.2
#!/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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
8
31418
16
809
+ Addedglob@^7.1.6
+ Addedbalanced-match@1.0.2(transitive)
+ Addedbrace-expansion@1.1.11(transitive)
+ Addedconcat-map@0.0.1(transitive)
+ Addedfs.realpath@1.0.0(transitive)
+ Addedglob@7.2.3(transitive)
+ Addedinflight@1.0.6(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedminimatch@3.1.2(transitive)
+ Addedonce@1.4.0(transitive)
+ Addedpath-is-absolute@1.0.1(transitive)
+ Addedwrappy@1.0.2(transitive)
- Removedfast-glob@^2.2.6
- Removed@mrmlnc/readdir-enhanced@2.2.1(transitive)
- Removed@nodelib/fs.stat@1.1.3(transitive)
- Removedarr-diff@4.0.0(transitive)
- Removedarr-flatten@1.1.0(transitive)
- Removedarr-union@3.1.0(transitive)
- Removedarray-unique@0.3.2(transitive)
- Removedassign-symbols@1.0.0(transitive)
- Removedatob@2.1.2(transitive)
- Removedbase@0.11.2(transitive)
- Removedbraces@2.3.2(transitive)
- Removedcache-base@1.0.1(transitive)
- Removedcall-me-maybe@1.0.2(transitive)
- Removedclass-utils@0.3.6(transitive)
- Removedcollection-visit@1.0.0(transitive)
- Removedcomponent-emitter@1.3.1(transitive)
- Removedcopy-descriptor@0.1.1(transitive)
- Removeddebug@2.6.9(transitive)
- Removeddecode-uri-component@0.2.2(transitive)
- Removeddefine-property@0.2.51.0.02.0.2(transitive)
- Removedexpand-brackets@2.1.4(transitive)
- Removedextend-shallow@2.0.13.0.2(transitive)
- Removedextglob@2.0.4(transitive)
- Removedfast-glob@2.2.7(transitive)
- Removedfill-range@4.0.0(transitive)
- Removedfor-in@1.0.2(transitive)
- Removedfragment-cache@0.2.1(transitive)
- Removedfunction-bind@1.1.2(transitive)
- Removedget-value@2.0.6(transitive)
- Removedglob-parent@3.1.0(transitive)
- Removedglob-to-regexp@0.3.0(transitive)
- Removedhas-value@0.3.11.0.0(transitive)
- Removedhas-values@0.1.41.0.0(transitive)
- Removedhasown@2.0.2(transitive)
- Removedis-accessor-descriptor@1.0.1(transitive)
- Removedis-buffer@1.1.6(transitive)
- Removedis-data-descriptor@1.0.1(transitive)
- Removedis-descriptor@0.1.71.0.3(transitive)
- Removedis-extendable@0.1.11.0.1(transitive)
- Removedis-extglob@2.1.1(transitive)
- Removedis-glob@3.1.04.0.3(transitive)
- Removedis-number@3.0.0(transitive)
- Removedis-plain-object@2.0.4(transitive)
- Removedis-windows@1.0.2(transitive)
- Removedisarray@1.0.0(transitive)
- Removedisobject@2.1.03.0.1(transitive)
- Removedkind-of@3.2.24.0.06.0.3(transitive)
- Removedmap-cache@0.2.2(transitive)
- Removedmap-visit@1.0.0(transitive)
- Removedmerge2@1.4.1(transitive)
- Removedmicromatch@3.1.10(transitive)
- Removedmixin-deep@1.3.2(transitive)
- Removedms@2.0.0(transitive)
- Removednanomatch@1.2.13(transitive)
- Removedobject-copy@0.1.0(transitive)
- Removedobject-visit@1.0.1(transitive)
- Removedobject.pick@1.3.0(transitive)
- Removedpascalcase@0.1.1(transitive)
- Removedpath-dirname@1.0.2(transitive)
- Removedposix-character-classes@0.1.1(transitive)
- Removedregex-not@1.0.2(transitive)
- Removedrepeat-element@1.1.4(transitive)
- Removedrepeat-string@1.6.1(transitive)
- Removedresolve-url@0.2.1(transitive)
- Removedret@0.1.15(transitive)
- Removedsafe-regex@1.1.0(transitive)
- Removedset-value@2.0.1(transitive)
- Removedsnapdragon@0.8.2(transitive)
- Removedsnapdragon-node@2.1.1(transitive)
- Removedsnapdragon-util@3.0.1(transitive)
- Removedsource-map@0.5.7(transitive)
- Removedsource-map-resolve@0.5.3(transitive)
- Removedsource-map-url@0.4.1(transitive)
- Removedsplit-string@3.1.0(transitive)
- Removedstatic-extend@0.1.2(transitive)
- Removedto-object-path@0.3.0(transitive)
- Removedto-regex@3.0.2(transitive)
- Removedto-regex-range@2.1.1(transitive)
- Removedunion-value@1.0.1(transitive)
- Removedunset-value@1.0.0(transitive)
- Removedurix@0.1.0(transitive)
- Removeduse@3.1.1(transitive)