import TestCount from '../test_count'; import { TestPath } from '../test_path'; import { FinishMessage, Message } from './message'; import Reporter, { RegisterOptions } from './reporter'; /** * Serializer is a reporter that takes a stream of tests running potentially * in parallel and converts it to a stream of messages that seem like the tests * are running sequentially. It does this by delaying messages when necessary. * * Tests will be serialized so that if a test in a given suite has started, its * suite will be completely finished until any other non-descendant suite test * is started. This means that if a test starts running and it belongs to a new * suite, it is safe to print that suite name to stdout, and it will not have * to be printed again because the suite will finish before anything else is * reported. * * This is useful for use by reporters that don't support parallelism. */ export default class Serializer implements Reporter> { private _reporter; _currentTest: string | null; _canPickNewTest: boolean; _pendingTestMessages: Map[]>; _remainingTests: TestCount; _finishedTests: Set; constructor(_reporter: Reporter>); private _storeMessageForLater; /** * Emits pending messages for a given test and clears them from the queue. */ private _emitPendingMessagesForTest; private _pendingTestHasFinished; private _currentTestFinished; /** * Given the current test suite, finds out which suite the next test that we choose * must be part of. * * A null return value means that any test can be chosen. */ private _getPremissibleSuiteForNextTest; private _getPermissibleNextTests; private _getNextTest; private _pickNewCurrentTest; registerTests(testPaths: TestPath[], options: RegisterOptions, time: Date): void; registrationFailed(error: Error, time: Date): void; gotMessage(testPath: TestPath, message: Message, time: Date): void; done(time: Date): void; }