Updating NPM dependencies

This commit is contained in:
Drew Heavner
2020-11-11 13:30:52 +00:00
committed by GitHub
parent 7a6fb66c63
commit bd487ef324
9068 changed files with 1400893 additions and 587661 deletions

View File

@@ -23,4 +23,3 @@ declare class CallTracker {
constructor();
}
export default CallTracker;
//# sourceMappingURL=CallTracker.d.ts.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"CallTracker.d.ts","sourceRoot":"","sources":["../../src/jasmine/CallTracker.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAyBH,oBAAY,OAAO,GAAG;IACpB,MAAM,EAAE,OAAO,CAAC;IAChB,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF,cAAM,WAAW;IACf,KAAK,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IAClC,GAAG,EAAE,MAAM,OAAO,CAAC;IACnB,KAAK,EAAE,MAAM,MAAM,CAAC;IACpB,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,KAAK,CAAC,OAAO,CAAC,CAAC;IAC3C,GAAG,EAAE,MAAM,KAAK,CAAC,OAAO,CAAC,CAAC;IAC1B,OAAO,EAAE,MAAM,KAAK,CAAC,OAAO,CAAC,CAAC;IAC9B,KAAK,EAAE,MAAM,OAAO,CAAC;IACrB,UAAU,EAAE,MAAM,OAAO,CAAC;IAC1B,KAAK,EAAE,MAAM,IAAI,CAAC;;CA+CnB;AAED,eAAe,WAAW,CAAC"}

View File

