id
int64
0
3.78k
code
stringlengths
13
37.9k
declarations
stringlengths
16
64.6k
1,500
(context: Spec) => void
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,501
(spec: Spec) => string
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,502
(spec: Spec) => string
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,503
(spec: 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); }; ...
1,504
(spec: Spec) => void
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,505
constructor(attrs: Attributes) { this.resultCallback = attrs.resultCallback || function () {}; this.id = attrs.id; this.description = convertDescriptorToString(attrs.description); this.queueableFn = attrs.queueableFn; this.beforeAndAfterFns = attrs.beforeAndAfterFns || function () { ...
type Attributes = { id: string; parentSuite?: Suite; description: Circus.TestNameLike; throwOnExpectationFailure?: boolean; getTestPath: () => string; };
1,506
constructor(attrs: Attributes) { this.resultCallback = attrs.resultCallback || function () {}; this.id = attrs.id; this.description = convertDescriptorToString(attrs.description); this.queueableFn = attrs.queueableFn; this.beforeAndAfterFns = attrs.beforeAndAfterFns || function () { ...
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,507
function validateAfterAllExceptions({failedExpectations}: RunDetails) { if (failedExpectations && failedExpectations.length > 0) { throw failedExpectations[0]; } }
type RunDetails = { totalSpecsDefined?: number; failedExpectations?: SuiteResult['failedExpectations']; };
1,508
function (result: SuiteResult) { suites_hash[result.id] = result; }
type SuiteResult = { id: string; description: string; fullName: string; failedExpectations: Array<ReturnType<typeof expectationResultFactory>>; testPath: string; status?: string; };
1,509
function (result: SuiteResult) { storeSuite(result); }
type SuiteResult = { id: string; description: string; fullName: string; failedExpectations: Array<ReturnType<typeof expectationResultFactory>>; testPath: string; status?: string; };
1,510
function storeSuite(result: SuiteResult) { suites.push(result); suites_hash[result.id] = result; }
type SuiteResult = { id: string; description: string; fullName: string; failedExpectations: Array<ReturnType<typeof expectationResultFactory>>; testPath: string; status?: string; };
1,511
function assertionErrorMessage( error: AssertionErrorWithStack, options: DiffOptions, ) { const {expected, actual, generatedMessage, message, operator, stack} = error; const diffString = diff(expected, actual, options); const hasCustomMessage = !generatedMessage; const operatorName = getOperatorName(operato...
type DiffOptions = { aAnnotation?: string; aColor?: DiffOptionsColor; aIndicator?: string; bAnnotation?: string; bColor?: DiffOptionsColor; bIndicator?: string; changeColor?: DiffOptionsColor; changeLineTrailingSpaceColor?: DiffOptionsColor; commonColor?: DiffOptionsColor; commonIndicator?: string; ...
1,512
function assertionErrorMessage( error: AssertionErrorWithStack, options: DiffOptions, ) { const {expected, actual, generatedMessage, message, operator, stack} = error; const diffString = diff(expected, actual, options); const hasCustomMessage = !generatedMessage; const operatorName = getOperatorName(operato...
type DiffOptions = ImportDiffOptions;
1,513
function assertionErrorMessage( error: AssertionErrorWithStack, options: DiffOptions, ) { const {expected, actual, generatedMessage, message, operator, stack} = error; const diffString = diff(expected, actual, options); const hasCustomMessage = !generatedMessage; const operatorName = getOperatorName(operato...
interface AssertionErrorWithStack extends AssertionError { stack: string; }
1,514
function assertionErrorMessage( error: AssertionErrorWithStack, options: DiffOptions, ) { const {expected, actual, generatedMessage, message, operator, stack} = error; const diffString = diff(expected, actual, options); const hasCustomMessage = !generatedMessage; const operatorName = getOperatorName(operato...
interface AssertionErrorWithStack extends AssertionError { stack: string; }
1,515
(globals: RuntimeGlobals) => void
interface RuntimeGlobals extends Global.TestFrameworkGlobals { expect: JestExpect; }
1,516
(snapshotState: SnapshotState) => (event: Circus.Event) => { switch (event.name) { case 'test_retry': { // Clear any snapshot data that occurred in previous test run snapshotState.clear(); } } }
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,517
( results: TestResult, snapshotState: SnapshotState, ) => { results.testResults.forEach(({fullName, status}) => { if (status === 'pending' || status === 'failed') { // if test is skipped or failed, we don't want to mark // its snapshots as obsolete. snapshotState.markSnapshotsAsCheckedForTes...
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,518
( results: TestResult, snapshotState: SnapshotState, ) => { results.testResults.forEach(({fullName, status}) => { if (status === 'pending' || status === 'failed') { // if test is skipped or failed, we don't want to mark // its snapshots as obsolete. snapshotState.markSnapshotsAsCheckedForTes...
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,519
( results: TestResult, snapshotState: SnapshotState, ) => { results.testResults.forEach(({fullName, status}) => { if (status === 'pending' || status === 'failed') { // if test is skipped or failed, we don't want to mark // its snapshots as obsolete. snapshotState.markSnapshotsAsCheckedForTes...
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,520
(fs: JestHookExposedFS) => void
type JestHookExposedFS = { projects: Array<{ config: Config.ProjectConfig; testPaths: Array<string>; }>; };
1,521
( testSuiteInfo: TestSuiteInfo, ) => Promise<boolean>
type TestSuiteInfo = { config: Config.ProjectConfig; duration?: number; testPath: string; };
1,522
(results: AggregatedResult) => void
type AggregatedResult = AggregatedResultWithoutCoverage & { coverageMap?: CoverageMap | null; };
1,523
(fn: FileChange) => void
type FileChange = (fs: JestHookExposedFS) => void;
1,524
(fn: TestRunComplete) => void
type TestRunComplete = (results: AggregatedResult) => void;
1,525
(fn: ShouldRunTestSuite) => void
type ShouldRunTestSuite = ( testSuiteInfo: TestSuiteInfo, ) => Promise<boolean>;
1,526
( testSuiteInfo: TestSuiteInfo, ) => Promise<boolean> | boolean
type TestSuiteInfo = { config: Config.ProjectConfig; duration?: number; testPath: string; };
1,527
(config?: AllowedConfigOptions) => void
type AllowedConfigOptions = Partial< Pick< Config.GlobalConfig, | 'bail' | 'changedSince' | 'collectCoverage' | 'collectCoverageFrom' | 'coverageDirectory' | 'coverageReporters' | 'findRelatedTests' | 'nonFlagArgs' | 'notify' | 'notifyMode' | 'onlyFailures' | 'repor...
1,528
(hooks: JestHookSubscriber) => void
type JestHookSubscriber = { onFileChange: (fn: FileChange) => void; onTestRunComplete: (fn: TestRunComplete) => void; shouldRunTestSuite: (fn: ShouldRunTestSuite) => void; };
1,529
isUsed(hook: AvailableHooks): boolean { return this._listeners[hook]?.length > 0; }
type AvailableHooks = | 'onFileChange' | 'onTestRunComplete' | 'shouldRunTestSuite';
1,530
apply(_hooks: JestHookSubscriber): void {}
type JestHookSubscriber = { onFileChange: (fn: FileChange) => void; onTestRunComplete: (fn: TestRunComplete) => void; shouldRunTestSuite: (fn: ShouldRunTestSuite) => void; };
1,531
async setState(state: State): Promise<void> { Object.assign(this.state, state); await this.emit('change', this.state); }
type State = Circus.State;
1,532
async setState(state: State): Promise<void> { Object.assign(this.state, state); await this.emit('change', this.state); }
type State = { interrupted: boolean; };
1,533
async setState(state: State): Promise<void> { Object.assign(this.state, state); await this.emit('change', this.state); }
type State = { currentDescribeBlock: DescribeBlock; currentlyRunningTest?: TestEntry | null; // including when hooks are being executed expand?: boolean; // expand error messages hasFocusedTests: boolean; // that are defined using test.only hasStarted: boolean; // whether the rootDescribeBlock has started run...
1,534
private _ensureMockConfig(f: Mock): MockFunctionConfig { let config = this._mockConfigRegistry.get(f); if (!config) { config = this._defaultMockConfig(); this._mockConfigRegistry.set(f, config); } return config; }
interface Mock<T extends FunctionLike = UnknownFunction> extends Function, MockInstance<T> { new (...args: Parameters<T>): ReturnType<T>; (...args: Parameters<T>): ReturnType<T>; }
1,535
private _ensureMockConfig(f: Mock): MockFunctionConfig { let config = this._mockConfigRegistry.get(f); if (!config) { config = this._defaultMockConfig(); this._mockConfigRegistry.set(f, config); } return config; }
type Mock<T extends FunctionLike = UnknownFunction> = JestMock<T>;
1,536
private _ensureMockConfig(f: Mock): MockFunctionConfig { let config = this._mockConfigRegistry.get(f); if (!config) { config = this._defaultMockConfig(); this._mockConfigRegistry.set(f, config); } return config; }
type Mock<T extends FunctionLike = UnknownFunction> = JestMock<T>;
1,537
function withImplementation( this: ModuleMocker, fn: T, callback: (() => void) | (() => Promise<unknown>), ): void | Promise<void> { // Remember previous mock implementation, then set new one const mockConfig = this._ensureMockConfig(f); const previousImplementation...
class ModuleMocker { private readonly _environmentGlobal: typeof globalThis; private _mockState: WeakMap<Mock, MockFunctionState>; private _mockConfigRegistry: WeakMap<Function, MockFunctionConfig>; private _spyState: Set<() => void>; private _invocationCallCounter: number; private _originalFn: WeakMap<Mock...
1,538
spyOn< T extends object, K extends PropertyLikeKeys<T>, V extends Required<T>[K], A extends 'get' | 'set', >( object: T, methodKey: K, accessType: A, ): A extends 'get' ? SpiedGetter<V> : A extends 'set' ? SpiedSetter<V> : never
type A = string;
1,539
spyOn< T extends object, K extends PropertyLikeKeys<T>, V extends Required<T>[K], A extends 'get' | 'set', >( object: T, methodKey: K, accessType: A, ): A extends 'get' ? SpiedGetter<V> : A extends 'set' ? SpiedSetter<V> : never
type A = string;
1,540
spyOn< T extends object, K extends PropertyLikeKeys<T>, V extends Required<T>[K], A extends 'get' | 'set', >( object: T, methodKey: K, accessType: A, ): A extends 'get' ? SpiedGetter<V> : A extends 'set' ? SpiedSetter<V> : never
class A { get a() { return 'a'; } get b() { return {c: 'c'}; } }
1,541
( this: TesterContext, a: any, b: any, customTesters: Array<Tester>, ) => boolean | undefined
interface TesterContext { equals: EqualsFunction; }
1,542
constructor(config: JestEnvironmentConfig, context: EnvironmentContext)
type EnvironmentContext = { console: Console; docblockPragmas: Record<string, string | Array<string>>; testPath: string; };
1,543
constructor(config: JestEnvironmentConfig, context: EnvironmentContext)
interface JestEnvironmentConfig { projectConfig: Config.ProjectConfig; globalConfig: Config.GlobalConfig; }
1,544
( g: Global, table: Global.EachTable, ...data: Global.TemplateData ) => { const bindingWithArray = data.length === 0; const bindingWithTemplate = Array.isArray(table) && !!(table as any).raw; if (!bindingWithArray && !bindingWithTemplate) { throw new Error( '`.each` must only be called with an Arr...
interface Global { expect: JestExpect; jasmine: Jasmine; }
1,545
( g: Global, table: Global.EachTable, ...data: Global.TemplateData ) => { const bindingWithArray = data.length === 0; const bindingWithTemplate = Array.isArray(table) && !!(table as any).raw; if (!bindingWithArray && !bindingWithTemplate) { throw new Error( '`.each` must only be called with an Arr...
interface Global { [testTimeoutSymbol]: number; }
1,546
( g: Global, table: Global.EachTable, ...data: Global.TemplateData ) => { const bindingWithArray = data.length === 0; const bindingWithTemplate = Array.isArray(table) && !!(table as any).raw; if (!bindingWithArray && !bindingWithTemplate) { throw new Error( '`.each` must only be called with an Arr...
interface Global { [STATE_SYM]: Circus.State; [RETRY_TIMES]: string; [TEST_TIMEOUT_SYMBOL]: number; [LOG_ERRORS_BEFORE_RETRY]: boolean; }
1,547
( g: Global, table: Global.EachTable, ...data: Global.TemplateData ) => { const bindingWithArray = data.length === 0; const bindingWithTemplate = Array.isArray(table) && !!(table as any).raw; if (!bindingWithArray && !bindingWithTemplate) { throw new Error( '`.each` must only be called with an Arr...
type Global = Global.Global;
1,548
( g: Global, table: Global.EachTable, ...data: Global.TemplateData ) => { const bindingWithArray = data.length === 0; const bindingWithTemplate = Array.isArray(table) && !!(table as any).raw; if (!bindingWithArray && !bindingWithTemplate) { throw new Error( '`.each` must only be called with an Arr...
interface Global extends GlobalAdditions, Omit<typeof globalThis, keyof GlobalAdditions> { [extras: PropertyKey]: unknown; }
1,549
(g: Global) => (table: Global.EachTable, ...data: Global.TemplateData) => install(g, table, ...data)
interface Global { expect: JestExpect; jasmine: Jasmine; }
1,550
(g: Global) => (table: Global.EachTable, ...data: Global.TemplateData) => install(g, table, ...data)
interface Global { [testTimeoutSymbol]: number; }
1,551
(g: Global) => (table: Global.EachTable, ...data: Global.TemplateData) => install(g, table, ...data)
interface Global { [STATE_SYM]: Circus.State; [RETRY_TIMES]: string; [TEST_TIMEOUT_SYMBOL]: number; [LOG_ERRORS_BEFORE_RETRY]: boolean; }
1,552
(g: Global) => (table: Global.EachTable, ...data: Global.TemplateData) => install(g, table, ...data)
type Global = Global.Global;
1,553
(g: Global) => (table: Global.EachTable, ...data: Global.TemplateData) => install(g, table, ...data)
interface Global extends GlobalAdditions, Omit<typeof globalThis, keyof GlobalAdditions> { [extras: PropertyKey]: unknown; }
1,554
function bind<EachCallback extends Global.TestCallback>( cb: GlobalCallback, supportsDone = true, needsEachError = false, ): Global.EachTestFn<any> { const bindWrap = ( table: Global.EachTable, ...taggedTemplateData: Global.TemplateData ) => { const error = new ErrorWithStack(undefined, bindWrap);...
type GlobalCallback = ( testName: string, fn: Global.ConcurrentTestFn, timeout?: number, eachError?: Error, ) => void;
1,555
(matches: Headings, key: string) => matches.concat(title.match(new RegExp(`\\$${key}[\\.\\w]*`, 'g')) || [])
type Headings = Array<string>;
1,556
(template: Template) => (title: string, match: string) => { const keyPath = match.replace('$', '').split('.'); const value = getPath(template, keyPath); if (isPrimitive(value)) { return title.replace(match, String(value)); } return title.replace(match, pretty(value, {maxDepth: 1, min: true}))...
type Template = Record<string, unknown>;
1,557
function getPath( template: Template, [head, ...tail]: Array<string>, ): unknown { if (!head || !Object.prototype.hasOwnProperty.call(template, head)) return template; return getPath(template[head] as Template, tail); }
type Template = Record<string, unknown>;
1,558
( results: AggregatedResult, ) => AggregatedResult
type AggregatedResult = AggregatedResultWithoutCoverage & { coverageMap?: CoverageMap | null; };
1,559
( aggregatedResults: AggregatedResult, testResult: TestResult, ): void => { // `todos` are new as of Jest 24, and not all runners return it. // Set it to `0` to avoid `NaN` if (!testResult.numTodoTests) { testResult.numTodoTests = 0; } aggregatedResults.testResults.push(testResult); aggregatedResul...
type AggregatedResult = AggregatedResultWithoutCoverage & { coverageMap?: CoverageMap | null; };
1,560
( aggregatedResults: AggregatedResult, testResult: TestResult, ): void => { // `todos` are new as of Jest 24, and not all runners return it. // Set it to `0` to avoid `NaN` if (!testResult.numTodoTests) { testResult.numTodoTests = 0; } aggregatedResults.testResults.push(testResult); aggregatedResul...
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,561
( aggregatedResults: AggregatedResult, testResult: TestResult, ): void => { // `todos` are new as of Jest 24, and not all runners return it. // Set it to `0` to avoid `NaN` if (!testResult.numTodoTests) { testResult.numTodoTests = 0; } aggregatedResults.testResults.push(testResult); aggregatedResul...
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,562
( testResult: TestResult, codeCoverageFormatter?: CodeCoverageFormatter, reporter?: CodeCoverageReporter, ): FormattedTestResult => { if (testResult.testExecError) { const now = Date.now(); return { assertionResults: testResult.testResults, coverage: {}, endTime: now, message: te...
type CodeCoverageReporter = unknown;
1,563
( testResult: TestResult, codeCoverageFormatter?: CodeCoverageFormatter, reporter?: CodeCoverageReporter, ): FormattedTestResult => { if (testResult.testExecError) { const now = Date.now(); return { assertionResults: testResult.testResults, coverage: {}, endTime: now, message: te...
type CodeCoverageFormatter = ( coverage: CoverageMapData | null | undefined, reporter: CodeCoverageReporter, ) => Record<string, unknown> | null | undefined;
1,564
( testResult: TestResult, codeCoverageFormatter?: CodeCoverageFormatter, reporter?: CodeCoverageReporter, ): FormattedTestResult => { if (testResult.testExecError) { const now = Date.now(); return { assertionResults: testResult.testResults, coverage: {}, endTime: now, message: te...
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,565
( testResult: TestResult, codeCoverageFormatter?: CodeCoverageFormatter, reporter?: CodeCoverageReporter, ): FormattedTestResult => { if (testResult.testExecError) { const now = Date.now(); return { assertionResults: testResult.testResults, coverage: {}, endTime: now, message: te...
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,566
function formatTestResults( results: AggregatedResult, codeCoverageFormatter?: CodeCoverageFormatter, reporter?: CodeCoverageReporter, ): FormattedTestResults { const testResults = results.testResults.map(testResult => formatTestResult(testResult, codeCoverageFormatter, reporter), ); return {...results...
type CodeCoverageReporter = unknown;
1,567
function formatTestResults( results: AggregatedResult, codeCoverageFormatter?: CodeCoverageFormatter, reporter?: CodeCoverageReporter, ): FormattedTestResults { const testResults = results.testResults.map(testResult => formatTestResult(testResult, codeCoverageFormatter, reporter), ); return {...results...
type AggregatedResult = AggregatedResultWithoutCoverage & { coverageMap?: CoverageMap | null; };
1,568
function formatTestResults( results: AggregatedResult, codeCoverageFormatter?: CodeCoverageFormatter, reporter?: CodeCoverageReporter, ): FormattedTestResults { const testResults = results.testResults.map(testResult => formatTestResult(testResult, codeCoverageFormatter, reporter), ); return {...results...
type CodeCoverageFormatter = ( coverage: CoverageMapData | null | undefined, reporter: CodeCoverageReporter, ) => Record<string, unknown> | null | undefined;
1,569
(event: ChangeEvent) => void
type ChangeEvent = { eventsQueue: EventsQueue; hasteFS: HasteFS; moduleMap: ModuleMap; };
1,570
static async create(options: Options): Promise<IHasteMap> { if (options.hasteMapModulePath) { const CustomHasteMap = require(options.hasteMapModulePath); return new CustomHasteMap(options); } const hasteMap = new HasteMap(options); await hasteMap.setupCachePath(options); return hasteMa...
interface Options extends ShouldInstrumentOptions, CallerTransformOptions { isInternalModule?: boolean; }
1,571
static async create(options: Options): Promise<IHasteMap> { if (options.hasteMapModulePath) { const CustomHasteMap = require(options.hasteMapModulePath); return new CustomHasteMap(options); } const hasteMap = new HasteMap(options); await hasteMap.setupCachePath(options); return hasteMa...
type Options = { clearTimeout: (typeof globalThis)['clearTimeout']; fail: (error: Error) => void; onException: (error: Error) => void; queueableFns: Array<QueueableFn>; setTimeout: (typeof globalThis)['setTimeout']; userContext: unknown; };
1,572
static async create(options: Options): Promise<IHasteMap> { if (options.hasteMapModulePath) { const CustomHasteMap = require(options.hasteMapModulePath); return new CustomHasteMap(options); } const hasteMap = new HasteMap(options); await hasteMap.setupCachePath(options); return hasteMa...
type Options = { matcherName: string; passed: boolean; actual?: any; error?: any; expected?: any; message?: string | null; };
1,573
static async create(options: Options): Promise<IHasteMap> { if (options.hasteMapModulePath) { const CustomHasteMap = require(options.hasteMapModulePath); return new CustomHasteMap(options); } const hasteMap = new HasteMap(options); await hasteMap.setupCachePath(options); return hasteMa...
type Options = { nodeComplete: (suite: TreeNode) => void; nodeStart: (suite: TreeNode) => void; queueRunnerFactory: any; runnableIds: Array<string>; tree: TreeNode; };
1,574
static async create(options: Options): Promise<IHasteMap> { if (options.hasteMapModulePath) { const CustomHasteMap = require(options.hasteMapModulePath); return new CustomHasteMap(options); } const hasteMap = new HasteMap(options); await hasteMap.setupCachePath(options); return hasteMa...
type Options = { lastCommit?: boolean; withAncestor?: boolean; changedSince?: string; includePaths?: Array<string>; };
1,575
static async create(options: Options): Promise<IHasteMap> { if (options.hasteMapModulePath) { const CustomHasteMap = require(options.hasteMapModulePath); return new CustomHasteMap(options); } const hasteMap = new HasteMap(options); await hasteMap.setupCachePath(options); return hasteMa...
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,576
static async create(options: Options): Promise<IHasteMap> { if (options.hasteMapModulePath) { const CustomHasteMap = require(options.hasteMapModulePath); return new CustomHasteMap(options); } const hasteMap = new HasteMap(options); await hasteMap.setupCachePath(options); return hasteMa...
interface Options extends Omit<RequiredOptions, 'compareKeys' | 'theme'> { compareKeys: CompareKeys; theme: Required<RequiredOptions['theme']>; }
1,577
private constructor(options: Options) { super(); this._options = { cacheDirectory: options.cacheDirectory || tmpdir(), computeDependencies: options.computeDependencies ?? true, computeSha1: options.computeSha1 || false, dependencyExtractor: options.dependencyExtractor || null, enab...
interface Options extends ShouldInstrumentOptions, CallerTransformOptions { isInternalModule?: boolean; }
1,578
private constructor(options: Options) { super(); this._options = { cacheDirectory: options.cacheDirectory || tmpdir(), computeDependencies: options.computeDependencies ?? true, computeSha1: options.computeSha1 || false, dependencyExtractor: options.dependencyExtractor || null, enab...
type Options = { clearTimeout: (typeof globalThis)['clearTimeout']; fail: (error: Error) => void; onException: (error: Error) => void; queueableFns: Array<QueueableFn>; setTimeout: (typeof globalThis)['setTimeout']; userContext: unknown; };
1,579
private constructor(options: Options) { super(); this._options = { cacheDirectory: options.cacheDirectory || tmpdir(), computeDependencies: options.computeDependencies ?? true, computeSha1: options.computeSha1 || false, dependencyExtractor: options.dependencyExtractor || null, enab...
type Options = { matcherName: string; passed: boolean; actual?: any; error?: any; expected?: any; message?: string | null; };
1,580
private constructor(options: Options) { super(); this._options = { cacheDirectory: options.cacheDirectory || tmpdir(), computeDependencies: options.computeDependencies ?? true, computeSha1: options.computeSha1 || false, dependencyExtractor: options.dependencyExtractor || null, enab...
type Options = { nodeComplete: (suite: TreeNode) => void; nodeStart: (suite: TreeNode) => void; queueRunnerFactory: any; runnableIds: Array<string>; tree: TreeNode; };
1,581
private constructor(options: Options) { super(); this._options = { cacheDirectory: options.cacheDirectory || tmpdir(), computeDependencies: options.computeDependencies ?? true, computeSha1: options.computeSha1 || false, dependencyExtractor: options.dependencyExtractor || null, enab...
type Options = { lastCommit?: boolean; withAncestor?: boolean; changedSince?: string; includePaths?: Array<string>; };
1,582
private constructor(options: Options) { super(); this._options = { cacheDirectory: options.cacheDirectory || tmpdir(), computeDependencies: options.computeDependencies ?? true, computeSha1: options.computeSha1 || false, dependencyExtractor: options.dependencyExtractor || null, enab...
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,583
private constructor(options: Options) { super(); this._options = { cacheDirectory: options.cacheDirectory || tmpdir(), computeDependencies: options.computeDependencies ?? true, computeSha1: options.computeSha1 || false, dependencyExtractor: options.dependencyExtractor || null, enab...
interface Options extends Omit<RequiredOptions, 'compareKeys' | 'theme'> { compareKeys: CompareKeys; theme: Required<RequiredOptions['theme']>; }
1,584
private async setupCachePath(options: Options): Promise<void> { const rootDirHash = createHash('sha1') .update(options.rootDir) .digest('hex') .substring(0, 32); let hasteImplHash = ''; let dependencyExtractorHash = ''; if (options.hasteImplModulePath) { const hasteImpl = requir...
interface Options extends ShouldInstrumentOptions, CallerTransformOptions { isInternalModule?: boolean; }
1,585
private async setupCachePath(options: Options): Promise<void> { const rootDirHash = createHash('sha1') .update(options.rootDir) .digest('hex') .substring(0, 32); let hasteImplHash = ''; let dependencyExtractorHash = ''; if (options.hasteImplModulePath) { const hasteImpl = requir...
type Options = { clearTimeout: (typeof globalThis)['clearTimeout']; fail: (error: Error) => void; onException: (error: Error) => void; queueableFns: Array<QueueableFn>; setTimeout: (typeof globalThis)['setTimeout']; userContext: unknown; };
1,586
private async setupCachePath(options: Options): Promise<void> { const rootDirHash = createHash('sha1') .update(options.rootDir) .digest('hex') .substring(0, 32); let hasteImplHash = ''; let dependencyExtractorHash = ''; if (options.hasteImplModulePath) { const hasteImpl = requir...
type Options = { matcherName: string; passed: boolean; actual?: any; error?: any; expected?: any; message?: string | null; };
1,587
private async setupCachePath(options: Options): Promise<void> { const rootDirHash = createHash('sha1') .update(options.rootDir) .digest('hex') .substring(0, 32); let hasteImplHash = ''; let dependencyExtractorHash = ''; if (options.hasteImplModulePath) { const hasteImpl = requir...
type Options = { nodeComplete: (suite: TreeNode) => void; nodeStart: (suite: TreeNode) => void; queueRunnerFactory: any; runnableIds: Array<string>; tree: TreeNode; };
1,588
private async setupCachePath(options: Options): Promise<void> { const rootDirHash = createHash('sha1') .update(options.rootDir) .digest('hex') .substring(0, 32); let hasteImplHash = ''; let dependencyExtractorHash = ''; if (options.hasteImplModulePath) { const hasteImpl = requir...
type Options = { lastCommit?: boolean; withAncestor?: boolean; changedSince?: string; includePaths?: Array<string>; };
1,589
private async setupCachePath(options: Options): Promise<void> { const rootDirHash = createHash('sha1') .update(options.rootDir) .digest('hex') .substring(0, 32); let hasteImplHash = ''; let dependencyExtractorHash = ''; if (options.hasteImplModulePath) { const hasteImpl = requir...
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,590
private async setupCachePath(options: Options): Promise<void> { const rootDirHash = createHash('sha1') .update(options.rootDir) .digest('hex') .substring(0, 32); let hasteImplHash = ''; let dependencyExtractorHash = ''; if (options.hasteImplModulePath) { const hasteImpl = requir...
interface Options extends Omit<RequiredOptions, 'compareKeys' | 'theme'> { compareKeys: CompareKeys; theme: Required<RequiredOptions['theme']>; }
1,591
static getModuleMapFromJSON(json: SerializableModuleMap): HasteModuleMap { return HasteModuleMap.fromJSON(json); }
type SerializableModuleMap = { duplicates: ReadonlyArray<[string, [string, [string, [string, number]]]]>; map: ReadonlyArray<[string, ValueType<ModuleMapData>]>; mocks: ReadonlyArray<[string, ValueType<MockData>]>; rootDir: string; };
1,592
private _processFile( hasteMap: InternalHasteMap, map: ModuleMapData, mocks: MockData, filePath: string, workerOptions?: {forceInBand: boolean}, ): Promise<void> | null { const rootDir = this._options.rootDir; const setModule = (id: string, module: ModuleMetaData) => { let moduleMap...
type MockData = Map<string, string>;
1,593
private _processFile( hasteMap: InternalHasteMap, map: ModuleMapData, mocks: MockData, filePath: string, workerOptions?: {forceInBand: boolean}, ): Promise<void> | null { const rootDir = this._options.rootDir; const setModule = (id: string, module: ModuleMetaData) => { let moduleMap...
type ModuleMapData = Map<string, ModuleMapItem>;
1,594
private _processFile( hasteMap: InternalHasteMap, map: ModuleMapData, mocks: MockData, filePath: string, workerOptions?: {forceInBand: boolean}, ): Promise<void> | null { const rootDir = this._options.rootDir; const setModule = (id: string, module: ModuleMetaData) => { let moduleMap...
type InternalHasteMap = { clocks: WatchmanClocks; duplicates: DuplicatesIndex; files: FileData; map: ModuleMapData; mocks: MockData; };
1,595
(metadata: WorkerMetadata) => { // `1` for truthy values instead of `true` to save cache space. fileMetadata[H.VISITED] = 1; const metadataId = metadata.id; const metadataModule = metadata.module; if (metadataId && metadataModule) { fileMetadata[H.ID] = metadataId; setMod...
type WorkerMetadata = { dependencies: Array<string> | undefined | null; id: string | undefined | null; module: ModuleMetaData | undefined | null; sha1: string | undefined | null; };
1,596
private _persist(hasteMap: InternalHasteMap) { writeFileSync(this._cachePath, serialize(hasteMap)); }
type InternalHasteMap = { clocks: WatchmanClocks; duplicates: DuplicatesIndex; files: FileData; map: ModuleMapData; mocks: MockData; };
1,597
private async _crawl(hasteMap: InternalHasteMap) { const options = this._options; const ignore = this._ignore.bind(this); const crawl = (await this._shouldUseWatchman()) ? watchmanCrawl : nodeCrawl; const crawlerOptions: CrawlerOptions = { computeSha1: options.computeSha1, data: hasteMap, ...
type InternalHasteMap = { clocks: WatchmanClocks; duplicates: DuplicatesIndex; files: FileData; map: ModuleMapData; mocks: MockData; };
1,598
private async _watch(hasteMap: InternalHasteMap): Promise<void> { if (!this._options.watch) { return Promise.resolve(); } // In watch mode, we'll only warn about module collisions and we'll retain // all files, even changes to node_modules. this._options.throwOnModuleCollision = false; th...
type InternalHasteMap = { clocks: WatchmanClocks; duplicates: DuplicatesIndex; files: FileData; map: ModuleMapData; mocks: MockData; };
1,599
private _recoverDuplicates( hasteMap: InternalHasteMap, relativeFilePath: string, moduleName: string, ) { let dupsByPlatform = hasteMap.duplicates.get(moduleName); if (dupsByPlatform == null) { return; } const platform = getPlatformExtension(relativeFilePath, this._options.pla...
type InternalHasteMap = { clocks: WatchmanClocks; duplicates: DuplicatesIndex; files: FileData; map: ModuleMapData; mocks: MockData; };