Updating NPM dependencies
This commit is contained in:
256
node_modules/jest-jasmine2/build/jasmine/Env.js
generated
vendored
256
node_modules/jest-jasmine2/build/jasmine/Env.js
generated
vendored
@@ -13,56 +13,20 @@ var _jestMessageUtil = require('jest-message-util');
|
||||
|
||||
var _jestUtil = require('jest-util');
|
||||
|
||||
var _queueRunner = _interopRequireDefault(require('../queueRunner'));
|
||||
|
||||
var _treeProcessor = _interopRequireDefault(require('../treeProcessor'));
|
||||
|
||||
var _isError = _interopRequireDefault(require('../isError'));
|
||||
|
||||
var _assertionErrorMessage = _interopRequireDefault(
|
||||
require('../assertionErrorMessage')
|
||||
);
|
||||
|
||||
var _isError = _interopRequireDefault(require('../isError'));
|
||||
|
||||
var _queueRunner = _interopRequireDefault(require('../queueRunner'));
|
||||
|
||||
var _treeProcessor = _interopRequireDefault(require('../treeProcessor'));
|
||||
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {default: obj};
|
||||
}
|
||||
|
||||
var Symbol = global['jest-symbol-do-not-touch'] || global.Symbol;
|
||||
var Symbol = global['jest-symbol-do-not-touch'] || global.Symbol;
|
||||
var Promise = global[Symbol.for('jest-native-promise')] || global.Promise;
|
||||
|
||||
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
||||
try {
|
||||
var info = gen[key](arg);
|
||||
var value = info.value;
|
||||
} catch (error) {
|
||||
reject(error);
|
||||
return;
|
||||
}
|
||||
if (info.done) {
|
||||
resolve(value);
|
||||
} else {
|
||||
Promise.resolve(value).then(_next, _throw);
|
||||
}
|
||||
}
|
||||
|
||||
function _asyncToGenerator(fn) {
|
||||
return function() {
|
||||
var self = this,
|
||||
args = arguments;
|
||||
return new Promise(function(resolve, reject) {
|
||||
var gen = fn.apply(self, args);
|
||||
function _next(value) {
|
||||
asyncGeneratorStep(gen, resolve, reject, _next, _throw, 'next', value);
|
||||
}
|
||||
function _throw(err) {
|
||||
asyncGeneratorStep(gen, resolve, reject, _next, _throw, 'throw', err);
|
||||
}
|
||||
_next(undefined);
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
function _defineProperty(obj, key, value) {
|
||||
if (key in obj) {
|
||||
Object.defineProperty(obj, key, {
|
||||
@@ -152,11 +116,11 @@ function _default(j$) {
|
||||
let nextSpecId = 0;
|
||||
let nextSuiteId = 0;
|
||||
|
||||
const getNextSpecId = function getNextSpecId() {
|
||||
const getNextSpecId = function () {
|
||||
return 'spec' + nextSpecId++;
|
||||
};
|
||||
|
||||
const getNextSuiteId = function getNextSuiteId() {
|
||||
const getNextSuiteId = function () {
|
||||
return 'suite' + nextSuiteId++;
|
||||
};
|
||||
|
||||
@@ -170,11 +134,11 @@ function _default(j$) {
|
||||
});
|
||||
let currentDeclarationSuite = topSuite;
|
||||
|
||||
const currentSuite = function currentSuite() {
|
||||
const currentSuite = function () {
|
||||
return currentlyExecutingSuites[currentlyExecutingSuites.length - 1];
|
||||
};
|
||||
|
||||
const currentRunnable = function currentRunnable() {
|
||||
const currentRunnable = function () {
|
||||
return currentSpec || currentSuite();
|
||||
};
|
||||
|
||||
@@ -187,29 +151,24 @@ function _default(j$) {
|
||||
'specDone'
|
||||
]);
|
||||
|
||||
this.specFilter = function() {
|
||||
this.specFilter = function () {
|
||||
return true;
|
||||
};
|
||||
|
||||
const defaultResourcesForRunnable = function defaultResourcesForRunnable(
|
||||
id,
|
||||
_parentRunnableId
|
||||
) {
|
||||
const defaultResourcesForRunnable = function (id, _parentRunnableId) {
|
||||
const resources = {
|
||||
spies: []
|
||||
};
|
||||
runnableResources[id] = resources;
|
||||
};
|
||||
|
||||
const clearResourcesForRunnable = function clearResourcesForRunnable(
|
||||
id
|
||||
) {
|
||||
const clearResourcesForRunnable = function (id) {
|
||||
spyRegistry.clearSpies();
|
||||
delete runnableResources[id];
|
||||
};
|
||||
|
||||
const beforeAndAfterFns = function beforeAndAfterFns(suite) {
|
||||
return function() {
|
||||
const beforeAndAfterFns = function (suite) {
|
||||
return function () {
|
||||
let afters = [];
|
||||
let befores = [];
|
||||
|
||||
@@ -226,7 +185,7 @@ function _default(j$) {
|
||||
};
|
||||
};
|
||||
|
||||
const getSpecName = function getSpecName(spec, suite) {
|
||||
const getSpecName = function (spec, suite) {
|
||||
const fullName = [spec.description];
|
||||
const suiteFullName = suite.getFullName();
|
||||
|
||||
@@ -237,32 +196,32 @@ function _default(j$) {
|
||||
return fullName.join(' ');
|
||||
};
|
||||
|
||||
this.catchExceptions = function(value) {
|
||||
this.catchExceptions = function (value) {
|
||||
catchExceptions = !!value;
|
||||
return catchExceptions;
|
||||
};
|
||||
|
||||
this.catchingExceptions = function() {
|
||||
this.catchingExceptions = function () {
|
||||
return catchExceptions;
|
||||
};
|
||||
|
||||
this.throwOnExpectationFailure = function(value) {
|
||||
this.throwOnExpectationFailure = function (value) {
|
||||
throwOnExpectationFailure = !!value;
|
||||
};
|
||||
|
||||
this.throwingExpectationFailures = function() {
|
||||
this.throwingExpectationFailures = function () {
|
||||
return throwOnExpectationFailure;
|
||||
};
|
||||
|
||||
this.randomizeTests = function(value) {
|
||||
this.randomizeTests = function (value) {
|
||||
random = !!value;
|
||||
};
|
||||
|
||||
this.randomTests = function() {
|
||||
this.randomTests = function () {
|
||||
return random;
|
||||
};
|
||||
|
||||
this.seed = function(value) {
|
||||
this.seed = function (value) {
|
||||
if (value) {
|
||||
seed = value;
|
||||
}
|
||||
@@ -277,7 +236,7 @@ function _default(j$) {
|
||||
return (0, _queueRunner.default)(options);
|
||||
};
|
||||
|
||||
this.topSuite = function() {
|
||||
this.topSuite = function () {
|
||||
return topSuite;
|
||||
};
|
||||
|
||||
@@ -294,7 +253,7 @@ function _default(j$) {
|
||||
let oldListenersException;
|
||||
let oldListenersRejection;
|
||||
|
||||
const executionSetup = function executionSetup() {
|
||||
const executionSetup = function () {
|
||||
// Need to ensure we are the only ones handling these exceptions.
|
||||
oldListenersException = process
|
||||
.listeners('uncaughtException')
|
||||
@@ -308,7 +267,7 @@ function _default(j$) {
|
||||
j$.process.on('unhandledRejection', uncaught);
|
||||
};
|
||||
|
||||
const executionTeardown = function executionTeardown() {
|
||||
const executionTeardown = function () {
|
||||
j$.process.removeListener('uncaughtException', uncaught);
|
||||
j$.process.removeListener('unhandledRejection', uncaught); // restore previous exception handlers
|
||||
|
||||
@@ -320,84 +279,73 @@ function _default(j$) {
|
||||
});
|
||||
};
|
||||
|
||||
this.execute =
|
||||
/*#__PURE__*/
|
||||
(function() {
|
||||
var _ref = _asyncToGenerator(function*(
|
||||
runnablesToRun,
|
||||
suiteTree = topSuite
|
||||
) {
|
||||
if (!runnablesToRun) {
|
||||
if (focusedRunnables.length) {
|
||||
runnablesToRun = focusedRunnables;
|
||||
} else {
|
||||
runnablesToRun = [suiteTree.id];
|
||||
}
|
||||
this.execute = async function (runnablesToRun, suiteTree = topSuite) {
|
||||
if (!runnablesToRun) {
|
||||
if (focusedRunnables.length) {
|
||||
runnablesToRun = focusedRunnables;
|
||||
} else {
|
||||
runnablesToRun = [suiteTree.id];
|
||||
}
|
||||
}
|
||||
|
||||
if (currentlyExecutingSuites.length === 0) {
|
||||
executionSetup();
|
||||
}
|
||||
|
||||
const lastDeclarationSuite = currentDeclarationSuite;
|
||||
await (0, _treeProcessor.default)({
|
||||
nodeComplete(suite) {
|
||||
if (!suite.disabled) {
|
||||
clearResourcesForRunnable(suite.id);
|
||||
}
|
||||
|
||||
if (currentlyExecutingSuites.length === 0) {
|
||||
executionSetup();
|
||||
currentlyExecutingSuites.pop();
|
||||
|
||||
if (suite === topSuite) {
|
||||
reporter.jasmineDone({
|
||||
failedExpectations: topSuite.result.failedExpectations
|
||||
});
|
||||
} else {
|
||||
reporter.suiteDone(suite.getResult());
|
||||
}
|
||||
},
|
||||
|
||||
const lastDeclarationSuite = currentDeclarationSuite;
|
||||
yield (0, _treeProcessor.default)({
|
||||
nodeComplete(suite) {
|
||||
if (!suite.disabled) {
|
||||
clearResourcesForRunnable(suite.id);
|
||||
}
|
||||
nodeStart(suite) {
|
||||
currentlyExecutingSuites.push(suite);
|
||||
defaultResourcesForRunnable(
|
||||
suite.id,
|
||||
suite.parentSuite && suite.parentSuite.id
|
||||
);
|
||||
|
||||
currentlyExecutingSuites.pop();
|
||||
|
||||
if (suite === topSuite) {
|
||||
reporter.jasmineDone({
|
||||
failedExpectations: topSuite.result.failedExpectations
|
||||
});
|
||||
} else {
|
||||
reporter.suiteDone(suite.getResult());
|
||||
}
|
||||
},
|
||||
|
||||
nodeStart(suite) {
|
||||
currentlyExecutingSuites.push(suite);
|
||||
defaultResourcesForRunnable(
|
||||
suite.id,
|
||||
suite.parentSuite && suite.parentSuite.id
|
||||
);
|
||||
|
||||
if (suite === topSuite) {
|
||||
reporter.jasmineStarted({
|
||||
totalSpecsDefined
|
||||
});
|
||||
} else {
|
||||
reporter.suiteStarted(suite.result);
|
||||
}
|
||||
},
|
||||
|
||||
queueRunnerFactory,
|
||||
runnableIds: runnablesToRun,
|
||||
tree: suiteTree
|
||||
});
|
||||
currentDeclarationSuite = lastDeclarationSuite;
|
||||
|
||||
if (currentlyExecutingSuites.length === 0) {
|
||||
executionTeardown();
|
||||
if (suite === topSuite) {
|
||||
reporter.jasmineStarted({
|
||||
totalSpecsDefined
|
||||
});
|
||||
} else {
|
||||
reporter.suiteStarted(suite.result);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
return function(_x) {
|
||||
return _ref.apply(this, arguments);
|
||||
};
|
||||
})();
|
||||
queueRunnerFactory,
|
||||
runnableIds: runnablesToRun,
|
||||
tree: suiteTree
|
||||
});
|
||||
currentDeclarationSuite = lastDeclarationSuite;
|
||||
|
||||
this.addReporter = function(reporterToAdd) {
|
||||
if (currentlyExecutingSuites.length === 0) {
|
||||
executionTeardown();
|
||||
}
|
||||
};
|
||||
|
||||
this.addReporter = function (reporterToAdd) {
|
||||
reporter.addReporter(reporterToAdd);
|
||||
};
|
||||
|
||||
this.provideFallbackReporter = function(reporterToAdd) {
|
||||
this.provideFallbackReporter = function (reporterToAdd) {
|
||||
reporter.provideFallbackReporter(reporterToAdd);
|
||||
};
|
||||
|
||||
this.clearReporters = function() {
|
||||
this.clearReporters = function () {
|
||||
reporter.clearReporters();
|
||||
};
|
||||
|
||||
@@ -413,15 +361,15 @@ function _default(j$) {
|
||||
}
|
||||
});
|
||||
|
||||
this.allowRespy = function(allow) {
|
||||
this.allowRespy = function (allow) {
|
||||
spyRegistry.allowRespy(allow);
|
||||
};
|
||||
|
||||
this.spyOn = function(...args) {
|
||||
this.spyOn = function (...args) {
|
||||
return spyRegistry.spyOn.apply(spyRegistry, args);
|
||||
};
|
||||
|
||||
const suiteFactory = function suiteFactory(description) {
|
||||
const suiteFactory = function (description) {
|
||||
const suite = new j$.Suite({
|
||||
id: getNextSuiteId(),
|
||||
description,
|
||||
@@ -435,7 +383,7 @@ function _default(j$) {
|
||||
return suite;
|
||||
};
|
||||
|
||||
this.describe = function(description, specDefinitions) {
|
||||
this.describe = function (description, specDefinitions) {
|
||||
const suite = suiteFactory(description);
|
||||
|
||||
if (specDefinitions === undefined) {
|
||||
@@ -459,7 +407,7 @@ function _default(j$) {
|
||||
}
|
||||
|
||||
if (currentDeclarationSuite.markedTodo) {
|
||||
// @ts-ignore TODO Possible error: Suite does not have todo method
|
||||
// @ts-expect-error TODO Possible error: Suite does not have todo method
|
||||
suite.todo();
|
||||
}
|
||||
|
||||
@@ -467,7 +415,7 @@ function _default(j$) {
|
||||
return suite;
|
||||
};
|
||||
|
||||
this.xdescribe = function(description, specDefinitions) {
|
||||
this.xdescribe = function (description, specDefinitions) {
|
||||
const suite = suiteFactory(description);
|
||||
suite.pend();
|
||||
addSpecsToSuite(suite, specDefinitions);
|
||||
@@ -476,7 +424,7 @@ function _default(j$) {
|
||||
|
||||
const focusedRunnables = [];
|
||||
|
||||
this.fdescribe = function(description, specDefinitions) {
|
||||
this.fdescribe = function (description, specDefinitions) {
|
||||
const suite = suiteFactory(description);
|
||||
suite.isFocused = true;
|
||||
focusedRunnables.push(suite.id);
|
||||
@@ -490,7 +438,7 @@ function _default(j$) {
|
||||
parentSuite.addChild(suite);
|
||||
currentDeclarationSuite = suite;
|
||||
let declarationError = undefined;
|
||||
let describeReturnValue = undefined;
|
||||
let describeReturnValue;
|
||||
|
||||
try {
|
||||
describeReturnValue = specDefinitions.call(suite);
|
||||
@@ -622,7 +570,7 @@ function _default(j$) {
|
||||
}
|
||||
};
|
||||
|
||||
this.it = function(description, fn, timeout) {
|
||||
this.it = function (description, fn, timeout) {
|
||||
if (typeof description !== 'string') {
|
||||
throw new Error(
|
||||
`Invalid first argument, ${description}. It must be a string.`
|
||||
@@ -655,11 +603,7 @@ function _default(j$) {
|
||||
|
||||
if (currentSpec !== null) {
|
||||
throw new Error(
|
||||
'Tests cannot be nested. Test `' +
|
||||
spec.description +
|
||||
'` cannot run because it is nested within `' +
|
||||
currentSpec.description +
|
||||
'`.'
|
||||
`Tests cannot be nested. Test "${spec.description}" cannot run because it is nested within "${currentSpec.description}".`
|
||||
);
|
||||
}
|
||||
|
||||
@@ -667,19 +611,19 @@ function _default(j$) {
|
||||
return spec;
|
||||
};
|
||||
|
||||
this.xit = function(...args) {
|
||||
this.xit = function (...args) {
|
||||
const spec = this.it.apply(this, args);
|
||||
spec.pend('Temporarily disabled with xit');
|
||||
return spec;
|
||||
};
|
||||
|
||||
this.todo = function() {
|
||||
this.todo = function () {
|
||||
const description = arguments[0];
|
||||
|
||||
if (arguments.length !== 1 || typeof description !== 'string') {
|
||||
throw new _jestUtil.ErrorWithStack(
|
||||
'Todo must be called with only a description.',
|
||||
test.todo
|
||||
this.todo
|
||||
);
|
||||
}
|
||||
|
||||
@@ -693,7 +637,7 @@ function _default(j$) {
|
||||
return spec;
|
||||
};
|
||||
|
||||
this.fit = function(description, fn, timeout) {
|
||||
this.fit = function (description, fn, timeout) {
|
||||
const spec = specFactory(
|
||||
description,
|
||||
fn,
|
||||
@@ -706,7 +650,7 @@ function _default(j$) {
|
||||
return spec;
|
||||
};
|
||||
|
||||
this.beforeEach = function(beforeEachFunction, timeout) {
|
||||
this.beforeEach = function (beforeEachFunction, timeout) {
|
||||
currentDeclarationSuite.beforeEach({
|
||||
fn: beforeEachFunction,
|
||||
|
||||
@@ -716,7 +660,7 @@ function _default(j$) {
|
||||
});
|
||||
};
|
||||
|
||||
this.beforeAll = function(beforeAllFunction, timeout) {
|
||||
this.beforeAll = function (beforeAllFunction, timeout) {
|
||||
currentDeclarationSuite.beforeAll({
|
||||
fn: beforeAllFunction,
|
||||
|
||||
@@ -726,7 +670,7 @@ function _default(j$) {
|
||||
});
|
||||
};
|
||||
|
||||
this.afterEach = function(afterEachFunction, timeout) {
|
||||
this.afterEach = function (afterEachFunction, timeout) {
|
||||
currentDeclarationSuite.afterEach({
|
||||
fn: afterEachFunction,
|
||||
|
||||
@@ -736,7 +680,7 @@ function _default(j$) {
|
||||
});
|
||||
};
|
||||
|
||||
this.afterAll = function(afterAllFunction, timeout) {
|
||||
this.afterAll = function (afterAllFunction, timeout) {
|
||||
currentDeclarationSuite.afterAll({
|
||||
fn: afterAllFunction,
|
||||
|
||||
@@ -746,7 +690,7 @@ function _default(j$) {
|
||||
});
|
||||
};
|
||||
|
||||
this.pending = function(message) {
|
||||
this.pending = function (message) {
|
||||
let fullMessage = j$.Spec.pendingSpecExceptionMessage;
|
||||
|
||||
if (message) {
|
||||
@@ -756,7 +700,7 @@ function _default(j$) {
|
||||
throw fullMessage;
|
||||
};
|
||||
|
||||
this.fail = function(error) {
|
||||
this.fail = function (error) {
|
||||
let checkIsError;
|
||||
let message;
|
||||
|
||||
@@ -764,7 +708,7 @@ function _default(j$) {
|
||||
error instanceof _assert.AssertionError ||
|
||||
(error && error.name === _assert.AssertionError.name)
|
||||
) {
|
||||
checkIsError = false; // @ts-ignore TODO Possible error: j$.Spec does not have expand property
|
||||
checkIsError = false; // @ts-expect-error TODO Possible error: j$.Spec does not have expand property
|
||||
|
||||
message = (0, _assertionErrorMessage.default)(error, {
|
||||
expand: j$.Spec.expand
|
||||
|
||||
Reference in New Issue
Block a user