@@ -72,28 +72,28 @@ class CallTracker {
let calls = [];
this.track = function(context) {
this.track = function (context) {
calls.push(context);
};
this.any = function() {
this.any = function () {
return !!calls.length;
};
this.count = function() {
this.count = function () {
return calls.length;
};
this.argsFor = function(index) {
this.argsFor = function (index) {
const call = calls[index];
return call ? call.args : [];
};
this.all = function() {
this.all = function () {
return calls;
};
this.allArgs = function() {
this.allArgs = function () {
const callArgs = [];
for (let i = 0; i < calls.length; i++) {
@@ -103,15 +103,15 @@ class CallTracker {
return callArgs;
};
this.first = function() {
this.first = function () {
return calls[0];
};
this.mostRecent = function() {
this.mostRecent = function () {
return calls[calls.length - 1];
};
this.reset = function() {
this.reset = function () {
calls = [];
};
}

View File

@@ -5,11 +5,12 @@
* LICENSE file in the root directory of this source tree.
*
*/
import { Jasmine, AssertionErrorWithStack, Reporter, Spy } from '../types';
import Spec from './Spec';
import Suite from './Suite';
import { QueueableFn } from '../queueRunner';
import type { AssertionErrorWithStack, Jasmine, Reporter, SpecDefinitionsFn, Spy } from '../types';
import type { default as Spec } from './Spec';
import type Suite from './Suite';
export default function (j$: Jasmine): {
new (_options?: object | undefined): {
new (_options?: Record<string, unknown> | undefined): {
specFilter: (spec: Spec) => boolean;
catchExceptions: (value: unknown) => boolean;
throwOnExpectationFailure: (value: unknown) => void;
@@ -17,27 +18,26 @@ export default function (j$: Jasmine): {
topSuite: () => Suite;
fail: (error: Error | AssertionErrorWithStack) => void;
pending: (message: string) => void;
afterAll: (afterAllFunction: (done: (error?: any) => void) => void, timeout?: number | undefined) => void;
fit: (description: string, fn: (done: (error?: any) => void) => void, timeout?: number | undefined) => void;
afterAll: (afterAllFunction: QueueableFn['fn'], timeout?: number | undefined) => void;
fit: (description: string, fn: QueueableFn['fn'], timeout?: number | undefined) => Spec;
throwingExpectationFailures: () => boolean;
randomizeTests: (value: unknown) => void;
randomTests: () => boolean;
seed: (value: unknown) => unknown;
execute: (runnablesToRun: string[], suiteTree?: Suite | undefined) => Promise<void>;
fdescribe: (description: string, specDefinitions: Function) => Suite;
spyOn: (obj: Record<string, any>, methodName: string, accessType?: "configurable" | "enumerable" | "value" | "writable" | "get" | "set" | undefined) => Spy;
beforeEach: (beforeEachFunction: (done: (error?: any) => void) => void, timeout?: number | undefined) => void;
afterEach: (afterEachFunction: (done: (error?: any) => void) => void, timeout?: number | undefined) => void;
execute: (runnablesToRun?: string[] | undefined, suiteTree?: Suite | undefined) => Promise<void>;
fdescribe: (description: string, specDefinitions: SpecDefinitionsFn) => Suite;
spyOn: (obj: Record<string, Spy>, methodName: string, accessType?: "configurable" | "enumerable" | "value" | "writable" | "get" | "set" | undefined) => Spy;
beforeEach: (beforeEachFunction: QueueableFn['fn'], timeout?: number | undefined) => void;
afterEach: (afterEachFunction: QueueableFn['fn'], timeout?: number | undefined) => void;
clearReporters: () => void;
addReporter: (reporterToAdd: Reporter) => void;
it: (description: string, fn: (done: (error?: any) => void) => void, timeout?: number | undefined) => Spec;
xdescribe: (description: string, specDefinitions: Function) => Suite;
xit: (description: string, fn: (done: (error?: any) => void) => void, timeout?: number | undefined) => any;
beforeAll: (beforeAllFunction: (done: (error?: any) => void) => void, timeout?: number | undefined) => void;
it: (description: string, fn: QueueableFn['fn'], timeout?: number | undefined) => Spec;
xdescribe: (description: string, specDefinitions: SpecDefinitionsFn) => Suite;
xit: (description: string, fn: QueueableFn['fn'], timeout?: number | undefined) => Spec;
beforeAll: (beforeAllFunction: QueueableFn['fn'], timeout?: number | undefined) => void;
todo: () => Spec;
provideFallbackReporter: (reporterToAdd: Reporter) => void;
allowRespy: (allow: boolean) => void;
describe: (description: string, specDefinitions: Function) => Suite;
describe: (description: string, specDefinitions: SpecDefinitionsFn) => Suite;
};
};
//# sourceMappingURL=Env.d.ts.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"Env.d.ts","sourceRoot":"","sources":["../../src/jasmine/Env.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAqCH,OAAO,EAAC,OAAO,EAAE,uBAAuB,EAAE,QAAQ,EAAE,GAAG,EAAC,MAAM,UAAU,CAAC;AACzE,OAAO,IAAkB,MAAM,QAAQ,CAAC;AACxC,OAAO,KAAK,MAAM,SAAS,CAAC;AAE5B,MAAM,CAAC,OAAO,WAAU,EAAE,EAAE,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6oBlC"}

View File

@@ -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

View File

@@ -5,10 +5,10 @@
* LICENSE file in the root directory of this source tree.
*
*/
import { Reporter, RunDetails } from '../types';
import { SpecResult } from './Spec';
import { SuiteResult } from './Suite';
import Timer from './Timer';
import type { Reporter, RunDetails } from '../types';
import type { SpecResult } from './Spec';
import type { SuiteResult } from './Suite';
import type Timer from './Timer';
export default class JsApiReporter implements Reporter {
started: boolean;
finished: boolean;
@@ -29,4 +29,3 @@ export default class JsApiReporter implements Reporter {
timer?: Timer;
});
}
//# sourceMappingURL=JsApiReporter.d.ts.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"JsApiReporter.d.ts","sourceRoot":"","sources":["../../src/jasmine/JsApiReporter.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAyBH,OAAO,EAAC,QAAQ,EAAE,UAAU,EAAC,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAC,UAAU,EAAC,MAAM,QAAQ,CAAC;AAClC,OAAO,EAAC,WAAW,EAAC,MAAM,SAAS,CAAC;AACpC,OAAO,KAAK,MAAM,SAAS,CAAC;AAS5B,MAAM,CAAC,OAAO,OAAO,aAAc,YAAW,QAAQ;IACpD,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,EAAE,UAAU,CAAC;IACvB,cAAc,EAAE,CAAC,UAAU,EAAE,UAAU,KAAK,IAAI,CAAC;IACjD,WAAW,EAAE,CAAC,UAAU,EAAE,UAAU,KAAK,IAAI,CAAC;IAC9C,MAAM,EAAE,MAAM,OAAO,CAAC;IACtB,aAAa,EAAE,MAAM,OAAO,CAAC;IAE7B,YAAY,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,CAAC;IAC5C,SAAS,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,CAAC;IACzC,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,KAAK,CAAC,WAAW,CAAC,CAAC;IACpE,MAAM,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IAE1C,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,KAAK,CAAC,UAAU,CAAC,CAAC;IAClE,QAAQ,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,CAAC;IACvC,KAAK,EAAE,MAAM,KAAK,CAAC,UAAU,CAAC,CAAC;IAC/B,WAAW,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,IAAI,CAAC;gBAE5B,OAAO,EAAE;QAAC,KAAK,CAAC,EAAE,KAAK,CAAA;KAAC;CA8ErC"}

View File

@@ -112,7 +112,7 @@ class JsApiReporter {
}
}
this.jasmineDone = function(runDetails) {
this.jasmineDone = function (runDetails) {
validateAfterAllExceptions(runDetails);
this.finished = true;
this.runDetails = runDetails;
@@ -120,24 +120,24 @@ class JsApiReporter {
status = 'done';
};
this.status = function() {
this.status = function () {
return status;
};
const suites = [];
const suites_hash = {};
this.specStarted = function() {};
this.specStarted = function () {};
this.suiteStarted = function(result) {
this.suiteStarted = function (result) {
suites_hash[result.id] = result;
};
this.suiteDone = function(result) {
this.suiteDone = function (result) {
storeSuite(result);
};
this.suiteResults = function(index, length) {
this.suiteResults = function (index, length) {
return suites.slice(index, index + length);
};
@@ -146,25 +146,25 @@ class JsApiReporter {
suites_hash[result.id] = result;
}
this.suites = function() {
this.suites = function () {
return suites_hash;
};
const specs = [];
this.specDone = function(result) {
this.specDone = function (result) {
specs.push(result);
};
this.specResults = function(index, length) {
this.specResults = function (index, length) {
return specs.slice(index, index + length);
};
this.specs = function() {
this.specs = function () {
return specs;
};
this.executionTime = function() {
this.executionTime = function () {
return executionTime;
};
}

View File

@@ -5,9 +5,9 @@
* LICENSE file in the root directory of this source tree.
*
*/
import { Reporter, RunDetails } from '../types';
import { SpecResult } from './Spec';
import { SuiteResult } from './Suite';
import type { Reporter, RunDetails } from '../types';
import type { SpecResult } from './Spec';
import type { SuiteResult } from './Suite';
export default class ReportDispatcher implements Reporter {
addReporter: (reporter: Reporter) => void;
provideFallbackReporter: (reporter: Reporter) => void;
@@ -20,4 +20,3 @@ export default class ReportDispatcher implements Reporter {
suiteStarted: (result: SuiteResult) => void;
constructor(methods: Array<keyof Reporter>);
}
//# sourceMappingURL=ReportDispatcher.d.ts.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"ReportDispatcher.d.ts","sourceRoot":"","sources":["../../src/jasmine/ReportDispatcher.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAwBH,OAAO,EAAC,QAAQ,EAAE,UAAU,EAAC,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAC,UAAU,EAAC,MAAM,QAAQ,CAAC;AAClC,OAAO,EAAC,WAAW,EAAC,MAAM,SAAS,CAAC;AAEpC,MAAM,CAAC,OAAO,OAAO,gBAAiB,YAAW,QAAQ;IACvD,WAAW,EAAE,CAAC,QAAQ,EAAE,QAAQ,KAAK,IAAI,CAAC;IAC1C,uBAAuB,EAAE,CAAC,QAAQ,EAAE,QAAQ,KAAK,IAAI,CAAC;IACtD,cAAc,EAAE,MAAM,IAAI,CAAC;IAG3B,WAAW,EAAE,CAAC,UAAU,EAAE,UAAU,KAAK,IAAI,CAAC;IAE9C,cAAc,EAAE,CAAC,UAAU,EAAE,UAAU,KAAK,IAAI,CAAC;IAEjD,QAAQ,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,CAAC;IAEvC,WAAW,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,IAAI,CAAC;IAExC,SAAS,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,CAAC;IAEzC,YAAY,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,CAAC;gBAEhC,OAAO,EAAE,KAAK,CAAC,MAAM,QAAQ,CAAC;CA0C3C"}

View File

@@ -50,13 +50,15 @@ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/* eslint-disable local/prefer-spread-eventually, local/prefer-rest-params-eventually */
class ReportDispatcher {
// @ts-ignore
// @ts-ignore
// @ts-ignore
// @ts-ignore
// @ts-ignore
// @ts-ignore
// @ts-expect-error
// @ts-expect-error
// @ts-expect-error
// @ts-expect-error
// @ts-expect-error
// @ts-expect-error
constructor(methods) {
_defineProperty(this, 'addReporter', void 0);
@@ -81,8 +83,8 @@ class ReportDispatcher {
for (let i = 0; i < dispatchedMethods.length; i++) {
const method = dispatchedMethods[i];
this[method] = (function(m) {
return function() {
this[method] = (function (m) {
return function () {
dispatch(m, arguments);
};
})(method);
@@ -91,15 +93,15 @@ class ReportDispatcher {
let reporters = [];
let fallbackReporter = null;
this.addReporter = function(reporter) {
this.addReporter = function (reporter) {
reporters.push(reporter);
};
this.provideFallbackReporter = function(reporter) {
this.provideFallbackReporter = function (reporter) {
fallbackReporter = reporter;
};
this.clearReporters = function() {
this.clearReporters = function () {
reporters = [];
};
@@ -114,7 +116,7 @@ class ReportDispatcher {
const reporter = reporters[i];
if (reporter[method]) {
// @ts-ignore
// @ts-expect-error
reporter[method].apply(reporter, args);
}
}

View File

@@ -5,12 +5,12 @@
* LICENSE file in the root directory of this source tree.
*
*/
import { Config } from '@jest/types';
import { FailedAssertion, Milliseconds, Status } from '@jest/test-result';
import type { FailedAssertion, Milliseconds, Status } from '@jest/test-result';
import type { Config } from '@jest/types';
import ExpectationFailed from '../ExpectationFailed';
import expectationResultFactory, { Options as ExpectationResultFactoryOptions } from '../expectationResultFactory';
import queueRunner, { QueueableFn } from '../queueRunner';
import { AssertionErrorWithStack } from '../types';
import type { QueueableFn, default as queueRunner } from '../queueRunner';
import type { AssertionErrorWithStack } from '../types';
export declare type Attributes = {
id: string;
resultCallback: (result: Spec['result']) => void;
@@ -67,16 +67,15 @@ export default class Spec {
static isPendingSpecException(e: Error): boolean;
constructor(attrs: Attributes);
addExpectationResult(passed: boolean, data: ExpectationResultFactoryOptions, isError?: boolean): void;
execute(onComplete: Function, enabled: boolean): void;
execute(onComplete?: () => void, enabled?: boolean): void;
cancel(): void;
onException(error: ExpectationFailed | AssertionErrorWithStack): void;
disable(): void;
pend(message?: string): void;
todo(): void;
getResult(): SpecResult;
status(enabled?: boolean): "disabled" | "pending" | "failed" | "passed" | "todo";
status(enabled?: boolean): "todo" | "passed" | "failed" | "pending" | "disabled";
isExecutable(): boolean;
getFullName(): string;
isAssertionError(error: Error): boolean;
}
//# sourceMappingURL=Spec.d.ts.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"Spec.d.ts","sourceRoot":"","sources":["../../src/jasmine/Spec.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AA2BH,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AACnC,OAAO,EAAC,eAAe,EAAE,YAAY,EAAE,MAAM,EAAC,MAAM,mBAAmB,CAAC;AAExE,OAAO,iBAAiB,MAAM,sBAAsB,CAAC;AACrD,OAAO,wBAAwB,EAAE,EAC/B,OAAO,IAAI,+BAA+B,EAC3C,MAAM,6BAA6B,CAAC;AAErC,OAAO,WAAW,EAAE,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAC,uBAAuB,EAAC,MAAM,UAAU,CAAC;A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AC,KAAK,EAAE,KAAK;CAM9B"}

View File

@@ -11,14 +11,14 @@ var _ExpectationFailed = _interopRequireDefault(
require('../ExpectationFailed')
);
var _expectationResultFactory = _interopRequireDefault(
require('../expectationResultFactory')
);
var _assertionErrorMessage = _interopRequireDefault(
require('../assertionErrorMessage')
);
var _expectationResultFactory = _interopRequireDefault(
require('../expectationResultFactory')
);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
@@ -81,7 +81,7 @@ class Spec {
_defineProperty(this, 'expand', void 0);
this.resultCallback = attrs.resultCallback || function() {};
this.resultCallback = attrs.resultCallback || function () {};
this.id = attrs.id;
this.description = attrs.description || '';
@@ -89,7 +89,7 @@ class Spec {
this.beforeAndAfterFns =
attrs.beforeAndAfterFns ||
function() {
function () {
return {
befores: [],
afters: []
@@ -98,19 +98,19 @@ class Spec {
this.userContext =
attrs.userContext ||
function() {
function () {
return {};
};
this.onStart = attrs.onStart || function() {};
this.onStart = attrs.onStart || function () {};
this.getSpecName =
attrs.getSpecName ||
function() {
function () {
return '';
};
this.queueRunnerFactory = attrs.queueRunnerFactory || function() {};
this.queueRunnerFactory = attrs.queueRunnerFactory || function () {};
this.throwOnExpectationFailure = !!attrs.throwOnExpectationFailure;
this.initError = new Error();
@@ -120,7 +120,7 @@ class Spec {
// https://crbug.com/v8/7142
this.initError.stack = this.initError.stack;
this.queueableFn.initError = this.initError; // @ts-ignore
this.queueableFn.initError = this.initError; // @ts-expect-error
this.result = {
id: this.id,
@@ -170,7 +170,7 @@ class Spec {
queueableFns: allFns,
onException() {
// @ts-ignore
// @ts-expect-error
self.onException.apply(self, arguments);
},
@@ -287,7 +287,7 @@ _defineProperty(Spec, 'pendingSpecExceptionMessage', void 0);
Spec.pendingSpecExceptionMessage = '=> marked Pending';
const extractCustomPendingMessage = function extractCustomPendingMessage(e) {
const extractCustomPendingMessage = function (e) {
const fullMessage = e.toString();
const boilerplateStart = fullMessage.indexOf(
Spec.pendingSpecExceptionMessage

View File

@@ -20,4 +20,3 @@ export default class SpyStrategy {
getSpy?: () => unknown;
});
}
//# sourceMappingURL=SpyStrategy.d.ts.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"SpyStrategy.d.ts","sourceRoot":"","sources":["../../src/jasmine/SpyStrategy.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAyBH,MAAM,CAAC,OAAO,OAAO,WAAW;IAC9B,QAAQ,EAAE,MAAM,MAAM,CAAC;IACvB,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,KAAK,OAAO,CAAC;IACvC,WAAW,EAAE,MAAM,OAAO,CAAC;IAC3B,WAAW,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC;IACzC,YAAY,EAAE,MAAM,OAAO,CAAC;IAC5B,UAAU,EAAE,CAAC,SAAS,EAAE,MAAM,GAAG,KAAK,KAAK,OAAO,CAAC;IACnD,QAAQ,EAAE,CAAC,EAAE,EAAE,QAAQ,KAAK,OAAO,CAAC;IACpC,IAAI,EAAE,CAAC,EAAE,EAAE,QAAQ,KAAK,OAAO,CAAC;gBAEpB,EACV,IAAgB,EAChB,EAAkB,EAClB,MAAsB,GACvB,GAAE;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,EAAE,CAAC,EAAE,QAAQ,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,OAAO,CAAA;KAAM;CAyD/D"}

View File

@@ -50,11 +50,13 @@ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/* eslint-disable local/ban-types-eventually, local/prefer-rest-params-eventually */
class SpyStrategy {
constructor({
name = 'unknown',
fn = function() {},
getSpy = function() {}
fn = function () {},
getSpy = function () {}
} = {}) {
_defineProperty(this, 'identity', void 0);
@@ -75,51 +77,51 @@ class SpyStrategy {
const identity = name;
const originalFn = fn;
let plan = function plan() {};
let plan = function () {};
this.identity = function() {
this.identity = function () {
return identity;
};
this.exec = function() {
this.exec = function () {
return plan.apply(this, arguments);
};
this.callThrough = function() {
this.callThrough = function () {
plan = originalFn;
return getSpy();
};
this.returnValue = function(value) {
plan = function plan() {
this.returnValue = function (value) {
plan = function () {
return value;
};
return getSpy();
};
this.returnValues = function() {
this.returnValues = function () {
const values = Array.prototype.slice.call(arguments);
plan = function plan() {
plan = function () {
return values.shift();
};
return getSpy();
};
this.throwError = function(something) {
this.throwError = function (something) {
const error =
something instanceof Error ? something : new Error(something);
plan = function plan() {
plan = function () {
throw error;
};
return getSpy();
};
this.callFake = function(fn) {
this.callFake = function (fn) {
if (typeof fn !== 'function') {
throw new Error(
'Argument passed to callFake should be a function, got ' + fn
@@ -130,8 +132,8 @@ class SpyStrategy {
return getSpy();
};
this.stub = function(_fn) {
plan = function plan() {};
this.stub = function (_fn) {
plan = function () {};
return getSpy();
};

View File

@@ -5,10 +5,10 @@
* LICENSE file in the root directory of this source tree.
*
*/
import { Config } from '@jest/types';
import type { Config } from '@jest/types';
import expectationResultFactory from '../expectationResultFactory';
import { QueueableFn } from '../queueRunner';
import Spec from './Spec';
import type { QueueableFn } from '../queueRunner';
import type Spec from './Spec';
export declare type SuiteResult = {
id: string;
description: string;
@@ -49,7 +49,7 @@ export default class Suite {
afterEach(fn: QueueableFn): void;
afterAll(fn: QueueableFn): void;
addChild(child: Suite | Spec): void;
status(): "disabled" | "pending" | "failed" | "finished";
status(): "failed" | "pending" | "disabled" | "finished";
isExecutable(): boolean;
canBeReentered(): boolean;
getResult(): SuiteResult;
@@ -59,4 +59,3 @@ export default class Suite {
addExpectationResult(...args: Parameters<Spec['addExpectationResult']>): void;
execute(..._args: Array<any>): void;
}
//# sourceMappingURL=Suite.d.ts.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"Suite.d.ts","sourceRoot":"","sources":["../../src/jasmine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E,MAAM,CAAC;IACvB,aAAa,EAAE,OAAO,CAAC;IACvB,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;gBAEP,KAAK,EAAE,UAAU;IAyB7B,WAAW;IAaX,OAAO;IAGP,IAAI,CAAC,QAAQ,CAAC,EAAE,MAAM;IAGtB,UAAU,CAAC,EAAE,EAAE,WAAW;IAG1B,SAAS,CAAC,EAAE,EAAE,WAAW;IAGzB,SAAS,CAAC,EAAE,EAAE,WAAW;IAGzB,QAAQ,CAAC,EAAE,EAAE,WAAW;IAIxB,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI;IAI5B,MAAM;IAgBN,YAAY;IAIZ,cAAc;IAId,SAAS;IAKT,iBAAiB;IAQjB,uBAAuB;IAIvB,WAAW,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAsBpD,oBAAoB,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;IAmBtE,OAAO,CAAC,GAAG,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC;CAC7B"}

View File

@@ -214,7 +214,7 @@ class Suite {
try {
child.addExpectationResult.apply(child, args);
} catch (e) {
} catch {
// keep going
}
}

View File

@@ -12,4 +12,3 @@ export default class Timer {
now?: () => number;
});
}
//# sourceMappingURL=Timer.d.ts.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"Timer.d.ts","sourceRoot":"","sources":["../../src/jasmine/Timer.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AA+BH,MAAM,CAAC,OAAO,OAAO,KAAK;IACxB,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,OAAO,EAAE,MAAM,MAAM,CAAC;gBAEV,OAAO,CAAC,EAAE;QAAC,GAAG,CAAC,EAAE,MAAM,MAAM,CAAA;KAAC;CAc3C"}

View File

@@ -50,8 +50,8 @@ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
const defaultNow = (function(Date) {
return function() {
const defaultNow = (function (Date) {
return function () {
return new Date().getTime();
};
})(Date);
@@ -66,11 +66,11 @@ class Timer {
const now = options.now || defaultNow;
let startTime;
this.start = function() {
this.start = function () {
startTime = now();
};
this.elapsed = function() {
this.elapsed = function () {
return now() - startTime;
};
}

View File

@@ -5,10 +5,9 @@
* LICENSE file in the root directory of this source tree.
*
*/
import { Spy } from '../types';
interface Fn extends Record<string, any> {
(): any;
import type { Spy } from '../types';
interface Fn extends Record<string, unknown> {
(): unknown;
}
declare function createSpy(name: string, originalFn: Fn): Spy;
export default createSpy;
//# sourceMappingURL=createSpy.d.ts.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"createSpy.d.ts","sourceRoot":"","sources":["../../src/jasmine/createSpy.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AA0BH,OAAO,EAAC,GAAG,EAAC,MAAM,UAAU,CAAC;AAI7B,UAAU,EAAG,SAAQ,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IACtC,IAAI,GAAG,CAAC;CACT;AAED,iBAAS,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE,GAAG,GAAG,CAqCpD;AAED,eAAe,SAAS,CAAC"}

View File

@@ -45,7 +45,7 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/* eslint-disable sort-keys */
/* eslint-disable sort-keys, local/prefer-rest-params-eventually */
function createSpy(name, originalFn) {
const spyStrategy = new _SpyStrategy.default({
name,
@@ -57,7 +57,7 @@ function createSpy(name, originalFn) {
});
const callTracker = new _CallTracker.default();
const spy = function spy(...args) {
const spy = function (...args) {
const callData = {
object: this,
args: Array.prototype.slice.apply(arguments)

View File

@@ -5,27 +5,23 @@
* LICENSE file in the root directory of this source tree.
*
*/
import { Jasmine } from '../types';
import type { Jasmine, SpecDefinitionsFn } from '../types';
import JsApiReporter from './JsApiReporter';
declare const _default: {
create: (createOptions: Record<string, any>) => Jasmine;
interface: (jasmine: Jasmine, env: any) => {
describe(description: string, specDefinitions: Function): any;
xdescribe(description: string, specDefinitions: Function): any;
fdescribe(description: string, specDefinitions: Function): any;
it(): any;
xit(): any;
fit(): any;
beforeEach(): any;
afterEach(): any;
beforeAll(): any;
afterAll(): any;
pending(): any;
fail(): any;
spyOn(obj: Record<string, any>, methodName: string, accessType?: string | undefined): any;
jsApiReporter: JsApiReporter;
jasmine: Jasmine;
};
export declare const create: (createOptions: Record<string, any>) => Jasmine;
export declare const _interface: (jasmine: Jasmine, env: any) => {
describe(description: string, specDefinitions: SpecDefinitionsFn): any;
xdescribe(description: string, specDefinitions: SpecDefinitionsFn): any;
fdescribe(description: string, specDefinitions: SpecDefinitionsFn): any;
it(): any;
xit(): any;
fit(): any;
beforeEach(): any;
afterEach(): any;
beforeAll(): any;
afterAll(): any;
pending(): any;
fail(): any;
spyOn(obj: Record<string, any>, methodName: string, accessType?: string | undefined): any;
jsApiReporter: JsApiReporter;
jasmine: Jasmine;
};
export = _default;
//# sourceMappingURL=jasmineLight.d.ts.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"jasmineLight.d.ts","sourceRoot":"","sources":["../../src/jasmine/jasmineLight.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AA0BH,OAAO,EAAC,OAAO,EAAC,MAAM,UAAU,CAAC;AAGjC,OAAO,aAAa,MAAM,iBAAiB,CAAC;;;;;;;;;;;;;;;;;;;;;AAmH5C,kBAAyC"}

View File

@@ -1,6 +1,9 @@
'use strict';
var _createSpy = _interopRequireDefault(require('./createSpy'));
Object.defineProperty(exports, '__esModule', {
value: true
});
exports._interface = exports.create = void 0;
var _Env = _interopRequireDefault(require('./Env'));
@@ -10,54 +13,56 @@ var _ReportDispatcher = _interopRequireDefault(require('./ReportDispatcher'));
var _Spec = _interopRequireDefault(require('./Spec'));
var _spyRegistry = _interopRequireDefault(require('./spyRegistry'));
var _Suite = _interopRequireDefault(require('./Suite'));
var _Timer = _interopRequireDefault(require('./Timer'));
var _createSpy = _interopRequireDefault(require('./createSpy'));
var _spyRegistry = _interopRequireDefault(require('./spyRegistry'));
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
function _objectSpread(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
var ownKeys = Object.keys(source);
if (typeof Object.getOwnPropertySymbols === 'function') {
ownKeys = ownKeys.concat(
Object.getOwnPropertySymbols(source).filter(function(sym) {
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
})
);
}
ownKeys.forEach(function(key) {
_defineProperty(target, key, source[key]);
});
}
return target;
}
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
// This file is a heavily modified fork of Jasmine. Original license:
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
/*
Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
const create = function create(createOptions) {
const j$ = _objectSpread({}, createOptions);
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/* eslint-disable sort-keys, local/prefer-spread-eventually, local/prefer-rest-params-eventually */
const create = function (createOptions) {
const j$ = {...createOptions};
j$._DEFAULT_TIMEOUT_INTERVAL = createOptions.testTimeout || 5000;
j$.getEnv = function(options) {
j$.getEnv = function (options) {
const env = (j$.currentEnv_ = j$.currentEnv_ || new j$.Env(options)); //jasmine. singletons in here (setTimeout blah blah).
return env;
@@ -73,9 +78,11 @@ const create = function create(createOptions) {
j$.Timer = _Timer.default;
j$.version = '2.5.2-light';
return j$;
};
}; // Interface is a reserved word in strict mode, so can't export it as ESM
const _interface = function _interface(jasmine, env) {
exports.create = create;
const _interface = function (jasmine, env) {
const jasmineInterface = {
describe(description, specDefinitions) {
return env.describe(description, specDefinitions);
@@ -159,9 +166,6 @@ const _interface = function _interface(jasmine, env) {
jasmine
};
return jasmineInterface;
}; // Interface is a reserved word in strict mode, so can't export it as ESM
module.exports = {
create,
interface: _interface
};
exports._interface = _interface;

View File

@@ -5,10 +5,10 @@
* LICENSE file in the root directory of this source tree.
*
*/
import { Spy } from '../types';
import type { Spy } from '../types';
export default class SpyRegistry {
allowRespy: (allow: unknown) => void;
spyOn: (obj: Record<string, any>, methodName: string, accessType?: keyof PropertyDescriptor) => Spy;
spyOn: (obj: Record<string, Spy>, methodName: string, accessType?: keyof PropertyDescriptor) => Spy;
clearSpies: () => void;
respy: unknown;
private _spyOnProperty;
@@ -16,4 +16,3 @@ export default class SpyRegistry {
currentSpies?: () => Array<Spy>;
});
}
//# sourceMappingURL=spyRegistry.d.ts.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"spyRegistry.d.ts","sourceRoot":"","sources":["../../src/jasmine/spyRegistry.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAyBH,OAAO,EAAC,GAAG,EAAC,MAAM,UAAU,CAAC;AAsB7B,MAAM,CAAC,OAAO,OAAO,WAAW;IAC9B,UAAU,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACrC,KAAK,EAAE,CACL,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACxB,UAAU,EAAE,MAAM,EAClB,UAAU,CAAC,EAAE,MAAM,kBAAkB,KAClC,GAAG,CAAC;IACT,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,KAAK,EAAE,OAAO,CAAC;IAEf,OAAO,CAAC,cAAc,CAIb;gBAEG,EACV,YAAuB,GACxB,GAAE;QACD,YAAY,CAAC,EAAE,MAAM,KAAK,CAAC,GAAG,CAAC,CAAC;KAC5B;CAgKP"}

View File

@@ -7,32 +7,14 @@ exports.default = void 0;
var _CallTracker = _interopRequireDefault(require('./CallTracker'));
var _createSpy = _interopRequireDefault(require('./createSpy'));
var _SpyStrategy = _interopRequireDefault(require('./SpyStrategy'));
var _createSpy = _interopRequireDefault(require('./createSpy'));
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
function _objectSpread(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
var ownKeys = Object.keys(source);
if (typeof Object.getOwnPropertySymbols === 'function') {
ownKeys = ownKeys.concat(
Object.getOwnPropertySymbols(source).filter(function(sym) {
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
})
);
}
ownKeys.forEach(function(key) {
_defineProperty(target, key, source[key]);
});
}
return target;
}
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
@@ -77,7 +59,7 @@ class SpyRegistry {
_defineProperty(this, '_spyOnProperty', void 0);
this.allowRespy = function(allow) {
this.allowRespy = function (allow) {
this.respy = allow;
};
@@ -116,7 +98,7 @@ class SpyRegistry {
try {
descriptor = Object.getOwnPropertyDescriptor(obj, methodName);
} catch (e) {
} catch {
// IE 8 doesn't support `definePropery` on non-DOM nodes
}
@@ -131,11 +113,11 @@ class SpyRegistry {
let restoreStrategy;
if (Object.prototype.hasOwnProperty.call(obj, methodName)) {
restoreStrategy = function restoreStrategy() {
restoreStrategy = function () {
obj[methodName] = originalMethod;
};
} else {
restoreStrategy = function restoreStrategy() {
restoreStrategy = function () {
if (!delete obj[methodName]) {
obj[methodName] = originalMethod;
}
@@ -149,7 +131,7 @@ class SpyRegistry {
return spiedMethod;
};
this._spyOnProperty = function(obj, propertyName, accessType = 'get') {
this._spyOnProperty = function (obj, propertyName, accessType = 'get') {
if (!obj) {
throw new Error(
getErrorMsg(
@@ -166,7 +148,7 @@ class SpyRegistry {
try {
descriptor = Object.getOwnPropertyDescriptor(obj, propertyName);
} catch (e) {
} catch {
// IE 8 doesn't support `definePropery` on non-DOM nodes
}
@@ -209,11 +191,11 @@ class SpyRegistry {
let restoreStrategy;
if (Object.prototype.hasOwnProperty.call(obj, propertyName)) {
restoreStrategy = function restoreStrategy() {
restoreStrategy = function () {
Object.defineProperty(obj, propertyName, originalDescriptor);
};
} else {
restoreStrategy = function restoreStrategy() {
restoreStrategy = function () {
delete obj[propertyName];
};
}
@@ -221,16 +203,12 @@ class SpyRegistry {
currentSpies().push({
restoreObjectToOriginalState: restoreStrategy
});
const spiedDescriptor = _objectSpread({}, descriptor, {
[accessType]: spiedProperty
});
const spiedDescriptor = {...descriptor, [accessType]: spiedProperty};
Object.defineProperty(obj, propertyName, spiedDescriptor);
return spiedProperty;
};
this.clearSpies = function() {
this.clearSpies = function () {
const spies = currentSpies();
for (let i = spies.length - 1; i >= 0; i--) {