Comparing version 3.5.0 to 3.6.0
#!/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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
43267
24
873
12
1
+ Addedfast-glob@^2.2.6
+ Added@mrmlnc/readdir-enhanced@2.2.1(transitive)
+ Added@nodelib/fs.stat@1.1.3(transitive)
+ Addedarr-diff@4.0.0(transitive)
+ Addedarr-flatten@1.1.0(transitive)
+ Addedarr-union@3.1.0(transitive)
+ Addedarray-unique@0.3.2(transitive)
+ Addedassign-symbols@1.0.0(transitive)
+ Addedatob@2.1.2(transitive)
+ Addedbase@0.11.2(transitive)
+ Addedbraces@2.3.2(transitive)
+ Addedcache-base@1.0.1(transitive)
+ Addedcall-me-maybe@1.0.2(transitive)
+ Addedclass-utils@0.3.6(transitive)
+ Addedcollection-visit@1.0.0(transitive)
+ Addedcomponent-emitter@1.3.1(transitive)
+ Addedcopy-descriptor@0.1.1(transitive)
+ Addeddebug@2.6.9(transitive)
+ Addeddecode-uri-component@0.2.2(transitive)
+ Addeddefine-property@0.2.51.0.02.0.2(transitive)
+ Addedexpand-brackets@2.1.4(transitive)
+ Addedextend-shallow@2.0.13.0.2(transitive)
+ Addedextglob@2.0.4(transitive)
+ Addedfast-glob@2.2.7(transitive)
+ Addedfill-range@4.0.0(transitive)
+ Addedfor-in@1.0.2(transitive)
+ Addedfragment-cache@0.2.1(transitive)
+ Addedfunction-bind@1.1.2(transitive)
+ Addedget-value@2.0.6(transitive)
+ Addedglob-parent@3.1.0(transitive)
+ Addedglob-to-regexp@0.3.0(transitive)
+ Addedhas-value@0.3.11.0.0(transitive)
+ Addedhas-values@0.1.41.0.0(transitive)
+ Addedhasown@2.0.2(transitive)
+ Addedis-accessor-descriptor@1.0.1(transitive)
+ Addedis-buffer@1.1.6(transitive)
+ Addedis-data-descriptor@1.0.1(transitive)
+ Addedis-descriptor@0.1.71.0.3(transitive)
+ Addedis-extendable@0.1.11.0.1(transitive)
+ Addedis-extglob@2.1.1(transitive)
+ Addedis-glob@3.1.04.0.3(transitive)
+ Addedis-number@3.0.0(transitive)
+ Addedis-plain-object@2.0.4(transitive)
+ Addedis-windows@1.0.2(transitive)
+ Addedisarray@1.0.0(transitive)
+ Addedisobject@2.1.03.0.1(transitive)
+ Addedjasmine-core@3.6.0(transitive)
+ Addedkind-of@3.2.24.0.06.0.3(transitive)
+ Addedmap-cache@0.2.2(transitive)
+ Addedmap-visit@1.0.0(transitive)
+ Addedmerge2@1.4.1(transitive)
+ Addedmicromatch@3.1.10(transitive)
+ Addedmixin-deep@1.3.2(transitive)
+ Addedms@2.0.0(transitive)
+ Addednanomatch@1.2.13(transitive)
+ Addedobject-copy@0.1.0(transitive)
+ Addedobject-visit@1.0.1(transitive)
+ Addedobject.pick@1.3.0(transitive)
+ Addedpascalcase@0.1.1(transitive)
+ Addedpath-dirname@1.0.2(transitive)
+ Addedposix-character-classes@0.1.1(transitive)
+ Addedregex-not@1.0.2(transitive)
+ Addedrepeat-element@1.1.4(transitive)
+ Addedrepeat-string@1.6.1(transitive)
+ Addedresolve-url@0.2.1(transitive)
+ Addedret@0.1.15(transitive)
+ Addedsafe-regex@1.1.0(transitive)
+ Addedset-value@2.0.1(transitive)
+ Addedsnapdragon@0.8.2(transitive)
+ Addedsnapdragon-node@2.1.1(transitive)
+ Addedsnapdragon-util@3.0.1(transitive)
+ Addedsource-map@0.5.7(transitive)
+ Addedsource-map-resolve@0.5.3(transitive)
+ Addedsource-map-url@0.4.1(transitive)
+ Addedsplit-string@3.1.0(transitive)
+ Addedstatic-extend@0.1.2(transitive)
+ Addedto-object-path@0.3.0(transitive)
+ Addedto-regex@3.0.2(transitive)
+ Addedto-regex-range@2.1.1(transitive)
+ Addedunion-value@1.0.1(transitive)
+ Addedunset-value@1.0.0(transitive)
+ Addedurix@0.1.0(transitive)
+ Addeduse@3.1.1(transitive)
- Removedglob@^7.1.4
- Removedbalanced-match@1.0.2(transitive)
- Removedbrace-expansion@1.1.11(transitive)
- Removedconcat-map@0.0.1(transitive)
- Removedfs.realpath@1.0.0(transitive)
- Removedglob@7.2.3(transitive)
- Removedinflight@1.0.6(transitive)
- Removedinherits@2.0.4(transitive)
- Removedjasmine-core@3.5.0(transitive)
- Removedminimatch@3.1.2(transitive)
- Removedonce@1.4.0(transitive)
- Removedpath-is-absolute@1.0.1(transitive)
- Removedwrappy@1.0.2(transitive)
Updatedjasmine-core@~3.6.0