id
int64
0
3.78k
code
stringlengths
13
37.9k
declarations
stringlengths
16
64.6k
1,400
function messageFormatter({error, message, passed}: Options) { if (passed) { return 'Passed.'; } if (message) { return message; } if (typeof error === 'string') { return error; } if ( // duck-type Error, see #2549 error && typeof error === 'object' && typeof error.message === '...
interface Options extends ShouldInstrumentOptions, CallerTransformOptions { isInternalModule?: boolean; }
1,401
function messageFormatter({error, message, passed}: Options) { if (passed) { return 'Passed.'; } if (message) { return message; } if (typeof error === 'string') { return error; } if ( // duck-type Error, see #2549 error && typeof error === 'object' && typeof error.message === '...
type Options = { clearTimeout: (typeof globalThis)['clearTimeout']; fail: (error: Error) => void; onException: (error: Error) => void; queueableFns: Array<QueueableFn>; setTimeout: (typeof globalThis)['setTimeout']; userContext: unknown; };
1,402
function messageFormatter({error, message, passed}: Options) { if (passed) { return 'Passed.'; } if (message) { return message; } if (typeof error === 'string') { return error; } if ( // duck-type Error, see #2549 error && typeof error === 'object' && typeof error.message === '...
type Options = { matcherName: string; passed: boolean; actual?: any; error?: any; expected?: any; message?: string | null; };
1,403
function messageFormatter({error, message, passed}: Options) { if (passed) { return 'Passed.'; } if (message) { return message; } if (typeof error === 'string') { return error; } if ( // duck-type Error, see #2549 error && typeof error === 'object' && typeof error.message === '...
type Options = { nodeComplete: (suite: TreeNode) => void; nodeStart: (suite: TreeNode) => void; queueRunnerFactory: any; runnableIds: Array<string>; tree: TreeNode; };
1,404
function messageFormatter({error, message, passed}: Options) { if (passed) { return 'Passed.'; } if (message) { return message; } if (typeof error === 'string') { return error; } if ( // duck-type Error, see #2549 error && typeof error === 'object' && typeof error.message === '...
type Options = { lastCommit?: boolean; withAncestor?: boolean; changedSince?: string; includePaths?: Array<string>; };
1,405
function messageFormatter({error, message, passed}: Options) { if (passed) { return 'Passed.'; } if (message) { return message; } if (typeof error === 'string') { return error; } if ( // duck-type Error, see #2549 error && typeof error === 'object' && typeof error.message === '...
type Options = { cacheDirectory?: string; computeDependencies?: boolean; computeSha1?: boolean; console?: Console; dependencyExtractor?: string | null; enableSymlinks?: boolean; extensions: Array<string>; forceNodeFilesystemAPI?: boolean; hasteImplModulePath?: string; hasteMapModulePath?: string; ...
1,406
function messageFormatter({error, message, passed}: Options) { if (passed) { return 'Passed.'; } if (message) { return message; } if (typeof error === 'string') { return error; } if ( // duck-type Error, see #2549 error && typeof error === 'object' && typeof error.message === '...
interface Options extends Omit<RequiredOptions, 'compareKeys' | 'theme'> { compareKeys: CompareKeys; theme: Required<RequiredOptions['theme']>; }
1,407
function stackFormatter( options: Options, initError: Error | undefined, errorMessage: string, ) { if (options.passed) { return ''; } if (options.error) { if (typeof options.error.stack === 'string') { return options.error.stack; } if (options.error === errorMessage) { return e...
interface Options extends ShouldInstrumentOptions, CallerTransformOptions { isInternalModule?: boolean; }
1,408
function stackFormatter( options: Options, initError: Error | undefined, errorMessage: string, ) { if (options.passed) { return ''; } if (options.error) { if (typeof options.error.stack === 'string') { return options.error.stack; } if (options.error === errorMessage) { return e...
type Options = { clearTimeout: (typeof globalThis)['clearTimeout']; fail: (error: Error) => void; onException: (error: Error) => void; queueableFns: Array<QueueableFn>; setTimeout: (typeof globalThis)['setTimeout']; userContext: unknown; };
1,409
function stackFormatter( options: Options, initError: Error | undefined, errorMessage: string, ) { if (options.passed) { return ''; } if (options.error) { if (typeof options.error.stack === 'string') { return options.error.stack; } if (options.error === errorMessage) { return e...
type Options = { matcherName: string; passed: boolean; actual?: any; error?: any; expected?: any; message?: string | null; };
1,410
function stackFormatter( options: Options, initError: Error | undefined, errorMessage: string, ) { if (options.passed) { return ''; } if (options.error) { if (typeof options.error.stack === 'string') { return options.error.stack; } if (options.error === errorMessage) { return e...
type Options = { nodeComplete: (suite: TreeNode) => void; nodeStart: (suite: TreeNode) => void; queueRunnerFactory: any; runnableIds: Array<string>; tree: TreeNode; };
1,411
function stackFormatter( options: Options, initError: Error | undefined, errorMessage: string, ) { if (options.passed) { return ''; } if (options.error) { if (typeof options.error.stack === 'string') { return options.error.stack; } if (options.error === errorMessage) { return e...
type Options = { lastCommit?: boolean; withAncestor?: boolean; changedSince?: string; includePaths?: Array<string>; };
1,412
function stackFormatter( options: Options, initError: Error | undefined, errorMessage: string, ) { if (options.passed) { return ''; } if (options.error) { if (typeof options.error.stack === 'string') { return options.error.stack; } if (options.error === errorMessage) { return e...
type Options = { cacheDirectory?: string; computeDependencies?: boolean; computeSha1?: boolean; console?: Console; dependencyExtractor?: string | null; enableSymlinks?: boolean; extensions: Array<string>; forceNodeFilesystemAPI?: boolean; hasteImplModulePath?: string; hasteMapModulePath?: string; ...
1,413
function stackFormatter( options: Options, initError: Error | undefined, errorMessage: string, ) { if (options.passed) { return ''; } if (options.error) { if (typeof options.error.stack === 'string') { return options.error.stack; } if (options.error === errorMessage) { return e...
interface Options extends Omit<RequiredOptions, 'compareKeys' | 'theme'> { compareKeys: CompareKeys; theme: Required<RequiredOptions['theme']>; }
1,414
function expectationResultFactory( options: Options, initError?: Error, ): FailedAssertion { const message = messageFormatter(options); const stack = stackFormatter(options, initError, message); if (options.passed) { return { error: options.error, matcherName: options.matcherName, messa...
interface Options extends ShouldInstrumentOptions, CallerTransformOptions { isInternalModule?: boolean; }
1,415
function expectationResultFactory( options: Options, initError?: Error, ): FailedAssertion { const message = messageFormatter(options); const stack = stackFormatter(options, initError, message); if (options.passed) { return { error: options.error, matcherName: options.matcherName, messa...
type Options = { clearTimeout: (typeof globalThis)['clearTimeout']; fail: (error: Error) => void; onException: (error: Error) => void; queueableFns: Array<QueueableFn>; setTimeout: (typeof globalThis)['setTimeout']; userContext: unknown; };
1,416
function expectationResultFactory( options: Options, initError?: Error, ): FailedAssertion { const message = messageFormatter(options); const stack = stackFormatter(options, initError, message); if (options.passed) { return { error: options.error, matcherName: options.matcherName, messa...
type Options = { matcherName: string; passed: boolean; actual?: any; error?: any; expected?: any; message?: string | null; };
1,417
function expectationResultFactory( options: Options, initError?: Error, ): FailedAssertion { const message = messageFormatter(options); const stack = stackFormatter(options, initError, message); if (options.passed) { return { error: options.error, matcherName: options.matcherName, messa...
type Options = { nodeComplete: (suite: TreeNode) => void; nodeStart: (suite: TreeNode) => void; queueRunnerFactory: any; runnableIds: Array<string>; tree: TreeNode; };
1,418
function expectationResultFactory( options: Options, initError?: Error, ): FailedAssertion { const message = messageFormatter(options); const stack = stackFormatter(options, initError, message); if (options.passed) { return { error: options.error, matcherName: options.matcherName, messa...
type Options = { lastCommit?: boolean; withAncestor?: boolean; changedSince?: string; includePaths?: Array<string>; };
1,419
function expectationResultFactory( options: Options, initError?: Error, ): FailedAssertion { const message = messageFormatter(options); const stack = stackFormatter(options, initError, message); if (options.passed) { return { error: options.error, matcherName: options.matcherName, messa...
type Options = { cacheDirectory?: string; computeDependencies?: boolean; computeSha1?: boolean; console?: Console; dependencyExtractor?: string | null; enableSymlinks?: boolean; extensions: Array<string>; forceNodeFilesystemAPI?: boolean; hasteImplModulePath?: string; hasteMapModulePath?: string; ...
1,420
function expectationResultFactory( options: Options, initError?: Error, ): FailedAssertion { const message = messageFormatter(options); const stack = stackFormatter(options, initError, message); if (options.passed) { return { error: options.error, matcherName: options.matcherName, messa...
interface Options extends Omit<RequiredOptions, 'compareKeys' | 'theme'> { compareKeys: CompareKeys; theme: Required<RequiredOptions['theme']>; }
1,421
(result: SpecResult) => { const {suppressedErrors} = jestExpect.getState(); jestExpect.setState({suppressedErrors: []}); if (suppressedErrors.length) { result.status = 'failed'; result.failedExpectations = suppressedErrors.map(error => ({ actual: '', // passing error for custom test reporters...
type SpecResult = { id: string; description: string; fullName: string; duration?: number; failedExpectations: Array<FailedAssertion>; testPath: string; passedExpectations: Array<ReturnType<typeof expectationResultFactory>>; pendingReason: string; status: Status; __callsite?: { getColumnNumber: (...
1,422
(result: SpecResult) => { const assertionErrors = jestExpect.extractExpectedAssertionsErrors(); if (assertionErrors.length) { const jasmineErrors = assertionErrors.map(({actual, error, expected}) => ({ actual, expected, message: error.stack, passed: false, })); result.status = 'f...
type SpecResult = { id: string; description: string; fullName: string; duration?: number; failedExpectations: Array<FailedAssertion>; testPath: string; passedExpectations: Array<ReturnType<typeof expectationResultFactory>>; pendingReason: string; status: Status; __callsite?: { getColumnNumber: (...
1,423
constructor(attr: Attributes) { const resultCallback = attr.resultCallback; attr.resultCallback = function (result: SpecResult) { addSuppressedErrors(result); addAssertionErrors(result); resultCallback.call(attr, result); }; const onStart = attr.onStart; ...
type Attributes = { id: string; parentSuite?: Suite; description: Circus.TestNameLike; throwOnExpectationFailure?: boolean; getTestPath: () => string; };
1,424
constructor(attr: Attributes) { const resultCallback = attr.resultCallback; attr.resultCallback = function (result: SpecResult) { addSuppressedErrors(result); addAssertionErrors(result); resultCallback.call(attr, result); }; const onStart = attr.onStart; ...
type Attributes = { id: string; resultCallback: (result: Spec['result']) => void; description: Circus.TestNameLike; throwOnExpectationFailure: unknown; getTestPath: () => string; queueableFn: QueueableFn; beforeAndAfterFns: () => { befores: Array<QueueableFn>; afters: Array<QueueableFn>; }; us...
1,425
function (result: SpecResult) { addSuppressedErrors(result); addAssertionErrors(result); resultCallback.call(attr, result); }
type SpecResult = { id: string; description: string; fullName: string; duration?: number; failedExpectations: Array<FailedAssertion>; testPath: string; passedExpectations: Array<ReturnType<typeof expectationResultFactory>>; pendingReason: string; status: Status; __callsite?: { getColumnNumber: (...
1,426
async function setupJestGlobals({ config, globalConfig, localRequire, testPath, }: SetupOptions): Promise<SnapshotState> { // Jest tests snapshotSerializers in order preceding built-in serializers. // Therefore, add in reverse because the last added is the first tested. config.snapshotSerializers .con...
type SetupOptions = { config: Config.ProjectConfig; globalConfig: Config.GlobalConfig; localRequire: (moduleName: string) => Plugin; testPath: string; };
1,427
function each(environment: JestEnvironment): void { environment.global.it.each = bindEach(environment.global.it); environment.global.fit.each = bindEach(environment.global.fit); environment.global.xit.each = bindEach(environment.global.xit); environment.global.describe.each = bindEach( environment.global.de...
class JestEnvironment<Timer = unknown> { constructor(config: JestEnvironmentConfig, context: EnvironmentContext); global: Global.Global; fakeTimers: LegacyFakeTimers<Timer> | null; fakeTimersModern: ModernFakeTimers | null; moduleMocker: ModuleMocker | null; getVmContext(): Context | null; setup(): Promis...
1,428
(suite: TreeNode) => void
type TreeNode = { afterAllFns: Array<unknown>; beforeAllFns: Array<unknown>; disabled?: boolean; execute: (onComplete: () => void, enabled: boolean) => void; id: string; onException: (error: Error) => void; sharedUserContext: () => unknown; children?: Array<TreeNode>; } & Pick<Suite, 'getResult' | 'pare...
1,429
function treeProcessor(options: Options): void { const {nodeComplete, nodeStart, queueRunnerFactory, runnableIds, tree} = options; function isEnabled(node: TreeNode, parentEnabled: boolean) { return parentEnabled || runnableIds.indexOf(node.id) !== -1; } function getNodeHandler(node: TreeNode, parentE...
interface Options extends ShouldInstrumentOptions, CallerTransformOptions { isInternalModule?: boolean; }
1,430
function treeProcessor(options: Options): void { const {nodeComplete, nodeStart, queueRunnerFactory, runnableIds, tree} = options; function isEnabled(node: TreeNode, parentEnabled: boolean) { return parentEnabled || runnableIds.indexOf(node.id) !== -1; } function getNodeHandler(node: TreeNode, parentE...
type Options = { clearTimeout: (typeof globalThis)['clearTimeout']; fail: (error: Error) => void; onException: (error: Error) => void; queueableFns: Array<QueueableFn>; setTimeout: (typeof globalThis)['setTimeout']; userContext: unknown; };
1,431
function treeProcessor(options: Options): void { const {nodeComplete, nodeStart, queueRunnerFactory, runnableIds, tree} = options; function isEnabled(node: TreeNode, parentEnabled: boolean) { return parentEnabled || runnableIds.indexOf(node.id) !== -1; } function getNodeHandler(node: TreeNode, parentE...
type Options = { matcherName: string; passed: boolean; actual?: any; error?: any; expected?: any; message?: string | null; };
1,432
function treeProcessor(options: Options): void { const {nodeComplete, nodeStart, queueRunnerFactory, runnableIds, tree} = options; function isEnabled(node: TreeNode, parentEnabled: boolean) { return parentEnabled || runnableIds.indexOf(node.id) !== -1; } function getNodeHandler(node: TreeNode, parentE...
type Options = { nodeComplete: (suite: TreeNode) => void; nodeStart: (suite: TreeNode) => void; queueRunnerFactory: any; runnableIds: Array<string>; tree: TreeNode; };
1,433
function treeProcessor(options: Options): void { const {nodeComplete, nodeStart, queueRunnerFactory, runnableIds, tree} = options; function isEnabled(node: TreeNode, parentEnabled: boolean) { return parentEnabled || runnableIds.indexOf(node.id) !== -1; } function getNodeHandler(node: TreeNode, parentE...
type Options = { lastCommit?: boolean; withAncestor?: boolean; changedSince?: string; includePaths?: Array<string>; };
1,434
function treeProcessor(options: Options): void { const {nodeComplete, nodeStart, queueRunnerFactory, runnableIds, tree} = options; function isEnabled(node: TreeNode, parentEnabled: boolean) { return parentEnabled || runnableIds.indexOf(node.id) !== -1; } function getNodeHandler(node: TreeNode, parentE...
type Options = { cacheDirectory?: string; computeDependencies?: boolean; computeSha1?: boolean; console?: Console; dependencyExtractor?: string | null; enableSymlinks?: boolean; extensions: Array<string>; forceNodeFilesystemAPI?: boolean; hasteImplModulePath?: string; hasteMapModulePath?: string; ...
1,435
function treeProcessor(options: Options): void { const {nodeComplete, nodeStart, queueRunnerFactory, runnableIds, tree} = options; function isEnabled(node: TreeNode, parentEnabled: boolean) { return parentEnabled || runnableIds.indexOf(node.id) !== -1; } function getNodeHandler(node: TreeNode, parentE...
interface Options extends Omit<RequiredOptions, 'compareKeys' | 'theme'> { compareKeys: CompareKeys; theme: Required<RequiredOptions['theme']>; }
1,436
function isEnabled(node: TreeNode, parentEnabled: boolean) { return parentEnabled || runnableIds.indexOf(node.id) !== -1; }
type TreeNode = { afterAllFns: Array<unknown>; beforeAllFns: Array<unknown>; disabled?: boolean; execute: (onComplete: () => void, enabled: boolean) => void; id: string; onException: (error: Error) => void; sharedUserContext: () => unknown; children?: Array<TreeNode>; } & Pick<Suite, 'getResult' | 'pare...
1,437
function getNodeHandler(node: TreeNode, parentEnabled: boolean) { const enabled = isEnabled(node, parentEnabled); return node.children ? getNodeWithChildrenHandler(node, enabled) : getNodeWithoutChildrenHandler(node, enabled); }
type TreeNode = { afterAllFns: Array<unknown>; beforeAllFns: Array<unknown>; disabled?: boolean; execute: (onComplete: () => void, enabled: boolean) => void; id: string; onException: (error: Error) => void; sharedUserContext: () => unknown; children?: Array<TreeNode>; } & Pick<Suite, 'getResult' | 'pare...
1,438
function getNodeWithoutChildrenHandler(node: TreeNode, enabled: boolean) { return function fn(done: (error?: unknown) => void = noop) { node.execute(done, enabled); }; }
type TreeNode = { afterAllFns: Array<unknown>; beforeAllFns: Array<unknown>; disabled?: boolean; execute: (onComplete: () => void, enabled: boolean) => void; id: string; onException: (error: Error) => void; sharedUserContext: () => unknown; children?: Array<TreeNode>; } & Pick<Suite, 'getResult' | 'pare...
1,439
function getNodeWithChildrenHandler(node: TreeNode, enabled: boolean) { return async function fn(done: (error?: unknown) => void = noop) { nodeStart(node); await queueRunnerFactory({ onException: (error: Error) => node.onException(error), queueableFns: wrapChildren(node, enabled), ...
type TreeNode = { afterAllFns: Array<unknown>; beforeAllFns: Array<unknown>; disabled?: boolean; execute: (onComplete: () => void, enabled: boolean) => void; id: string; onException: (error: Error) => void; sharedUserContext: () => unknown; children?: Array<TreeNode>; } & Pick<Suite, 'getResult' | 'pare...
1,440
function hasNoEnabledTest(node: TreeNode): boolean { return ( node.disabled || node.markedPending || (node.children?.every(hasNoEnabledTest) ?? false) ); }
type TreeNode = { afterAllFns: Array<unknown>; beforeAllFns: Array<unknown>; disabled?: boolean; execute: (onComplete: () => void, enabled: boolean) => void; id: string; onException: (error: Error) => void; sharedUserContext: () => unknown; children?: Array<TreeNode>; } & Pick<Suite, 'getResult' | 'pare...
1,441
function wrapChildren(node: TreeNode, enabled: boolean) { if (!node.children) { throw new Error('`node.children` is not defined.'); } const children = node.children.map(child => ({ fn: getNodeHandler(child, enabled), })); if (hasNoEnabledTest(node)) { return children; } ret...
type TreeNode = { afterAllFns: Array<unknown>; beforeAllFns: Array<unknown>; disabled?: boolean; execute: (onComplete: () => void, enabled: boolean) => void; id: string; onException: (error: Error) => void; sharedUserContext: () => unknown; children?: Array<TreeNode>; } & Pick<Suite, 'getResult' | 'pare...
1,442
(done: DoneFn) => void | PromiseLike<T>
interface DoneFn { (error?: any): void; fail: (error: Error) => void; }
1,443
(done: DoneFn) => void | PromiseLike<T>
type DoneFn = (reason?: string | Error) => void;
1,444
(done: DoneFn) => void | PromiseLike<T>
type DoneFn = Global.DoneFn;
1,445
function (done: DoneFn) { const wrappedFn = isGeneratorFn(fn) ? co.wrap(fn) : fn; // @ts-expect-error: TS thinks `wrappedFn` is a generator function const returnValue = wrappedFn.call({}, doneFnNoop); if (isPromise(returnValue)) { returnValue.then(done.bind(null, null), (error: Error) =...
interface DoneFn { (error?: any): void; fail: (error: Error) => void; }
1,446
function (done: DoneFn) { const wrappedFn = isGeneratorFn(fn) ? co.wrap(fn) : fn; // @ts-expect-error: TS thinks `wrappedFn` is a generator function const returnValue = wrappedFn.call({}, doneFnNoop); if (isPromise(returnValue)) { returnValue.then(done.bind(null, null), (error: Error) =...
type DoneFn = (reason?: string | Error) => void;
1,447
function (done: DoneFn) { const wrappedFn = isGeneratorFn(fn) ? co.wrap(fn) : fn; // @ts-expect-error: TS thinks `wrappedFn` is a generator function const returnValue = wrappedFn.call({}, doneFnNoop); if (isPromise(returnValue)) { returnValue.then(done.bind(null, null), (error: Error) =...
type DoneFn = Global.DoneFn;
1,448
(done: DoneFn) => void | PromiseLike<void>
interface DoneFn { (error?: any): void; fail: (error: Error) => void; }
1,449
(done: DoneFn) => void | PromiseLike<void>
type DoneFn = (reason?: string | Error) => void;
1,450
(done: DoneFn) => void | PromiseLike<void>
type DoneFn = Global.DoneFn;
1,451
function (done: DoneFn) { const wrappedFn = isGeneratorFn(fn) ? co.wrap(fn) : fn; const returnValue = wrappedFn.call({}, doneFnNoop); if (isPromise(returnValue)) { returnValue.then(done.bind(null, null), (error: Error) => { const {isError: checkIsError, message} = isError(error); ...
interface DoneFn { (error?: any): void; fail: (error: Error) => void; }
1,452
function (done: DoneFn) { const wrappedFn = isGeneratorFn(fn) ? co.wrap(fn) : fn; const returnValue = wrappedFn.call({}, doneFnNoop); if (isPromise(returnValue)) { returnValue.then(done.bind(null, null), (error: Error) => { const {isError: checkIsError, message} = isError(error); ...
type DoneFn = (reason?: string | Error) => void;
1,453
function (done: DoneFn) { const wrappedFn = isGeneratorFn(fn) ? co.wrap(fn) : fn; const returnValue = wrappedFn.call({}, doneFnNoop); if (isPromise(returnValue)) { returnValue.then(done.bind(null, null), (error: Error) => { const {isError: checkIsError, message} = isError(error); ...
type DoneFn = Global.DoneFn;
1,454
jasmineStarted(_runDetails: RunDetails): void {}
type RunDetails = { totalSpecsDefined?: number; failedExpectations?: SuiteResult['failedExpectations']; };
1,455
specStarted(spec: SpecResult): void { this._startTimes.set(spec.id, Date.now()); }
type SpecResult = { id: string; description: string; fullName: string; duration?: number; failedExpectations: Array<FailedAssertion>; testPath: string; passedExpectations: Array<ReturnType<typeof expectationResultFactory>>; pendingReason: string; status: Status; __callsite?: { getColumnNumber: (...
1,456
specDone(result: SpecResult): void { this._testResults.push( this._extractSpecResults(result, this._currentSuites.slice(0)), ); }
type SpecResult = { id: string; description: string; fullName: string; duration?: number; failedExpectations: Array<FailedAssertion>; testPath: string; passedExpectations: Array<ReturnType<typeof expectationResultFactory>>; pendingReason: string; status: Status; __callsite?: { getColumnNumber: (...
1,457
suiteStarted(suite: SuiteResult): void { this._currentSuites.push(suite.description); }
type SuiteResult = { id: string; description: string; fullName: string; failedExpectations: Array<ReturnType<typeof expectationResultFactory>>; testPath: string; status?: string; };
1,458
suiteDone(_result: SuiteResult): void { this._currentSuites.pop(); }
type SuiteResult = { id: string; description: string; fullName: string; failedExpectations: Array<ReturnType<typeof expectationResultFactory>>; testPath: string; status?: string; };
1,459
jasmineDone(_runDetails: RunDetails): void { let numFailingTests = 0; let numPassingTests = 0; let numPendingTests = 0; let numTodoTests = 0; const testResults = this._testResults; testResults.forEach(testResult => { if (testResult.status === 'failed') { numFailingTests++; } ...
type RunDetails = { totalSpecsDefined?: number; failedExpectations?: SuiteResult['failedExpectations']; };
1,460
private _extractSpecResults( specResult: SpecResult, ancestorTitles: Array<string>, ): AssertionResult { const status = specResult.status === 'disabled' ? 'pending' : specResult.status; const start = this._startTimes.get(specResult.id); const duration = start && !['pending', 'skipped']...
type SpecResult = { id: string; description: string; fullName: string; duration?: number; failedExpectations: Array<FailedAssertion>; testPath: string; passedExpectations: Array<ReturnType<typeof expectationResultFactory>>; pendingReason: string; status: Status; __callsite?: { getColumnNumber: (...
1,461
function assertionErrorMessage( error: AssertionErrorWithStack, options: DiffOptions, ): string { const {expected, actual, generatedMessage, message, operator, stack} = error; const diffString = diff(expected, actual, options); const hasCustomMessage = !generatedMessage; const operatorName = getOperatorName...
type DiffOptions = { aAnnotation?: string; aColor?: DiffOptionsColor; aIndicator?: string; bAnnotation?: string; bColor?: DiffOptionsColor; bIndicator?: string; changeColor?: DiffOptionsColor; changeLineTrailingSpaceColor?: DiffOptionsColor; commonColor?: DiffOptionsColor; commonIndicator?: string; ...
1,462
function assertionErrorMessage( error: AssertionErrorWithStack, options: DiffOptions, ): string { const {expected, actual, generatedMessage, message, operator, stack} = error; const diffString = diff(expected, actual, options); const hasCustomMessage = !generatedMessage; const operatorName = getOperatorName...
type DiffOptions = ImportDiffOptions;
1,463
function assertionErrorMessage( error: AssertionErrorWithStack, options: DiffOptions, ): string { const {expected, actual, generatedMessage, message, operator, stack} = error; const diffString = diff(expected, actual, options); const hasCustomMessage = !generatedMessage; const operatorName = getOperatorName...
interface AssertionErrorWithStack extends AssertionError { stack: string; }
1,464
function assertionErrorMessage( error: AssertionErrorWithStack, options: DiffOptions, ): string { const {expected, actual, generatedMessage, message, operator, stack} = error; const diffString = diff(expected, actual, options); const hasCustomMessage = !generatedMessage; const operatorName = getOperatorName...
interface AssertionErrorWithStack extends AssertionError { stack: string; }
1,465
(reporter: Reporter) => void
type Reporter = { jasmineDone: (runDetails: RunDetails) => void; jasmineStarted: (runDetails: RunDetails) => void; specDone: (result: SpecResult) => void; specStarted: (spec: SpecResult) => void; suiteDone: (result: SuiteResult) => void; suiteStarted: (result: SuiteResult) => void; };
1,466
(reporter: Reporter) => void
interface Reporter { readonly onTestResult?: ( test: Test, testResult: TestResult, aggregatedResult: AggregatedResult, ) => Promise<void> | void; readonly onTestFileResult?: ( test: Test, testResult: TestResult, aggregatedResult: AggregatedResult, ) => Promise<void> | void; readonly on...
1,467
(context: Context) => void
type Context = { object: unknown; args: Array<unknown>; returnValue?: unknown; };
1,468
(context: Context) => void
interface Context extends MatcherContext { snapshotState: SnapshotState; }
1,469
function (context: Context) { calls.push(context); }
type Context = { object: unknown; args: Array<unknown>; returnValue?: unknown; };
1,470
function (context: Context) { calls.push(context); }
interface Context extends MatcherContext { snapshotState: SnapshotState; }
1,471
function jasmineEnv(j$: Jasmine) { return class Env { specFilter: (spec: Spec) => boolean; catchExceptions: (value: unknown) => boolean; throwOnExpectationFailure: (value: unknown) => void; catchingExceptions: () => boolean; topSuite: () => Suite; fail: (error: Error | AssertionErrorWithStack)...
type Jasmine = { _DEFAULT_TIMEOUT_INTERVAL: number; DEFAULT_TIMEOUT_INTERVAL: number; currentEnv_: ReturnType<typeof Env>['prototype']; getEnv: () => ReturnType<typeof Env>['prototype']; createSpy: typeof createSpy; Env: ReturnType<typeof Env>; JsApiReporter: typeof JsApiReporter; ReportDispatcher: type...
1,472
(spec: Spec) => boolean
class Spec extends realSpec { constructor(attr: Attributes) { const resultCallback = attr.resultCallback; attr.resultCallback = function (result: SpecResult) { addSuppressedErrors(result); addAssertionErrors(result); resultCallback.call(attr, result); }; ...
1,473
(spec: Spec) => boolean
class Spec { id: string; description: string; resultCallback: (result: SpecResult) => void; queueableFn: QueueableFn; beforeAndAfterFns: () => { befores: Array<QueueableFn>; afters: Array<QueueableFn>; }; userContext: () => unknown; onStart: (spec: Spec) => void; getSpecName: (spec: Spec) => s...
1,474
(reporterToAdd: Reporter) => void
type Reporter = { jasmineDone: (runDetails: RunDetails) => void; jasmineStarted: (runDetails: RunDetails) => void; specDone: (result: SpecResult) => void; specStarted: (spec: SpecResult) => void; suiteDone: (result: SuiteResult) => void; suiteStarted: (result: SuiteResult) => void; };
1,475
(reporterToAdd: Reporter) => void
interface Reporter { readonly onTestResult?: ( test: Test, testResult: TestResult, aggregatedResult: AggregatedResult, ) => Promise<void> | void; readonly onTestFileResult?: ( test: Test, testResult: TestResult, aggregatedResult: AggregatedResult, ) => Promise<void> | void; readonly on...
1,476
function (suite: Suite) { return function () { let afters: Array<QueueableFn> = []; let befores: Array<QueueableFn> = []; while (suite) { befores = befores.concat(suite.beforeFns); afters = afters.concat(suite.afterFns); suite = suite.parentSui...
class Suite { id: string; parentSuite?: Suite; description: Circus.TestNameLike; throwOnExpectationFailure: boolean; beforeFns: Array<QueueableFn>; afterFns: Array<QueueableFn>; beforeAllFns: Array<QueueableFn>; afterAllFns: Array<QueueableFn>; disabled: boolean; children: Array<Suite | Spec>; res...
1,477
function (suite: Suite) { return function () { let afters: Array<QueueableFn> = []; let befores: Array<QueueableFn> = []; while (suite) { befores = befores.concat(suite.beforeFns); afters = afters.concat(suite.afterFns); suite = suite.parentSui...
type Suite = { title: string; suites: Array<Suite>; tests: Array<AssertionResult>; };
1,478
function (spec: Spec, suite: Suite) { const fullName = [spec.description]; const suiteFullName = suite.getFullName(); if (suiteFullName !== '') { fullName.unshift(suiteFullName); } return fullName.join(' '); }
class Spec extends realSpec { constructor(attr: Attributes) { const resultCallback = attr.resultCallback; attr.resultCallback = function (result: SpecResult) { addSuppressedErrors(result); addAssertionErrors(result); resultCallback.call(attr, result); }; ...
1,479
function (spec: Spec, suite: Suite) { const fullName = [spec.description]; const suiteFullName = suite.getFullName(); if (suiteFullName !== '') { fullName.unshift(suiteFullName); } return fullName.join(' '); }
class Spec { id: string; description: string; resultCallback: (result: SpecResult) => void; queueableFn: QueueableFn; beforeAndAfterFns: () => { befores: Array<QueueableFn>; afters: Array<QueueableFn>; }; userContext: () => unknown; onStart: (spec: Spec) => void; getSpecName: (spec: Spec) => s...
1,480
function (spec: Spec, suite: Suite) { const fullName = [spec.description]; const suiteFullName = suite.getFullName(); if (suiteFullName !== '') { fullName.unshift(suiteFullName); } return fullName.join(' '); }
class Suite { id: string; parentSuite?: Suite; description: Circus.TestNameLike; throwOnExpectationFailure: boolean; beforeFns: Array<QueueableFn>; afterFns: Array<QueueableFn>; beforeAllFns: Array<QueueableFn>; afterAllFns: Array<QueueableFn>; disabled: boolean; children: Array<Suite | Spec>; res...
1,481
function (spec: Spec, suite: Suite) { const fullName = [spec.description]; const suiteFullName = suite.getFullName(); if (suiteFullName !== '') { fullName.unshift(suiteFullName); } return fullName.join(' '); }
type Suite = { title: string; suites: Array<Suite>; tests: Array<AssertionResult>; };
1,482
( suite: Suite, specDefinitions: SpecDefinitionsFn, ) => { const parentSuite = currentDeclarationSuite; parentSuite.addChild(suite); currentDeclarationSuite = suite; let declarationError: undefined | Error = undefined; let describeReturnValue: unknown | Err...
class Suite { id: string; parentSuite?: Suite; description: Circus.TestNameLike; throwOnExpectationFailure: boolean; beforeFns: Array<QueueableFn>; afterFns: Array<QueueableFn>; beforeAllFns: Array<QueueableFn>; afterAllFns: Array<QueueableFn>; disabled: boolean; children: Array<Suite | Spec>; res...
1,483
( suite: Suite, specDefinitions: SpecDefinitionsFn, ) => { const parentSuite = currentDeclarationSuite; parentSuite.addChild(suite); currentDeclarationSuite = suite; let declarationError: undefined | Error = undefined; let describeReturnValue: unknown | Err...
type Suite = { title: string; suites: Array<Suite>; tests: Array<AssertionResult>; };
1,484
( suite: Suite, specDefinitions: SpecDefinitionsFn, ) => { const parentSuite = currentDeclarationSuite; parentSuite.addChild(suite); currentDeclarationSuite = suite; let declarationError: undefined | Error = undefined; let describeReturnValue: unknown | Err...
type SpecDefinitionsFn = () => void;
1,485
function findFocusedAncestor(suite: Suite) { while (suite) { if (suite.isFocused) { return suite.id; } suite = suite.parentSuite!; } return null; }
class Suite { id: string; parentSuite?: Suite; description: Circus.TestNameLike; throwOnExpectationFailure: boolean; beforeFns: Array<QueueableFn>; afterFns: Array<QueueableFn>; beforeAllFns: Array<QueueableFn>; afterAllFns: Array<QueueableFn>; disabled: boolean; children: Array<Suite | Spec>; res...
1,486
function findFocusedAncestor(suite: Suite) { while (suite) { if (suite.isFocused) { return suite.id; } suite = suite.parentSuite!; } return null; }
type Suite = { title: string; suites: Array<Suite>; tests: Array<AssertionResult>; };
1,487
getSpecName(spec: Spec) { return getSpecName(spec, suite); }
class Spec extends realSpec { constructor(attr: Attributes) { const resultCallback = attr.resultCallback; attr.resultCallback = function (result: SpecResult) { addSuppressedErrors(result); addAssertionErrors(result); resultCallback.call(attr, result); }; ...
1,488
getSpecName(spec: Spec) { return getSpecName(spec, suite); }
class Spec { id: string; description: string; resultCallback: (result: SpecResult) => void; queueableFn: QueueableFn; beforeAndAfterFns: () => { befores: Array<QueueableFn>; afters: Array<QueueableFn>; }; userContext: () => unknown; onStart: (spec: Spec) => void; getSpecName: (spec: Spec) => s...
1,489
function specResultCallback(result: SpecResult) { clearResourcesForRunnable(spec.id); currentSpec = null; reporter.specDone(result); }
type SpecResult = { id: string; description: string; fullName: string; duration?: number; failedExpectations: Array<FailedAssertion>; testPath: string; passedExpectations: Array<ReturnType<typeof expectationResultFactory>>; pendingReason: string; status: Status; __callsite?: { getColumnNumber: (...
1,490
function specStarted(spec: Spec) { currentSpec = spec; defaultResourcesForRunnable(spec.id, suite.id); reporter.specStarted(spec.result); }
class Spec extends realSpec { constructor(attr: Attributes) { const resultCallback = attr.resultCallback; attr.resultCallback = function (result: SpecResult) { addSuppressedErrors(result); addAssertionErrors(result); resultCallback.call(attr, result); }; ...
1,491
function specStarted(spec: Spec) { currentSpec = spec; defaultResourcesForRunnable(spec.id, suite.id); reporter.specStarted(spec.result); }
class Spec { id: string; description: string; resultCallback: (result: SpecResult) => void; queueableFn: QueueableFn; beforeAndAfterFns: () => { befores: Array<QueueableFn>; afters: Array<QueueableFn>; }; userContext: () => unknown; onStart: (spec: Spec) => void; getSpecName: (spec: Spec) => s...
1,492
constructor(attrs: Attributes) { this.markedPending = false; this.markedTodo = false; this.isFocused = false; this.id = attrs.id; this.parentSuite = attrs.parentSuite; this.description = convertDescriptorToString(attrs.description); this.throwOnExpectationFailure = !!attrs.throwOnExpectation...
type Attributes = { id: string; parentSuite?: Suite; description: Circus.TestNameLike; throwOnExpectationFailure?: boolean; getTestPath: () => string; };
1,493
constructor(attrs: Attributes) { this.markedPending = false; this.markedTodo = false; this.isFocused = false; this.id = attrs.id; this.parentSuite = attrs.parentSuite; this.description = convertDescriptorToString(attrs.description); this.throwOnExpectationFailure = !!attrs.throwOnExpectation...
type Attributes = { id: string; resultCallback: (result: Spec['result']) => void; description: Circus.TestNameLike; throwOnExpectationFailure: unknown; getTestPath: () => string; queueableFn: QueueableFn; beforeAndAfterFns: () => { befores: Array<QueueableFn>; afters: Array<QueueableFn>; }; us...
1,494
beforeEach(fn: QueueableFn) { this.beforeFns.unshift(fn); }
type QueueableFn = { fn: (done: DoneFn) => void; timeout?: () => number; initError?: Error; };
1,495
beforeAll(fn: QueueableFn) { this.beforeAllFns.push(fn); }
type QueueableFn = { fn: (done: DoneFn) => void; timeout?: () => number; initError?: Error; };
1,496
afterEach(fn: QueueableFn) { this.afterFns.unshift(fn); }
type QueueableFn = { fn: (done: DoneFn) => void; timeout?: () => number; initError?: Error; };
1,497
afterAll(fn: QueueableFn) { this.afterAllFns.unshift(fn); }
type QueueableFn = { fn: (done: DoneFn) => void; timeout?: () => number; initError?: Error; };
1,498
function (jasmine: Jasmine, env: any) { const jasmineInterface = { describe(description: string, specDefinitions: SpecDefinitionsFn) { return env.describe(description, specDefinitions); }, xdescribe(description: string, specDefinitions: SpecDefinitionsFn) { return env.xdescribe(description, s...
type Jasmine = { _DEFAULT_TIMEOUT_INTERVAL: number; DEFAULT_TIMEOUT_INTERVAL: number; currentEnv_: ReturnType<typeof Env>['prototype']; getEnv: () => ReturnType<typeof Env>['prototype']; createSpy: typeof createSpy; Env: ReturnType<typeof Env>; JsApiReporter: typeof JsApiReporter; ReportDispatcher: type...
1,499
(context: Spec) => void
class Spec extends realSpec { constructor(attr: Attributes) { const resultCallback = attr.resultCallback; attr.resultCallback = function (result: SpecResult) { addSuppressedErrors(result); addAssertionErrors(result); resultCallback.call(attr, result); }; ...