Socket
Socket
Sign inDemoInstall

jasmine

Package Overview
Dependencies
22
Maintainers
4
Versions
53
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 5.0.0-alpha.1 to 5.0.0-beta.0

7

bin/worker.js

@@ -5,3 +5,6 @@ const cluster = require('node:cluster');

const loader = new Loader();
new ParallelWorker({loader, clusterWorker: cluster.worker});
new ParallelWorker({
loader: new Loader(),
process,
clusterWorker: cluster.worker
});
const path = require('path');
const fs = require('fs');
const os = require('os');
const unWindows = require('./unWindows');

@@ -117,5 +118,11 @@

} else if (arg.match("^--parallel=(.*)")) {
numWorkers = parseFloat(arg.match("^--parallel=(.*)")[1]);
if (isNaN(numWorkers) || numWorkers < 2 || numWorkers !== Math.floor(numWorkers)) {
usageErrors.push('Argument to --parallel= must be an integer greater than 1');
const w = arg.match("^--parallel=(.*)")[1];
if (w === 'auto') {
// A reasonable default in most situations
numWorkers = os.cpus().length -1;
} else {
numWorkers = parseFloat(w);
if (isNaN(numWorkers) || numWorkers < 2 || numWorkers !== Math.floor(numWorkers)) {
usageErrors.push('Argument to --parallel= must be an integer greater than 1');
}
}

@@ -295,2 +302,3 @@ } else if (arg === '--') {

print('%s\tRun in parallel with N workers', lPad('--parallel=N', 18));
print('%s\tRun in parallel with an automatically chosen number of workers', lPad('--parallel=auto', 18));
print('%s\tturn off color in spec output', lPad('--no-color', 18));

@@ -297,0 +305,0 @@ print('%s\tforce turn on color in spec output', lPad('--color', 18));

@@ -24,2 +24,13 @@ const path = require('path');

*/
/**
* Whether to create the globals (describe, it, etc) that make up Jasmine's
* spec-writing interface. If it is set to false, the spec-writing interface
* can be accessed in workers via jasmine-core's `noGlobals` method, e.g.:
*
* `const {describe, it, expect, jasmine} = require('jasmine-core').noGlobals();`
*
* @name ParallelRunnerOptions#globals
* @type (boolean | undefined)
* @default true
*/

@@ -177,3 +188,3 @@ /**

});
if (this.exitOnCompletion) {

@@ -207,2 +218,3 @@ if (this.hasUnhandledErrors_) {

filter: filterString,
globals: this.globals_,
env: this.envConfig_,

@@ -271,3 +283,2 @@ };

await Promise.all(workerPromises);
await new Promise(resolve => this.cluster_.disconnect(resolve));
}

@@ -317,2 +328,12 @@

case 'uncaughtException':
this.addTopLevelError_('lateError',
'Uncaught exception in worker process', msg.error);
break;
case 'unhandledRejection':
this.addTopLevelError_('lateError',
'Unhandled promise rejection in worker process', msg.error);
break;
case 'reporterEvent':

@@ -417,2 +438,15 @@ this.handleReporterEvent_(msg.eventName, msg.payload);

}
addTopLevelError_(type, msgPrefix, serializedError) {
// Match how jasmine-core reports these in non-parallel situations
this.executionState_.failedExpectations.push({
actual: '',
expected: '',
globalErrorType: 'lateError',
matcherName: '',
message: `${msgPrefix}: ${serializedError.message}`,
passed: false,
stack: serializedError.stack,
});
}
}

@@ -419,0 +453,0 @@

@@ -22,2 +22,25 @@ const ConsoleSpecFilter = require("./filters/console_spec_filter");

});
// Install global error handlers now, before jasmine-core is booted.
// That allows jasmine-core to override them with its own more specific
// handling. These handlers will take care of errors that occur in between
// spec files.
for (const errorType of ['uncaughtException', 'unhandledRejection']) {
options.process.on(errorType, error => {
if (this.clusterWorker_.isConnected()) {
this.clusterWorker_.send({
type: errorType,
error: serializeError(error)
});
} else {
// Don't try to report errors after disconnect. If we do, it'll cause
// another unhandled exception. The resulting error-and-reporting loop
// can keep the runner from finishing.
console.error(`${errorType} in Jasmine worker process after disconnect:`, error);
console.error('This error cannot be reported properly because it ' +
'happened after the worker process was disconnected.'
);
}
});
}
}

@@ -29,5 +52,11 @@

.then(core => {
// TODO also support globals: false
const bootedCore = core.boot(core);
const env = bootedCore.getEnv();
let env;
if (options.globals === false) {
env = core.noGlobals().jasmine.getEnv();
} else {
const bootedCore = core.boot(core);
env = bootedCore.getEnv();
}
env.addReporter(forwardingReporter(this.clusterWorker_));

@@ -34,0 +63,0 @@ env.addReporter({

@@ -44,2 +44,3 @@ const path = require('path');

options.globalSetupOrTeardownRunner || new GlobalSetupOrTeardownRunner();
this.globals_ = options.globals;
}

@@ -46,0 +47,0 @@

@@ -13,3 +13,3 @@ {

"license": "MIT",
"version": "5.0.0-alpha.1",
"version": "5.0.0-beta.0",
"repository": {

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

"dependencies": {
"glob": "^9.3.1",
"jasmine-core": "~5.0.0-alpha.1"
"glob": "^10.2.2",
"jasmine-core": "~5.0.0-beta.0"
},

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

@@ -53,3 +53,3 @@ [![Build Status](https://circleci.com/gh/jasmine/jasmine-npm.svg?style=shield)](https://circleci.com/gh/jasmine/jasmine-npm)

Jasmine supports Node 18 and 16.14-16.19.
Jasmine supports Node 18 and 20.

@@ -56,0 +56,0 @@ ## Support

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