id int64 0 3.78k | code stringlengths 13 37.9k | declarations stringlengths 16 64.6k |
|---|---|---|
1,600 | create(options: Options): Promise<IHasteMap> | interface Options
extends ShouldInstrumentOptions,
CallerTransformOptions {
isInternalModule?: boolean;
} |
1,601 | create(options: Options): Promise<IHasteMap> | type Options = {
clearTimeout: (typeof globalThis)['clearTimeout'];
fail: (error: Error) => void;
onException: (error: Error) => void;
queueableFns: Array<QueueableFn>;
setTimeout: (typeof globalThis)['setTimeout'];
userContext: unknown;
}; |
1,602 | create(options: Options): Promise<IHasteMap> | type Options = {
matcherName: string;
passed: boolean;
actual?: any;
error?: any;
expected?: any;
message?: string | null;
}; |
1,603 | create(options: Options): Promise<IHasteMap> | type Options = {
nodeComplete: (suite: TreeNode) => void;
nodeStart: (suite: TreeNode) => void;
queueRunnerFactory: any;
runnableIds: Array<string>;
tree: TreeNode;
}; |
1,604 | create(options: Options): Promise<IHasteMap> | type Options = {
lastCommit?: boolean;
withAncestor?: boolean;
changedSince?: string;
includePaths?: Array<string>;
}; |
1,605 | create(options: Options): Promise<IHasteMap> | 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,606 | create(options: Options): Promise<IHasteMap> | interface Options
extends Omit<RequiredOptions, 'compareKeys' | 'theme'> {
compareKeys: CompareKeys;
theme: Required<RequiredOptions['theme']>;
} |
1,607 | async function worker(data: WorkerMessage): Promise<WorkerMetadata> {
if (
data.hasteImplModulePath &&
data.hasteImplModulePath !== hasteImplModulePath
) {
if (hasteImpl) {
throw new Error('jest-haste-map: hasteImplModulePath changed');
}
hasteImplModulePath = data.hasteImplModulePath;
... | type WorkerMessage = {
computeDependencies: boolean;
computeSha1: boolean;
dependencyExtractor?: string | null;
rootDir: string;
filePath: string;
hasteImplModulePath?: string;
retainAllFiles?: boolean;
}; |
1,608 | async function getSha1(data: WorkerMessage): Promise<WorkerMetadata> {
const sha1 = data.computeSha1
? sha1hex(fs.readFileSync(data.filePath))
: null;
return {
dependencies: undefined,
id: undefined,
module: undefined,
sha1,
};
} | type WorkerMessage = {
computeDependencies: boolean;
computeSha1: boolean;
dependencyExtractor?: string | null;
rootDir: string;
filePath: string;
hasteImplModulePath?: string;
retainAllFiles?: boolean;
}; |
1,609 | constructor(raw: RawModuleMap) {
this._raw = raw;
} | type RawModuleMap = {
rootDir: string;
duplicates: DuplicatesIndex;
map: ModuleMapData;
mocks: MockData;
}; |
1,610 | static fromJSON(serializableModuleMap: SerializableModuleMap): ModuleMap {
return new ModuleMap({
duplicates: ModuleMap.mapFromArrayRecursive(
serializableModuleMap.duplicates,
) as RawModuleMap['duplicates'],
map: new Map(serializableModuleMap.map),
mocks: new Map(serializableModule... | type SerializableModuleMap = {
duplicates: ReadonlyArray<[string, [string, [string, [string, number]]]]>;
map: ReadonlyArray<[string, ValueType<ModuleMapData>]>;
mocks: ReadonlyArray<[string, ValueType<MockData>]>;
rootDir: string;
}; |
1,611 | async function watchmanCrawl(options: CrawlerOptions): Promise<{
changedFiles?: FileData;
removedFiles: FileData;
hasteMap: InternalHasteMap;
}> {
const fields = ['name', 'exists', 'mtime_ms', 'size'];
const {data, extensions, ignore, rootDir, roots} = options;
const defaultWatchExpression: Array<any> = ['a... | type CrawlerOptions = {
computeSha1: boolean;
enableSymlinks: boolean;
data: InternalHasteMap;
extensions: Array<string>;
forceNodeFilesystemAPI: boolean;
ignore: IgnoreMatcher;
rootDir: string;
roots: Array<string>;
}; |
1,612 | async function queryWatchmanForDirs(rootProjectDirMappings: WatchmanRoots) {
const results = new Map<string, WatchmanQueryResponse>();
let isFresh = false;
await Promise.all(
Array.from(rootProjectDirMappings).map(
async ([root, directoryFilters]) => {
const expression = Array.from(d... | type WatchmanRoots = Map<string, Array<string>>; |
1,613 | (result: Result) => void | interface Result extends ExecaSyncReturnValue {
status: number;
error: string;
} |
1,614 | (result: Result) => void | type Result = Array<[/* id */ string, /* mtime */ number, /* size */ number]>; |
1,615 | async function nodeCrawl(options: CrawlerOptions): Promise<{
removedFiles: FileData;
hasteMap: InternalHasteMap;
}> {
const {
data,
extensions,
forceNodeFilesystemAPI,
ignore,
rootDir,
enableSymlinks,
roots,
} = options;
const useNativeFind = await hasNativeFindSupport(forceNodeFi... | type CrawlerOptions = {
computeSha1: boolean;
enableSymlinks: boolean;
data: InternalHasteMap;
extensions: Array<string>;
forceNodeFilesystemAPI: boolean;
ignore: IgnoreMatcher;
rootDir: string;
roots: Array<string>;
}; |
1,616 | (list: Result) => {
const files = new Map();
const removedFiles = new Map(data.files);
list.forEach(fileData => {
const [filePath, mtime, size] = fileData;
const relativeFilePath = fastPath.relative(rootDir, filePath);
const existingFile = data.files.get(relativeFilePath);
... | interface Result extends ExecaSyncReturnValue {
status: number;
error: string;
} |
1,617 | (list: Result) => {
const files = new Map();
const removedFiles = new Map(data.files);
list.forEach(fileData => {
const [filePath, mtime, size] = fileData;
const relativeFilePath = fastPath.relative(rootDir, filePath);
const existingFile = data.files.get(relativeFilePath);
... | type Result = Array<[/* id */ string, /* mtime */ number, /* size */ number]>; |
1,618 | private _emit(type: FsEventsWatcherEvent, file: string, stat?: fs.Stats) {
this.emit(type, file, this.root, stat);
this.emit(ALL_EVENT, type, file, this.root, stat);
} | type FsEventsWatcherEvent =
| typeof CHANGE_EVENT
| typeof DELETE_EVENT
| typeof ADD_EVENT
| typeof ALL_EVENT; |
1,619 | function isNewPlugin(plugin: Plugin): plugin is NewPlugin {
return (plugin as NewPlugin).serialize != null;
} | type Plugin = NewPlugin | OldPlugin; |
1,620 | function printPlugin(
plugin: Plugin,
val: any,
config: Config,
indentation: string,
depth: number,
refs: Refs,
): string {
let printed;
try {
printed = isNewPlugin(plugin)
? plugin.serialize(val, config, indentation, depth, refs, printer)
: plugin.print(
val,
valChi... | type Plugin = NewPlugin | OldPlugin; |
1,621 | function printPlugin(
plugin: Plugin,
val: any,
config: Config,
indentation: string,
depth: number,
refs: Refs,
): string {
let printed;
try {
printed = isNewPlugin(plugin)
? plugin.serialize(val, config, indentation, depth, refs, printer)
: plugin.print(
val,
valChi... | type Config = ConfigTypes.InitialOptions; |
1,622 | function printPlugin(
plugin: Plugin,
val: any,
config: Config,
indentation: string,
depth: number,
refs: Refs,
): string {
let printed;
try {
printed = isNewPlugin(plugin)
? plugin.serialize(val, config, indentation, depth, refs, printer)
: plugin.print(
val,
valChi... | type Config = {
callToJSON: boolean;
compareKeys: CompareKeys;
colors: Colors;
escapeRegex: boolean;
escapeString: boolean;
indent: string;
maxDepth: number;
maxWidth: number;
min: boolean;
plugins: Plugins;
printBasicPrototype: boolean;
printFunctionName: boolean;
spacingInner: string;
spac... |
1,623 | function printPlugin(
plugin: Plugin,
val: any,
config: Config,
indentation: string,
depth: number,
refs: Refs,
): string {
let printed;
try {
printed = isNewPlugin(plugin)
? plugin.serialize(val, config, indentation, depth, refs, printer)
: plugin.print(
val,
valChi... | type Refs = Array<unknown>; |
1,624 | function findPlugin(plugins: Plugins, val: unknown) {
for (let p = 0; p < plugins.length; p++) {
try {
if (plugins[p].test(val)) {
return plugins[p];
}
} catch (error: any) {
throw new PrettyFormatPluginError(error.message, error.stack);
}
}
return null;
} | type Plugins = Array<Plugin>; |
1,625 | function validateOptions(options: OptionsReceived) {
Object.keys(options).forEach(key => {
if (!Object.prototype.hasOwnProperty.call(DEFAULT_OPTIONS, key)) {
throw new Error(`pretty-format: Unknown option "${key}".`);
}
});
if (options.min && options.indent !== undefined && options.indent !== 0) {
... | type OptionsReceived = PrettyFormatOptions; |
1,626 | (options: OptionsReceived): Colors =>
DEFAULT_THEME_KEYS.reduce((colors, key) => {
const value =
options.theme && options.theme[key] !== undefined
? options.theme[key]
: DEFAULT_THEME[key];
const color = value && (style as any)[value];
if (
color &&
typeof color.close ===... | type OptionsReceived = PrettyFormatOptions; |
1,627 | (options?: OptionsReceived) =>
options?.printFunctionName ?? DEFAULT_OPTIONS.printFunctionName | type OptionsReceived = PrettyFormatOptions; |
1,628 | (options?: OptionsReceived) =>
options?.escapeRegex ?? DEFAULT_OPTIONS.escapeRegex | type OptionsReceived = PrettyFormatOptions; |
1,629 | (options?: OptionsReceived) =>
options?.escapeString ?? DEFAULT_OPTIONS.escapeString | type OptionsReceived = PrettyFormatOptions; |
1,630 | (options?: OptionsReceived): Config => ({
callToJSON: options?.callToJSON ?? DEFAULT_OPTIONS.callToJSON,
colors: options?.highlight ? getColorsHighlight(options) : getColorsEmpty(),
compareKeys:
typeof options?.compareKeys === 'function' || options?.compareKeys === null
? options.compareKeys
: DEF... | type OptionsReceived = PrettyFormatOptions; |
1,631 | function nodeIsText(node: HandledType): node is Text {
return node.nodeType === TEXT_NODE;
} | type HandledType = Element | Text | Comment | DocumentFragment; |
1,632 | function nodeIsComment(node: HandledType): node is Comment {
return node.nodeType === COMMENT_NODE;
} | type HandledType = Element | Text | Comment | DocumentFragment; |
1,633 | function nodeIsFragment(node: HandledType): node is DocumentFragment {
return node.nodeType === FRAGMENT_NODE;
} | type HandledType = Element | Text | Comment | DocumentFragment; |
1,634 | (
node: HandledType,
config: Config,
indentation: string,
depth: number,
refs: Refs,
printer: Printer,
) => {
if (nodeIsText(node)) {
return printText(node.data, config);
}
if (nodeIsComment(node)) {
return printComment(node.data, config);
}
const type = nodeIsFragment(node)
? 'Docum... | type Config = ConfigTypes.InitialOptions; |
1,635 | (
node: HandledType,
config: Config,
indentation: string,
depth: number,
refs: Refs,
printer: Printer,
) => {
if (nodeIsText(node)) {
return printText(node.data, config);
}
if (nodeIsComment(node)) {
return printComment(node.data, config);
}
const type = nodeIsFragment(node)
? 'Docum... | type Config = {
callToJSON: boolean;
compareKeys: CompareKeys;
colors: Colors;
escapeRegex: boolean;
escapeString: boolean;
indent: string;
maxDepth: number;
maxWidth: number;
min: boolean;
plugins: Plugins;
printBasicPrototype: boolean;
printFunctionName: boolean;
spacingInner: string;
spac... |
1,636 | (
node: HandledType,
config: Config,
indentation: string,
depth: number,
refs: Refs,
printer: Printer,
) => {
if (nodeIsText(node)) {
return printText(node.data, config);
}
if (nodeIsComment(node)) {
return printComment(node.data, config);
}
const type = nodeIsFragment(node)
? 'Docum... | type HandledType = Element | Text | Comment | DocumentFragment; |
1,637 | (
node: HandledType,
config: Config,
indentation: string,
depth: number,
refs: Refs,
printer: Printer,
) => {
if (nodeIsText(node)) {
return printText(node.data, config);
}
if (nodeIsComment(node)) {
return printComment(node.data, config);
}
const type = nodeIsFragment(node)
? 'Docum... | type Refs = Array<unknown>; |
1,638 | (
node: HandledType,
config: Config,
indentation: string,
depth: number,
refs: Refs,
printer: Printer,
) => {
if (nodeIsText(node)) {
return printText(node.data, config);
}
if (nodeIsComment(node)) {
return printComment(node.data, config);
}
const type = nodeIsFragment(node)
? 'Docum... | type Printer = (
val: unknown,
config: Config,
indentation: string,
depth: number,
refs: Refs,
hasCalledToJSON?: boolean,
) => string; |
1,639 | (object: ReactTestObject) => {
const {props} = object;
return props
? Object.keys(props)
.filter(key => props[key] !== undefined)
.sort()
: [];
} | type ReactTestObject = {
$$typeof: symbol;
type: string;
props?: Record<string, unknown>;
children?: null | Array<ReactTestChild>;
}; |
1,640 | (
object: ReactTestObject,
config: Config,
indentation: string,
depth: number,
refs: Refs,
printer: Printer,
) =>
++depth > config.maxDepth
? printElementAsLeaf(object.type, config)
: printElement(
object.type,
object.props
? printProps(
getPropKeys(object),... | type ReactTestObject = {
$$typeof: symbol;
type: string;
props?: Record<string, unknown>;
children?: null | Array<ReactTestChild>;
}; |
1,641 | (
object: ReactTestObject,
config: Config,
indentation: string,
depth: number,
refs: Refs,
printer: Printer,
) =>
++depth > config.maxDepth
? printElementAsLeaf(object.type, config)
: printElement(
object.type,
object.props
? printProps(
getPropKeys(object),... | type Config = ConfigTypes.InitialOptions; |
1,642 | (
object: ReactTestObject,
config: Config,
indentation: string,
depth: number,
refs: Refs,
printer: Printer,
) =>
++depth > config.maxDepth
? printElementAsLeaf(object.type, config)
: printElement(
object.type,
object.props
? printProps(
getPropKeys(object),... | type Config = {
callToJSON: boolean;
compareKeys: CompareKeys;
colors: Colors;
escapeRegex: boolean;
escapeString: boolean;
indent: string;
maxDepth: number;
maxWidth: number;
min: boolean;
plugins: Plugins;
printBasicPrototype: boolean;
printFunctionName: boolean;
spacingInner: string;
spac... |
1,643 | (
object: ReactTestObject,
config: Config,
indentation: string,
depth: number,
refs: Refs,
printer: Printer,
) =>
++depth > config.maxDepth
? printElementAsLeaf(object.type, config)
: printElement(
object.type,
object.props
? printProps(
getPropKeys(object),... | type Refs = Array<unknown>; |
1,644 | (
object: ReactTestObject,
config: Config,
indentation: string,
depth: number,
refs: Refs,
printer: Printer,
) =>
++depth > config.maxDepth
? printElementAsLeaf(object.type, config)
: printElement(
object.type,
object.props
? printProps(
getPropKeys(object),... | type Printer = (
val: unknown,
config: Config,
indentation: string,
depth: number,
refs: Refs,
hasCalledToJSON?: boolean,
) => string; |
1,645 | (plugins: Plugins) => {
expect.extend({
toPrettyPrintTo(
received: unknown,
expected: unknown,
options?: OptionsReceived,
) {
const prettyFormatted = prettyFormat(received, {plugins, ...options});
const pass = prettyFormatted === expected;
return {
actual: prettyFo... | type Plugins = Array<Plugin>; |
1,646 | constructor(config: JestEnvironmentConfig, _context: EnvironmentContext) {
const {projectConfig} = config;
this.context = createContext();
const global = runInContext(
'this',
Object.assign(this.context, projectConfig.testEnvironmentOptions),
) as Global.Global;
this.global = global;
... | type EnvironmentContext = {
console: Console;
docblockPragmas: Record<string, string | Array<string>>;
testPath: string;
}; |
1,647 | constructor(config: JestEnvironmentConfig, _context: EnvironmentContext) {
const {projectConfig} = config;
this.context = createContext();
const global = runInContext(
'this',
Object.assign(this.context, projectConfig.testEnvironmentOptions),
) as Global.Global;
this.global = global;
... | interface JestEnvironmentConfig {
projectConfig: Config.ProjectConfig;
globalConfig: Config.GlobalConfig;
} |
1,648 | (timer: Timer): number | undefined => timer?.id | type Timer = {
type: string;
callback: Callback;
expiry: number;
interval?: number;
}; |
1,649 | (timer: Timer): number | undefined => timer?.id | class Timer {
start: () => void;
elapsed: () => number;
constructor(options?: {now?: () => number}) {
options = options || {};
const now = options.now || defaultNow;
let startTime: number;
this.start = function () {
startTime = now();
};
this.elapsed = function () {
return ... |
1,650 | (timer: Timer): number | undefined => timer?.id | type Timer = {
id: number;
ref: () => Timer;
unref: () => Timer;
}; |
1,651 | (test: Test) => Promise<void> | type Test = {
context: TestContext;
duration?: number;
path: string;
}; |
1,652 | (test: Test) => Promise<void> | type Test = (arg0: any) => boolean; |
1,653 | (
test: Test,
serializableError: SerializableError,
) => Promise<void> | type Test = {
context: TestContext;
duration?: number;
path: string;
}; |
1,654 | (
test: Test,
serializableError: SerializableError,
) => Promise<void> | type Test = (arg0: any) => boolean; |
1,655 | (
test: Test,
serializableError: SerializableError,
) => Promise<void> | type SerializableError = TestResult.SerializableError; |
1,656 | (
test: Test,
serializableError: SerializableError,
) => Promise<void> | type SerializableError = {
code?: unknown;
message: string;
stack: string | null | undefined;
type?: string;
}; |
1,657 | (
test: Test,
testResult: TestResult,
) => Promise<void> | type Test = {
context: TestContext;
duration?: number;
path: string;
}; |
1,658 | (
test: Test,
testResult: TestResult,
) => Promise<void> | type Test = (arg0: any) => boolean; |
1,659 | (
test: Test,
testResult: TestResult,
) => Promise<void> | 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,660 | (
test: Test,
testResult: TestResult,
) => Promise<void> | 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,661 | (test: Test) =>
mutex(async () => {
if (watcher.isInterrupted()) {
return Promise.reject();
}
await this.#eventEmitter.emit('test-file-start', [test]);
const promise = worker.worker({
config: test.context.config,
context: {
...this._conte... | type Test = {
context: TestContext;
duration?: number;
path: string;
}; |
1,662 | (test: Test) =>
mutex(async () => {
if (watcher.isInterrupted()) {
return Promise.reject();
}
await this.#eventEmitter.emit('test-file-start', [test]);
const promise = worker.worker({
config: test.context.config,
context: {
...this._conte... | type Test = (arg0: any) => boolean; |
1,663 | async function worker({
config,
globalConfig,
path,
context,
}: WorkerData): Promise<TestResult> {
try {
return await runTest(
path,
globalConfig,
config,
getResolver(config),
{
...context,
changedFiles: context.changedFiles && new Set(context.changedFiles),
... | type WorkerData = {
config: Config.ProjectConfig;
globalConfig: Config.GlobalConfig;
path: string;
context: TestRunnerSerializedContext;
}; |
1,664 | function fakeConsolePush(
_type: LogType,
message: LogMessage,
) {
const error = new ErrorWithStack(
`${chalk.red(
`${chalk.bold(
'Cannot log after tests are done.',
)} Did you forget to wait for something async in your test?`,
)}\nAttempted to log "${message}".`,
... | type LogType =
| 'assert'
| 'count'
| 'debug'
| 'dir'
| 'dirxml'
| 'error'
| 'group'
| 'groupCollapsed'
| 'info'
| 'log'
| 'time'
| 'warn'; |
1,665 | function fakeConsolePush(
_type: LogType,
message: LogMessage,
) {
const error = new ErrorWithStack(
`${chalk.red(
`${chalk.bold(
'Cannot log after tests are done.',
)} Did you forget to wait for something async in your test?`,
)}\nAttempted to log "${message}".`,
... | type LogMessage = string; |
1,666 | (type: LogType, message: LogMessage) =>
getConsoleOutput(
// 4 = the console call is buried 4 stack frames deep
BufferedConsole.write([], type, message, 4),
projectConfig,
globalConfig,
) | type LogType =
| 'assert'
| 'count'
| 'debug'
| 'dir'
| 'dirxml'
| 'error'
| 'group'
| 'groupCollapsed'
| 'info'
| 'log'
| 'time'
| 'warn'; |
1,667 | (type: LogType, message: LogMessage) =>
getConsoleOutput(
// 4 = the console call is buried 4 stack frames deep
BufferedConsole.write([], type, message, 4),
projectConfig,
globalConfig,
) | type LogMessage = string; |
1,668 | constructor(
resolver: Resolver,
hasteFS: IHasteFS,
snapshotResolver: SnapshotResolver,
) {
this._resolver = resolver;
this._hasteFS = hasteFS;
this._snapshotResolver = snapshotResolver;
} | type SnapshotResolver = {
/** Resolves from `testPath` to snapshot path. */
resolveSnapshotPath(testPath: string, snapshotExtension?: string): string;
/** Resolves from `snapshotPath` to test path. */
resolveTestPath(snapshotPath: string, snapshotExtension?: string): string;
/** Example test path, used for pr... |
1,669 | constructor(
resolver: Resolver,
hasteFS: IHasteFS,
snapshotResolver: SnapshotResolver,
) {
this._resolver = resolver;
this._hasteFS = hasteFS;
this._snapshotResolver = snapshotResolver;
} | class Resolver {
private readonly _options: ResolverConfig;
private readonly _moduleMap: IModuleMap;
private readonly _moduleIDCache: Map<string, string>;
private readonly _moduleNameCache: Map<string, string>;
private readonly _modulePathCache: Map<string, Array<string>>;
private readonly _supportsNativePl... |
1,670 | constructor(
resolver: Resolver,
hasteFS: IHasteFS,
snapshotResolver: SnapshotResolver,
) {
this._resolver = resolver;
this._hasteFS = hasteFS;
this._snapshotResolver = snapshotResolver;
} | type Resolver = SyncResolver | AsyncResolver; |
1,671 | constructor(
resolver: Resolver,
hasteFS: IHasteFS,
snapshotResolver: SnapshotResolver,
) {
this._resolver = resolver;
this._hasteFS = hasteFS;
this._snapshotResolver = snapshotResolver;
} | interface IHasteFS {
exists(path: string): boolean;
getAbsoluteFileIterator(): Iterable<string>;
getAllFiles(): Array<string>;
getDependencies(file: string): Array<string> | null;
getSize(path: string): number | null;
matchFiles(pattern: RegExp | string): Array<string>;
matchFilesWithGlob(
globs: Read... |
1,672 | register(reporter: Reporter): void {
this._reporters.push(reporter);
} | 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,673 | register(reporter: Reporter): void {
this._reporters.push(reporter);
} | 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,674 | unregister(reporterConstructor: ReporterConstructor): void {
this._reporters = this._reporters.filter(
reporter => !(reporter instanceof reporterConstructor),
);
} | type ReporterConstructor = new (
globalConfig: Config.GlobalConfig,
reporterConfig: Record<string, unknown>,
reporterContext: ReporterContext,
) => JestReporter; |
1,675 | async onTestFileResult(
test: Test,
testResult: TestResult,
results: AggregatedResult,
): Promise<void> {
for (const reporter of this._reporters) {
if (reporter.onTestFileResult) {
await reporter.onTestFileResult(test, testResult, results);
} else if (reporter.onTestResult) {
... | type Test = {
context: TestContext;
duration?: number;
path: string;
}; |
1,676 | async onTestFileResult(
test: Test,
testResult: TestResult,
results: AggregatedResult,
): Promise<void> {
for (const reporter of this._reporters) {
if (reporter.onTestFileResult) {
await reporter.onTestFileResult(test, testResult, results);
} else if (reporter.onTestResult) {
... | type Test = (arg0: any) => boolean; |
1,677 | async onTestFileResult(
test: Test,
testResult: TestResult,
results: AggregatedResult,
): Promise<void> {
for (const reporter of this._reporters) {
if (reporter.onTestFileResult) {
await reporter.onTestFileResult(test, testResult, results);
} else if (reporter.onTestResult) {
... | type AggregatedResult = AggregatedResultWithoutCoverage & {
coverageMap?: CoverageMap | null;
}; |
1,678 | async onTestFileResult(
test: Test,
testResult: TestResult,
results: AggregatedResult,
): Promise<void> {
for (const reporter of this._reporters) {
if (reporter.onTestFileResult) {
await reporter.onTestFileResult(test, testResult, results);
} else if (reporter.onTestResult) {
... | 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,679 | async onTestFileResult(
test: Test,
testResult: TestResult,
results: AggregatedResult,
): Promise<void> {
for (const reporter of this._reporters) {
if (reporter.onTestFileResult) {
await reporter.onTestFileResult(test, testResult, results);
} else if (reporter.onTestResult) {
... | 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,680 | async onTestFileStart(test: Test): Promise<void> {
for (const reporter of this._reporters) {
if (reporter.onTestFileStart) {
await reporter.onTestFileStart(test);
} else if (reporter.onTestStart) {
await reporter.onTestStart(test);
}
}
} | type Test = {
context: TestContext;
duration?: number;
path: string;
}; |
1,681 | async onTestFileStart(test: Test): Promise<void> {
for (const reporter of this._reporters) {
if (reporter.onTestFileStart) {
await reporter.onTestFileStart(test);
} else if (reporter.onTestStart) {
await reporter.onTestStart(test);
}
}
} | type Test = (arg0: any) => boolean; |
1,682 | async onRunStart(
results: AggregatedResult,
options: ReporterOnStartOptions,
): Promise<void> {
for (const reporter of this._reporters) {
reporter.onRunStart && (await reporter.onRunStart(results, options));
}
} | type ReporterOnStartOptions = {
estimatedTime: number;
showStatus: boolean;
}; |
1,683 | async onRunStart(
results: AggregatedResult,
options: ReporterOnStartOptions,
): Promise<void> {
for (const reporter of this._reporters) {
reporter.onRunStart && (await reporter.onRunStart(results, options));
}
} | type AggregatedResult = AggregatedResultWithoutCoverage & {
coverageMap?: CoverageMap | null;
}; |
1,684 | async onTestCaseResult(
test: Test,
testCaseResult: TestCaseResult,
): Promise<void> {
for (const reporter of this._reporters) {
if (reporter.onTestCaseResult) {
await reporter.onTestCaseResult(test, testCaseResult);
}
}
} | type Test = {
context: TestContext;
duration?: number;
path: string;
}; |
1,685 | async onTestCaseResult(
test: Test,
testCaseResult: TestCaseResult,
): Promise<void> {
for (const reporter of this._reporters) {
if (reporter.onTestCaseResult) {
await reporter.onTestCaseResult(test, testCaseResult);
}
}
} | type Test = (arg0: any) => boolean; |
1,686 | async onTestCaseResult(
test: Test,
testCaseResult: TestCaseResult,
): Promise<void> {
for (const reporter of this._reporters) {
if (reporter.onTestCaseResult) {
await reporter.onTestCaseResult(test, testCaseResult);
}
}
} | type TestCaseResult = AssertionResult; |
1,687 | ({
bail,
changedSince,
collectCoverage,
collectCoverageFrom,
coverageDirectory,
coverageReporters,
findRelatedTests,
mode,
nonFlagArgs,
notify,
notifyMode,
onlyFailures,
reporters,
testNamePattern,
testPathPattern,
updateSnapshot,
verbose,
}: Allowed... | type AllowedConfigOptions = Partial<
Pick<
Config.GlobalConfig,
| 'bail'
| 'changedSince'
| 'collectCoverage'
| 'collectCoverageFrom'
| 'coverageDirectory'
| 'coverageReporters'
| 'findRelatedTests'
| 'nonFlagArgs'
| 'notify'
| 'notifyMode'
| 'onlyFailures'
| 'repor... |
1,688 | (plugin: WatchPlugin) => {
const hookSubscriber = hooks.getSubscriber();
if (plugin.apply) {
plugin.apply(hookSubscriber);
}
} | interface WatchPlugin {
isInternal?: boolean;
apply?: (hooks: JestHookSubscriber) => void;
getUsageInfo?: (globalConfig: Config.GlobalConfig) => UsageData | null;
onKey?: (value: string) => void;
run?: (
globalConfig: Config.GlobalConfig,
updateConfigAndRun: UpdateConfigCallback,
) => Promise<void |... |
1,689 | (
watchPluginKeys: WatchPluginKeysMap,
plugin: WatchPlugin,
globalConfig: Config.GlobalConfig,
) => {
const key = getPluginKey(plugin, globalConfig);
if (!key) {
return;
}
const conflictor = watchPluginKeys.get(key);
if (!conflictor || conflictor.overwritable) {
watchPluginKeys.set(key, {
... | interface WatchPlugin {
isInternal?: boolean;
apply?: (hooks: JestHookSubscriber) => void;
getUsageInfo?: (globalConfig: Config.GlobalConfig) => UsageData | null;
onKey?: (value: string) => void;
run?: (
globalConfig: Config.GlobalConfig,
updateConfigAndRun: UpdateConfigCallback,
) => Promise<void |... |
1,690 | (
watchPluginKeys: WatchPluginKeysMap,
plugin: WatchPlugin,
globalConfig: Config.GlobalConfig,
) => {
const key = getPluginKey(plugin, globalConfig);
if (!key) {
return;
}
const conflictor = watchPluginKeys.get(key);
if (!conflictor || conflictor.overwritable) {
watchPluginKeys.set(key, {
... | type WatchPluginKeysMap = Map<string, ReservedInfo>; |
1,691 | (plugin: WatchPlugin) =>
// This breaks as `displayName` is not defined as a static, but since
// WatchPlugin is an interface, and it is my understanding interface
// static fields are not definable anymore, no idea how to circumvent
// this :-(
// @ts-expect-error: leave `displayName` be.
plugin.constructo... | interface WatchPlugin {
isInternal?: boolean;
apply?: (hooks: JestHookSubscriber) => void;
getUsageInfo?: (globalConfig: Config.GlobalConfig) => UsageData | null;
onKey?: (value: string) => void;
run?: (
globalConfig: Config.GlobalConfig,
updateConfigAndRun: UpdateConfigCallback,
) => Promise<void |... |
1,692 | (
plugin: WatchPlugin,
globalConfig: Config.GlobalConfig,
) => {
if (typeof plugin.getUsageInfo === 'function') {
return (plugin.getUsageInfo(globalConfig) || {key: null}).key;
}
return null;
} | interface WatchPlugin {
isInternal?: boolean;
apply?: (hooks: JestHookSubscriber) => void;
getUsageInfo?: (globalConfig: Config.GlobalConfig) => UsageData | null;
onKey?: (value: string) => void;
run?: (
globalConfig: Config.GlobalConfig,
updateConfigAndRun: UpdateConfigCallback,
) => Promise<void |... |
1,693 | (result: AggregatedResult) => void | type AggregatedResult = AggregatedResultWithoutCoverage & {
coverageMap?: CoverageMap | null;
}; |
1,694 | async (
runResults: AggregatedResult,
options: ProcessResultOptions,
) => {
const {
outputFile,
json: isJSON,
onComplete,
outputStream,
testResultsProcessor,
collectHandles,
} = options;
if (collectHandles) {
runResults.openHandles = await collectHandles();
} else {
runResul... | type ProcessResultOptions = Pick<
Config.GlobalConfig,
'json' | 'outputFile' | 'testResultsProcessor'
> & {
collectHandles?: HandleCollectionResult;
onComplete?: (result: AggregatedResult) => void;
outputStream: NodeJS.WriteStream;
}; |
1,695 | async (
runResults: AggregatedResult,
options: ProcessResultOptions,
) => {
const {
outputFile,
json: isJSON,
onComplete,
outputStream,
testResultsProcessor,
collectHandles,
} = options;
if (collectHandles) {
runResults.openHandles = await collectHandles();
} else {
runResul... | type AggregatedResult = AggregatedResultWithoutCoverage & {
coverageMap?: CoverageMap | null;
}; |
1,696 | (testResults: AggregatedResult) => void | type AggregatedResult = AggregatedResultWithoutCoverage & {
coverageMap?: CoverageMap | null;
}; |
1,697 | addReporter(reporter: Reporter): void {
this._dispatcher.register(reporter);
} | 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,698 | addReporter(reporter: Reporter): void {
this._dispatcher.register(reporter);
} | 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,699 | removeReporter(reporterConstructor: ReporterConstructor): void {
this._dispatcher.unregister(reporterConstructor);
} | type ReporterConstructor = new (
globalConfig: Config.GlobalConfig,
reporterConfig: Record<string, unknown>,
reporterContext: ReporterContext,
) => JestReporter; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.