Allow use without creating globals

* Fixes #1235
This commit is contained in:
Steve Gravrock
2021-11-29 18:49:05 -08:00
parent 5942654856
commit 42e6c45efa
15 changed files with 88 additions and 37 deletions

View File

@@ -1,6 +1,42 @@
module.exports = require("./jasmine-core/jasmine.js");
/**
* Note: Only available on Node.
* @module jasmine-core
*/
const jasmineRequire = require('./jasmine-core/jasmine.js');
module.exports = jasmineRequire;
/**
* Boots a copy of Jasmine and returns an object as described in {@link jasmine}.
* @type {function}
* @return {jasmine}
*/
module.exports.boot = require('./jasmine-core/node_boot.js');
/**
* Boots a copy of Jasmine and returns an object containing the properties
* that would normally be added to the global object. If noGlobals is called
* multiple times, the same object is returned every time.
*
* Do not call boot() if you also call noGlobals().
*
* @example
* const {describe, beforeEach, it, expect, jasmine} = require('jasmine-core').noGlobals();
*/
module.exports.noGlobals = (function() {
let jasmineInterface;
return function bootWithoutGlobals() {
if (!jasmineInterface) {
const jasmine = jasmineRequire.core(jasmineRequire);
const env = jasmine.getEnv({ suppressLoadErrors: true });
jasmineInterface = jasmineRequire.interface(jasmine, env);
}
return jasmineInterface;
};
}());
var path = require('path'),
fs = require('fs');

View File

@@ -3482,6 +3482,8 @@ getJasmineRequireObj().CompleteOnFirstErrorSkipPolicy = function(j$) {
}
CompleteOnFirstErrorSkipPolicy.prototype.skipTo = function(lastRanFnIx) {
let i;
for (
i = lastRanFnIx + 1;
i < this.queueableFns_.length && this.shouldSkip_(i);