id int64 0 3.78k | code stringlengths 13 37.9k | declarations stringlengths 16 64.6k |
|---|---|---|
1,300 | (
this: GenericFormData,
value: any,
key: string | number,
path: null | Array<string | number>,
helpers: FormDataVisitorHelpers
): boolean | interface FormDataVisitorHelpers {
defaultVisitor: SerializerVisitor;
convertValue: (value: any) => any;
isVisitable: (value: any) => boolean;
} |
1,301 | (
this: GenericFormData,
value: any,
key: string | number,
path: null | Array<string | number>,
helpers: FormDataVisitorHelpers
): boolean | interface GenericFormData {
append(name: string, value: any, options?: any): any;
} |
1,302 | (progressEvent: AxiosProgressEvent) => void | interface AxiosProgressEvent {
loaded: number;
total?: number;
progress?: number;
bytes: number;
rate?: number;
estimated?: number;
upload?: boolean;
download?: boolean;
event?: BrowserProgressEvent;
} |
1,303 | (cancel: Canceler) => void | interface Canceler {
(message?: string, config?: AxiosRequestConfig, request?: any): void;
} |
1,304 | (config: InternalAxiosRequestConfig) => boolean | interface InternalAxiosRequestConfig<D = any> extends AxiosRequestConfig<D> {
headers: AxiosRequestHeaders;
} |
1,305 | constructor(config?: AxiosRequestConfig) | interface AxiosRequestConfig<D = any> {
url?: string;
method?: Method | string;
baseURL?: string;
transformRequest?: AxiosRequestTransformer | AxiosRequestTransformer[];
transformResponse?: AxiosResponseTransformer | AxiosResponseTransformer[];
headers?: (RawAxiosRequestHeaders & MethodsHeaders) | AxiosHead... |
1,306 | getUri(config?: AxiosRequestConfig): string | interface AxiosRequestConfig<D = any> {
url?: string;
method?: Method | string;
baseURL?: string;
transformRequest?: AxiosRequestTransformer | AxiosRequestTransformer[];
transformResponse?: AxiosResponseTransformer | AxiosResponseTransformer[];
headers?: (RawAxiosRequestHeaders & MethodsHeaders) | AxiosHead... |
1,307 | create(config?: CreateAxiosDefaults): AxiosInstance | interface CreateAxiosDefaults<D = any> extends Omit<AxiosRequestConfig<D>, 'headers'> {
headers?: RawAxiosRequestHeaders | AxiosHeaders | Partial<HeadersDefaults>;
} |
1,308 | (progressEvent: AxiosProgressEvent) => {} | interface AxiosProgressEvent {
loaded: number;
total?: number;
progress?: number;
bytes: number;
rate?: number;
estimated?: number;
upload?: boolean;
download?: boolean;
event?: BrowserProgressEvent;
} |
1,309 | (cancel: Canceler) => {} | interface Canceler {
(message?: string, config?: AxiosRequestConfig, request?: any): void;
} |
1,310 | (response: AxiosResponse) => {
console.log(response.data);
console.log(response.status);
console.log(response.statusText);
console.log(response.headers);
console.log(response.config);
} | interface AxiosResponse<T = any, D = any> {
data: T;
status: number;
statusText: string;
headers: RawAxiosResponseHeaders | AxiosResponseHeaders;
config: InternalAxiosRequestConfig<D>;
request?: any;
} |
1,311 | (error: AxiosError) => {
if (error.response) {
console.log(error.response.data);
console.log(error.response.status);
console.log(error.response.headers);
} else {
console.log(error.message);
}
} | class AxiosError<T = unknown, D = any> extends Error {
constructor(
message?: string,
code?: string,
config?: InternalAxiosRequestConfig<D>,
request?: any,
response?: AxiosResponse<T, D>
);
config?: InternalAxiosRequestConfig<D>;
code?: string;
request?: any;
response?: AxiosR... |
1,312 | (response: AxiosResponse) => response | interface AxiosResponse<T = any, D = any> {
data: T;
status: number;
statusText: string;
headers: RawAxiosResponseHeaders | AxiosResponseHeaders;
config: InternalAxiosRequestConfig<D>;
request?: any;
} |
1,313 | (response: AxiosResponse) => Promise.resolve(response) | interface AxiosResponse<T = any, D = any> {
data: T;
status: number;
statusText: string;
headers: RawAxiosResponseHeaders | AxiosResponseHeaders;
config: InternalAxiosRequestConfig<D>;
request?: any;
} |
1,314 | (response: AxiosResponse) => 'foo' | interface AxiosResponse<T = any, D = any> {
data: T;
status: number;
statusText: string;
headers: RawAxiosResponseHeaders | AxiosResponseHeaders;
config: InternalAxiosRequestConfig<D>;
request?: any;
} |
1,315 | (response: AxiosResponse) => Promise.resolve('foo') | interface AxiosResponse<T = any, D = any> {
data: T;
status: number;
statusText: string;
headers: RawAxiosResponseHeaders | AxiosResponseHeaders;
config: InternalAxiosRequestConfig<D>;
request?: any;
} |
1,316 | (error: AxiosError) => {
if (axios.isAxiosError(error)) {
const axiosError: AxiosError = error;
}
// named export
if (isAxiosError(error)) {
const axiosError: AxiosError = error;
}
} | class AxiosError<T = unknown, D = any> extends Error {
constructor(
message?: string,
code?: string,
config?: InternalAxiosRequestConfig<D>,
request?: any,
response?: AxiosResponse<T, D>
);
config?: InternalAxiosRequestConfig<D>;
code?: string;
request?: any;
response?: AxiosR... |
1,317 | function getRequestConfig1(options: AxiosRequestConfig): AxiosRequestConfig {
return {
...options,
headers: {
...(options.headers as RawAxiosRequestHeaders),
Authorization: `Bearer ...`,
},
};
} | interface AxiosRequestConfig<D = any> {
url?: string;
method?: Method | string;
baseURL?: string;
transformRequest?: AxiosRequestTransformer | AxiosRequestTransformer[];
transformResponse?: AxiosResponseTransformer | AxiosResponseTransformer[];
headers?: (RawAxiosRequestHeaders & MethodsHeaders) | AxiosHead... |
1,318 | function getRequestConfig2(options: AxiosRequestConfig): AxiosRequestConfig {
return {
...options,
headers: {
...(options.headers as AxiosHeaders).toJSON(),
Authorization: `Bearer ...`,
},
};
} | interface AxiosRequestConfig<D = any> {
url?: string;
method?: Method | string;
baseURL?: string;
transformRequest?: AxiosRequestTransformer | AxiosRequestTransformer[];
transformResponse?: AxiosResponseTransformer | AxiosResponseTransformer[];
headers?: (RawAxiosRequestHeaders & MethodsHeaders) | AxiosHead... |
1,319 | (e: AxiosProgressEvent) => {
console.log(e.loaded);
console.log(e.total);
console.log(e.progress);
console.log(e.rate);
} | interface AxiosProgressEvent {
loaded: number;
total?: number;
progress?: number;
bytes: number;
rate?: number;
estimated?: number;
upload?: boolean;
download?: boolean;
event?: BrowserProgressEvent;
} |
1,320 | (opts: Y18NOpts) => {
return _y18n(opts, shim)
} | interface Y18NOpts {
directory?: string;
updateFiles?: boolean;
locale?: string;
fallbackToLanguage?: boolean;
} |
1,321 | (opts: Y18NOpts) => {
return _y18n(opts, nodePlatformShim)
} | interface Y18NOpts {
directory?: string;
updateFiles?: boolean;
locale?: string;
fallbackToLanguage?: boolean;
} |
1,322 | constructor (opts: Y18NOpts) {
// configurable options.
opts = opts || {}
this.directory = opts.directory || './locales'
this.updateFiles = typeof opts.updateFiles === 'boolean' ? opts.updateFiles : true
this.locale = opts.locale || 'en'
this.fallbackToLanguage = typeof opts.fallbackToLanguage =... | interface Y18NOpts {
directory?: string;
updateFiles?: boolean;
locale?: string;
fallbackToLanguage?: boolean;
} |
1,323 | updateLocale (obj: Locale) {
if (!this.cache[this.locale]) this._readLocaleFile()
for (const key in obj) {
if (Object.prototype.hasOwnProperty.call(obj, key)) {
this.cache[this.locale][key] = obj[key]
}
}
} | interface Locale {
[key: string]: string
} |
1,324 | _enqueueWrite (work: Work) {
this.writeQueue.push(work)
if (this.writeQueue.length === 1) this._processWriteQueue()
} | interface Work {
directory: string;
locale: string;
cb: Function
} |
1,325 | function y18n (opts: Y18NOpts, _shim: PlatformShim) {
shim = _shim
const y18n = new Y18N(opts)
return {
__: y18n.__.bind(y18n),
__n: y18n.__n.bind(y18n),
setLocale: y18n.setLocale.bind(y18n),
getLocale: y18n.getLocale.bind(y18n),
updateLocale: y18n.updateLocale.bind(y18n),
locale: y18n.loc... | interface PlatformShim {
fs: {
readFileSync: Function,
writeFile: Function
},
exists: Function,
format: Function,
resolve: Function
} |
1,326 | function y18n (opts: Y18NOpts, _shim: PlatformShim) {
shim = _shim
const y18n = new Y18N(opts)
return {
__: y18n.__.bind(y18n),
__n: y18n.__n.bind(y18n),
setLocale: y18n.setLocale.bind(y18n),
getLocale: y18n.getLocale.bind(y18n),
updateLocale: y18n.updateLocale.bind(y18n),
locale: y18n.loc... | interface Y18NOpts {
directory?: string;
updateFiles?: boolean;
locale?: string;
fallbackToLanguage?: boolean;
} |
1,327 | (memory: Memory) => {
let last = 0;
return (op: Op, input: Array<number>): number => {
switch (op) {
case 'MemoryAdd': {
return memory.add(last);
}
case 'MemoryClear': {
memory.reset();
return last;
}
case 'MemorySub': {
return memory.subtract(last)... | class Memory {
current: number;
constructor() {
this.current = 0;
}
add(entry: number) {
this.current += entry;
return this.current;
}
subtract(entry: number) {
this.current -= entry;
return this.current;
}
reset() {
this.current = 0;
}
} |
1,328 | (op: Op, input: Array<number>): number => {
switch (op) {
case 'MemoryAdd': {
return memory.add(last);
}
case 'MemoryClear': {
memory.reset();
return last;
}
case 'MemorySub': {
return memory.subtract(last);
}
case 'Sub': {
const [a, ... | type Op = 'MemoryAdd' | 'MemoryClear' | 'MemorySub' | 'Sub' | 'Sum'; |
1,329 | constructor(dataService: DataService) {
this.title = dataService.getTitle();
} | class DataService {
constructor(private subService: SubService) {}
getTitle() {
return this.subService.getTitle();
}
} |
1,330 | constructor(private subService: SubService) {} | class SubService {
public getTitle() {
return 'Angular App with Jest';
}
} |
1,331 | function normalizeStdoutAndStderrOnResult(
result: RunJestResult,
options: RunJestOptions,
): RunJestResult {
const stdout = normalizeStreamString(result.stdout, options);
const stderr = normalizeStreamString(result.stderr, options);
return {...result, stderr, stdout};
} | type RunJestResult = execa.ExecaReturnValue; |
1,332 | function normalizeStdoutAndStderrOnResult(
result: RunJestResult,
options: RunJestOptions,
): RunJestResult {
const stdout = normalizeStreamString(result.stdout, options);
const stderr = normalizeStreamString(result.stderr, options);
return {...result, stderr, stdout};
} | type RunJestOptions = {
keepTrailingNewline?: boolean; // keep final newline in output from stdout and stderr
nodeOptions?: string;
nodePath?: string;
skipPkgJsonCheck?: boolean; // don't complain if can't find package.json
stripAnsi?: boolean; // remove colors from stdout and stderr,
timeout?: number; // k... |
1,333 | (arg: StdErrAndOutString) => boolean | type StdErrAndOutString = {stderr: string; stdout: string}; |
1,334 | (arg: StdErrAndOutString) => void | type StdErrAndOutString = {stderr: string; stdout: string}; |
1,335 | async waitUntil(fn: ConditionFunction) {
await new Promise<void>((resolve, reject) => {
const check: CheckerFunction = state => {
if (fn(state)) {
pending.delete(check);
pendingRejection.delete(check);
resolve();
}
};
const error = ne... | type ConditionFunction = (arg: StdErrAndOutString) => boolean; |
1,336 | constructor(config: JestEnvironmentConfig, context: EnvironmentContext) {
super(config, context);
this.global.one = 1;
} | type EnvironmentContext = {
console: Console;
docblockPragmas: Record<string, string | Array<string>>;
testPath: string;
}; |
1,337 | constructor(config: JestEnvironmentConfig, context: EnvironmentContext) {
super(config, context);
this.global.one = 1;
} | interface JestEnvironmentConfig {
projectConfig: Config.ProjectConfig;
globalConfig: Config.GlobalConfig;
} |
1,338 | (result: RunJestResult) => result.stdout.split('\n')[1].trim() | type RunJestResult = execa.ExecaReturnValue; |
1,339 | (transformerConfig?: TransformerConfig) => X | Promise<X> | type TransformerConfig = [string, Record<string, unknown>]; |
1,340 | function handlePotentialSyntaxError(
e: ErrorWithCodeFrame,
): ErrorWithCodeFrame {
if (e.codeFrame != null) {
e.stack = `${e.message}\n${e.codeFrame}`;
}
if (
// `instanceof` might come from the wrong context
e.name === 'SyntaxError' &&
!e.message.includes(' expected')
) {
throw enhanceU... | interface ErrorWithCodeFrame extends Error {
codeFrame?: string;
} |
1,341 | function assertSyncTransformer(
transformer: Transformer,
name: string | undefined,
): asserts transformer is SyncTransformer {
invariant(name);
invariant(
typeof transformer.process === 'function',
makeInvalidSyncTransformerError(name),
);
} | type Transformer<TransformerConfig = unknown> =
| SyncTransformer<TransformerConfig>
| AsyncTransformer<TransformerConfig>; |
1,342 | _getCachePath(testContext: TestContext): string {
const {config} = testContext;
const HasteMapClass = HasteMap.getStatic(config);
return HasteMapClass.getCacheFilePath(
config.cacheDirectory,
`perf-cache-${config.id}`,
);
} | type TestContext = {
config: Config.ProjectConfig;
hasteFS: IHasteFS;
moduleMap: IModuleMap;
resolver: Resolver;
}; |
1,343 | _getCachePath(testContext: TestContext): string {
const {config} = testContext;
const HasteMapClass = HasteMap.getStatic(config);
return HasteMapClass.getCacheFilePath(
config.cacheDirectory,
`perf-cache-${config.id}`,
);
} | type TestContext = Record<string, unknown>; |
1,344 | _getCachePath(testContext: TestContext): string {
const {config} = testContext;
const HasteMapClass = HasteMap.getStatic(config);
return HasteMapClass.getCacheFilePath(
config.cacheDirectory,
`perf-cache-${config.id}`,
);
} | type TestContext = Global.TestContext; |
1,345 | _getCache(test: Test): Cache {
const {context} = test;
if (!this._cache.has(context) && context.config.cache) {
const cachePath = this._getCachePath(context);
if (fs.existsSync(cachePath)) {
try {
this._cache.set(
context,
JSON.parse(fs.readFileSync(cachePat... | type Test = {
context: TestContext;
duration?: number;
path: string;
}; |
1,346 | _getCache(test: Test): Cache {
const {context} = test;
if (!this._cache.has(context) && context.config.cache) {
const cachePath = this._getCachePath(context);
if (fs.existsSync(cachePath)) {
try {
this._cache.set(
context,
JSON.parse(fs.readFileSync(cachePat... | type Test = (arg0: any) => boolean; |
1,347 | private _shardPosition(options: ShardPositionOptions): number {
const shardRest = options.suiteLength % options.shardCount;
const ratio = options.suiteLength / options.shardCount;
return new Array(options.shardIndex)
.fill(true)
.reduce<number>((acc, _, shardIndex) => {
const dangles = ... | type ShardPositionOptions = ShardOptions & {
suiteLength: number;
}; |
1,348 | ({path, context: {hasteFS}}: Test) =>
stats[path] || (stats[path] = hasteFS.getSize(path) ?? 0) | type Test = {
context: TestContext;
duration?: number;
path: string;
}; |
1,349 | ({path, context: {hasteFS}}: Test) =>
stats[path] || (stats[path] = hasteFS.getSize(path) ?? 0) | type Test = (arg0: any) => boolean; |
1,350 | (cache: Cache, test: Test) =>
cache[test.path]?.[0] === FAIL | type Test = {
context: TestContext;
duration?: number;
path: string;
}; |
1,351 | (cache: Cache, test: Test) =>
cache[test.path]?.[0] === FAIL | type Test = (arg0: any) => boolean; |
1,352 | (cache: Cache, test: Test) =>
cache[test.path]?.[0] === FAIL | type Cache = {
[key: string]: [0 | 1, number] | undefined;
}; |
1,353 | (cache: Cache, test: Test) =>
cache[test.path]?.[0] === FAIL | type Cache = {
content: string;
clear: string;
}; |
1,354 | private hasFailed(test: Test) {
const cache = this._getCache(test);
return cache[test.path]?.[0] === FAIL;
} | type Test = {
context: TestContext;
duration?: number;
path: string;
}; |
1,355 | private hasFailed(test: Test) {
const cache = this._getCache(test);
return cache[test.path]?.[0] === FAIL;
} | type Test = (arg0: any) => boolean; |
1,356 | private time(test: Test) {
const cache = this._getCache(test);
return cache[test.path]?.[1];
} | type Test = {
context: TestContext;
duration?: number;
path: string;
}; |
1,357 | private time(test: Test) {
const cache = this._getCache(test);
return cache[test.path]?.[1];
} | type Test = (arg0: any) => boolean; |
1,358 | private _runImmediate(immediate: Tick) {
try {
immediate.callback();
} finally {
this._fakeClearImmediate(immediate.uuid);
}
} | type Tick = {
uuid: string;
callback: Callback;
}; |
1,359 | runWithRealTimers(cb: Callback): void {
const prevClearImmediate = this._global.clearImmediate;
const prevClearInterval = this._global.clearInterval;
const prevClearTimeout = this._global.clearTimeout;
const prevNextTick = this._global.process.nextTick;
const prevSetImmediate = this._global.setImmed... | type Callback = (...args: Array<unknown>) => void; |
1,360 | runWithRealTimers(cb: Callback): void {
const prevClearImmediate = this._global.clearImmediate;
const prevClearInterval = this._global.clearInterval;
const prevClearTimeout = this._global.clearTimeout;
const prevNextTick = this._global.process.nextTick;
const prevSetImmediate = this._global.setImmed... | type Callback = (result: Result) => void; |
1,361 | private _fakeClearImmediate(uuid: TimerID) {
this._immediates = this._immediates.filter(
immediate => immediate.uuid !== uuid,
);
} | type TimerID = string; |
1,362 | private _fakeNextTick(callback: Callback, ...args: Array<unknown>) {
if (this._disposed) {
return;
}
const uuid = String(this._uuidCounter++);
this._ticks.push({
callback: () => callback.apply(null, args),
uuid,
});
const cancelledTicks = this._cancelledTicks;
this._time... | type Callback = (...args: Array<unknown>) => void; |
1,363 | private _fakeNextTick(callback: Callback, ...args: Array<unknown>) {
if (this._disposed) {
return;
}
const uuid = String(this._uuidCounter++);
this._ticks.push({
callback: () => callback.apply(null, args),
uuid,
});
const cancelledTicks = this._cancelledTicks;
this._time... | type Callback = (result: Result) => void; |
1,364 | private _fakeRequestAnimationFrame(callback: Callback) {
return this._fakeSetTimeout(() => {
// TODO: Use performance.now() once it's mocked
callback(this._now);
}, 1000 / 60);
} | type Callback = (...args: Array<unknown>) => void; |
1,365 | private _fakeRequestAnimationFrame(callback: Callback) {
return this._fakeSetTimeout(() => {
// TODO: Use performance.now() once it's mocked
callback(this._now);
}, 1000 / 60);
} | type Callback = (result: Result) => void; |
1,366 | private _fakeSetImmediate(callback: Callback, ...args: Array<unknown>) {
if (this._disposed) {
return null;
}
const uuid = String(this._uuidCounter++);
this._immediates.push({
callback: () => callback.apply(null, args),
uuid,
});
this._timerAPIs.setImmediate(() => {
if... | type Callback = (...args: Array<unknown>) => void; |
1,367 | private _fakeSetImmediate(callback: Callback, ...args: Array<unknown>) {
if (this._disposed) {
return null;
}
const uuid = String(this._uuidCounter++);
this._immediates.push({
callback: () => callback.apply(null, args),
uuid,
});
this._timerAPIs.setImmediate(() => {
if... | type Callback = (result: Result) => void; |
1,368 | private _fakeSetInterval(
callback: Callback,
intervalDelay?: number,
...args: Array<unknown>
) {
if (this._disposed) {
return null;
}
if (intervalDelay == null) {
intervalDelay = 0;
}
const uuid = this._uuidCounter++;
this._timers.set(String(uuid), {
callback:... | type Callback = (...args: Array<unknown>) => void; |
1,369 | private _fakeSetInterval(
callback: Callback,
intervalDelay?: number,
...args: Array<unknown>
) {
if (this._disposed) {
return null;
}
if (intervalDelay == null) {
intervalDelay = 0;
}
const uuid = this._uuidCounter++;
this._timers.set(String(uuid), {
callback:... | type Callback = (result: Result) => void; |
1,370 | private _fakeSetTimeout(
callback: Callback,
delay?: number,
...args: Array<unknown>
) {
if (this._disposed) {
return null;
}
// eslint-disable-next-line no-bitwise
delay = Number(delay) | 0;
const uuid = this._uuidCounter++;
this._timers.set(String(uuid), {
callback... | type Callback = (...args: Array<unknown>) => void; |
1,371 | private _fakeSetTimeout(
callback: Callback,
delay?: number,
...args: Array<unknown>
) {
if (this._disposed) {
return null;
}
// eslint-disable-next-line no-bitwise
delay = Number(delay) | 0;
const uuid = this._uuidCounter++;
this._timers.set(String(uuid), {
callback... | type Callback = (result: Result) => void; |
1,372 | private _runTimerHandle(timerHandle: TimerID) {
const timer = this._timers.get(timerHandle);
if (!timer) {
// Timer has been cleared - we'll hit this when a timer is cleared within
// another timer in runOnlyPendingTimers
return;
}
switch (timer.type) {
case 'timeout':
... | type TimerID = string; |
1,373 | constructor(config: JestEnvironmentConfig, context: EnvironmentContext) {
const {projectConfig} = config;
const virtualConsole = new VirtualConsole();
virtualConsole.sendTo(context.console, {omitJSDOMErrors: true});
virtualConsole.on('jsdomError', error => {
context.console.error(error);
});
... | type EnvironmentContext = {
console: Console;
docblockPragmas: Record<string, string | Array<string>>;
testPath: string;
}; |
1,374 | constructor(config: JestEnvironmentConfig, context: EnvironmentContext) {
const {projectConfig} = config;
const virtualConsole = new VirtualConsole();
virtualConsole.sendTo(context.console, {omitJSDOMErrors: true});
virtualConsole.on('jsdomError', error => {
context.console.error(error);
});
... | interface JestEnvironmentConfig {
projectConfig: Config.ProjectConfig;
globalConfig: Config.GlobalConfig;
} |
1,375 | (runDetails: RunDetails) => void | type RunDetails = {
totalSpecsDefined?: number;
failedExpectations?: SuiteResult['failedExpectations'];
}; |
1,376 | (result: SpecResult) => void | 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,377 | (spec: SpecResult) => void | 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,378 | (result: SuiteResult) => void | type SuiteResult = {
id: string;
description: string;
fullName: string;
failedExpectations: Array<ReturnType<typeof expectationResultFactory>>;
testPath: string;
status?: string;
}; |
1,379 | (matchers: JasmineMatchersObject) => void | type JasmineMatchersObject = {[id: string]: JasmineMatcher}; |
1,380 | (spec: Spec) => testNameRegex.test(spec.getFullName()) | 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,381 | (spec: Spec) => testNameRegex.test(spec.getFullName()) | 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,382 | (results: TestResult, snapshotState: SnapshotState) => {
results.testResults.forEach(({fullName, status}: AssertionResult) => {
if (status === 'pending' || status === 'failed') {
// if test is skipped or failed, we don't want to mark
// its snapshots as obsolete.
snapshotState.markSnapshotsAsChe... | class SnapshotState {
private _counters: Map<string, number>;
private _dirty: boolean;
// @ts-expect-error - seemingly unused?
private _index: number;
private readonly _updateSnapshot: Config.SnapshotUpdateState;
private _snapshotData: SnapshotData;
private readonly _initialData: SnapshotData;
private r... |
1,383 | (results: TestResult, snapshotState: SnapshotState) => {
results.testResults.forEach(({fullName, status}: AssertionResult) => {
if (status === 'pending' || status === 'failed') {
// if test is skipped or failed, we don't want to mark
// its snapshots as obsolete.
snapshotState.markSnapshotsAsChe... | type TestResult = {
console?: ConsoleBuffer;
coverage?: CoverageMapData;
displayName?: Config.DisplayName;
failureMessage?: string | null;
leaks: boolean;
memoryUsage?: number;
numFailingTests: number;
numPassingTests: number;
numPendingTests: number;
numTodoTests: number;
openHandles: Array<Error... |
1,384 | (results: TestResult, snapshotState: SnapshotState) => {
results.testResults.forEach(({fullName, status}: AssertionResult) => {
if (status === 'pending' || status === 'failed') {
// if test is skipped or failed, we don't want to mark
// its snapshots as obsolete.
snapshotState.markSnapshotsAsChe... | type TestResult = {
duration?: number | null;
errors: Array<FormattedError>;
errorsDetailed: Array<MatcherResults | unknown>;
invocations: number;
status: TestStatus;
location?: {column: number; line: number} | null;
numPassingAsserts: number;
retryReasons: Array<FormattedError>;
testPath: Array<TestN... |
1,385 | ({fullName, status}: AssertionResult) => {
if (status === 'pending' || status === 'failed') {
// if test is skipped or failed, we don't want to mark
// its snapshots as obsolete.
snapshotState.markSnapshotsAsCheckedForTest(fullName);
}
} | type AssertionResult = TestResult.AssertionResult; |
1,386 | ({fullName, status}: AssertionResult) => {
if (status === 'pending' || status === 'failed') {
// if test is skipped or failed, we don't want to mark
// its snapshots as obsolete.
snapshotState.markSnapshotsAsCheckedForTest(fullName);
}
} | type AssertionResult = {
ancestorTitles: Array<string>;
duration?: number | null;
failureDetails: Array<unknown>;
failureMessages: Array<string>;
fullName: string;
invocations?: number;
location?: Callsite | null;
numPassingAsserts: number;
retryReasons?: Array<string>;
status: Status;
title: stri... |
1,387 | (done: DoneFn) => void | interface DoneFn {
(error?: any): void;
fail: (error: Error) => void;
} |
1,388 | (done: DoneFn) => void | type DoneFn = (reason?: string | Error) => void; |
1,389 | (done: DoneFn) => void | type DoneFn = Global.DoneFn; |
1,390 | function queueRunner(options: Options): PromiseLike<void> & {
cancel: () => void;
catch: (onRejected?: PromiseCallback) => Promise<void>;
} {
const token = new PCancelable<void>((onCancel, resolve) => {
onCancel(resolve);
});
const mapper = ({fn, timeout, initError = new Error()}: QueueableFn) => {
l... | interface Options
extends ShouldInstrumentOptions,
CallerTransformOptions {
isInternalModule?: boolean;
} |
1,391 | function queueRunner(options: Options): PromiseLike<void> & {
cancel: () => void;
catch: (onRejected?: PromiseCallback) => Promise<void>;
} {
const token = new PCancelable<void>((onCancel, resolve) => {
onCancel(resolve);
});
const mapper = ({fn, timeout, initError = new Error()}: QueueableFn) => {
l... | type Options = {
clearTimeout: (typeof globalThis)['clearTimeout'];
fail: (error: Error) => void;
onException: (error: Error) => void;
queueableFns: Array<QueueableFn>;
setTimeout: (typeof globalThis)['setTimeout'];
userContext: unknown;
}; |
1,392 | function queueRunner(options: Options): PromiseLike<void> & {
cancel: () => void;
catch: (onRejected?: PromiseCallback) => Promise<void>;
} {
const token = new PCancelable<void>((onCancel, resolve) => {
onCancel(resolve);
});
const mapper = ({fn, timeout, initError = new Error()}: QueueableFn) => {
l... | type Options = {
matcherName: string;
passed: boolean;
actual?: any;
error?: any;
expected?: any;
message?: string | null;
}; |
1,393 | function queueRunner(options: Options): PromiseLike<void> & {
cancel: () => void;
catch: (onRejected?: PromiseCallback) => Promise<void>;
} {
const token = new PCancelable<void>((onCancel, resolve) => {
onCancel(resolve);
});
const mapper = ({fn, timeout, initError = new Error()}: QueueableFn) => {
l... | type Options = {
nodeComplete: (suite: TreeNode) => void;
nodeStart: (suite: TreeNode) => void;
queueRunnerFactory: any;
runnableIds: Array<string>;
tree: TreeNode;
}; |
1,394 | function queueRunner(options: Options): PromiseLike<void> & {
cancel: () => void;
catch: (onRejected?: PromiseCallback) => Promise<void>;
} {
const token = new PCancelable<void>((onCancel, resolve) => {
onCancel(resolve);
});
const mapper = ({fn, timeout, initError = new Error()}: QueueableFn) => {
l... | type Options = {
lastCommit?: boolean;
withAncestor?: boolean;
changedSince?: string;
includePaths?: Array<string>;
}; |
1,395 | function queueRunner(options: Options): PromiseLike<void> & {
cancel: () => void;
catch: (onRejected?: PromiseCallback) => Promise<void>;
} {
const token = new PCancelable<void>((onCancel, resolve) => {
onCancel(resolve);
});
const mapper = ({fn, timeout, initError = new Error()}: QueueableFn) => {
l... | 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,396 | function queueRunner(options: Options): PromiseLike<void> & {
cancel: () => void;
catch: (onRejected?: PromiseCallback) => Promise<void>;
} {
const token = new PCancelable<void>((onCancel, resolve) => {
onCancel(resolve);
});
const mapper = ({fn, timeout, initError = new Error()}: QueueableFn) => {
l... | interface Options
extends Omit<RequiredOptions, 'compareKeys' | 'theme'> {
compareKeys: CompareKeys;
theme: Required<RequiredOptions['theme']>;
} |
1,397 | (onRejected?: PromiseCallback) => Promise<void> | type PromiseCallback = (() => void | PromiseLike<void>) | undefined | null; |
1,398 | ({fn, timeout, initError = new Error()}: QueueableFn) => {
let promise = new Promise<void>(resolve => {
const next = function (...args: [Error]) {
const err = args[0];
if (err) {
options.fail.apply(null, args);
}
resolve();
};
next.fail = function (...arg... | type QueueableFn = {
fn: (done: DoneFn) => void;
timeout?: () => number;
initError?: Error;
}; |
1,399 | (jasmineMatchersObject: JasmineMatchersObject) => {
const jestMatchersObject = Object.create(null);
Object.keys(jasmineMatchersObject).forEach(name => {
jestMatchersObject[name] = function (...args: Array<unknown>) {
// use "expect.extend" if you need to use equality testers (via this.equal)
... | type JasmineMatchersObject = {[id: string]: JasmineMatcher}; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.