Updating NPM dependencies
This commit is contained in:
56
node_modules/jest-jasmine2/build/jasmineAsyncInstall.js
generated
vendored
56
node_modules/jest-jasmine2/build/jasmineAsyncInstall.js
generated
vendored
@@ -11,7 +11,7 @@ var _isGeneratorFn = _interopRequireDefault(require('is-generator-fn'));
|
||||
|
||||
var _throat = _interopRequireDefault(require('throat'));
|
||||
|
||||
var _isError3 = _interopRequireDefault(require('./isError'));
|
||||
var _isError = _interopRequireDefault(require('./isError'));
|
||||
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {default: obj};
|
||||
@@ -25,9 +25,14 @@ function isPromise(obj) {
|
||||
return obj && typeof obj.then === 'function';
|
||||
}
|
||||
|
||||
const doneFnNoop = () => {};
|
||||
|
||||
doneFnNoop.fail = () => {};
|
||||
|
||||
function promisifyLifeCycleFunction(originalFn, env) {
|
||||
return function(fn, timeout) {
|
||||
return function (fn, timeout) {
|
||||
if (!fn) {
|
||||
// @ts-expect-error: missing fn arg is handled by originalFn
|
||||
return originalFn.call(env);
|
||||
}
|
||||
|
||||
@@ -46,17 +51,15 @@ function promisifyLifeCycleFunction(originalFn, env) {
|
||||
extraError.stack = extraError.stack; // We make *all* functions async and run `done` right away if they
|
||||
// didn't return a promise.
|
||||
|
||||
const asyncJestLifecycle = function asyncJestLifecycle(done) {
|
||||
const asyncJestLifecycle = function (done) {
|
||||
const wrappedFn = (0, _isGeneratorFn.default)(fn)
|
||||
? _co.default.wrap(fn)
|
||||
: fn;
|
||||
const returnValue = wrappedFn.call({});
|
||||
const returnValue = wrappedFn.call({}, doneFnNoop);
|
||||
|
||||
if (isPromise(returnValue)) {
|
||||
returnValue.then(done.bind(null, null), error => {
|
||||
const _isError = (0, _isError3.default)(error),
|
||||
checkIsError = _isError.isError,
|
||||
message = _isError.message;
|
||||
const {isError: checkIsError, message} = (0, _isError.default)(error);
|
||||
|
||||
if (message) {
|
||||
extraError.message = message;
|
||||
@@ -75,8 +78,9 @@ function promisifyLifeCycleFunction(originalFn, env) {
|
||||
// when the return value is neither a Promise nor `undefined`
|
||||
|
||||
function promisifyIt(originalFn, env, jasmine) {
|
||||
return function(specName, fn, timeout) {
|
||||
return function (specName, fn, timeout) {
|
||||
if (!fn) {
|
||||
// @ts-expect-error: missing fn arg is handled by originalFn
|
||||
const spec = originalFn.call(env, specName);
|
||||
spec.pend('not implemented');
|
||||
return spec;
|
||||
@@ -95,17 +99,15 @@ function promisifyIt(originalFn, env, jasmine) {
|
||||
|
||||
extraError.stack = extraError.stack;
|
||||
|
||||
const asyncJestTest = function asyncJestTest(done) {
|
||||
const asyncJestTest = function (done) {
|
||||
const wrappedFn = (0, _isGeneratorFn.default)(fn)
|
||||
? _co.default.wrap(fn)
|
||||
: fn;
|
||||
const returnValue = wrappedFn.call({});
|
||||
const returnValue = wrappedFn.call({}, doneFnNoop);
|
||||
|
||||
if (isPromise(returnValue)) {
|
||||
returnValue.then(done.bind(null, null), error => {
|
||||
const _isError2 = (0, _isError3.default)(error),
|
||||
checkIsError = _isError2.isError,
|
||||
message = _isError2.message;
|
||||
const {isError: checkIsError, message} = (0, _isError.default)(error);
|
||||
|
||||
if (message) {
|
||||
extraError.message = message;
|
||||
@@ -134,17 +136,13 @@ function promisifyIt(originalFn, env, jasmine) {
|
||||
}
|
||||
|
||||
function makeConcurrent(originalFn, env, mutex) {
|
||||
return function(specName, fn, timeout) {
|
||||
if (
|
||||
env != null &&
|
||||
!env.specFilter({
|
||||
getFullName: () => specName || ''
|
||||
})
|
||||
) {
|
||||
return originalFn.call(env, specName, () => Promise.resolve(), timeout);
|
||||
}
|
||||
const concurrentFn = function (specName, fn, timeout) {
|
||||
let promise = Promise.resolve();
|
||||
const spec = originalFn.call(env, specName, () => promise, timeout);
|
||||
|
||||
let promise;
|
||||
if (env != null && !env.specFilter(spec)) {
|
||||
return spec;
|
||||
}
|
||||
|
||||
try {
|
||||
promise = mutex(() => {
|
||||
@@ -155,15 +153,19 @@ function makeConcurrent(originalFn, env, mutex) {
|
||||
}
|
||||
|
||||
throw new Error(
|
||||
`Jest: concurrent test "${specName}" must return a Promise.`
|
||||
`Jest: concurrent test "${spec.getFullName()}" must return a Promise.`
|
||||
);
|
||||
});
|
||||
} catch (error) {
|
||||
return originalFn.call(env, specName, () => Promise.reject(error));
|
||||
promise = Promise.reject(error);
|
||||
}
|
||||
|
||||
return originalFn.call(env, specName, () => promise, timeout);
|
||||
};
|
||||
return spec;
|
||||
}; // each is binded after the function is made concurrent, so for now it is made noop
|
||||
|
||||
concurrentFn.each = () => () => {};
|
||||
|
||||
return concurrentFn;
|
||||
}
|
||||
|
||||
function jasmineAsyncInstall(globalConfig, global) {
|
||||
|
||||
Reference in New Issue
Block a user