intern
Version:
Intern. A next-generation code testing stack for JavaScript.
73 lines (72 loc) • 2.96 kB
TypeScript
import { CoverageMap } from 'istanbul-lib-coverage';
import { Instrumenter } from 'istanbul-lib-instrument';
import { MapStore } from 'istanbul-lib-source-maps';
import Task from '@dojo/core/async/Task';
import Command from '@theintern/leadfoot/Command';
import Tunnel, { DownloadProgressEvent } from '@theintern/digdug/Tunnel';
import { Config, EnvironmentSpec } from '../common/config';
import Executor, { Events, Plugins } from './Executor';
import Environment from '../Environment';
import Server from '../Server';
import Suite from '../Suite';
import { RuntimeEnvironment } from '../types';
export default class Node extends Executor<NodeEvents, Config, NodePlugins> {
server: Server | undefined;
tunnel: Tunnel | undefined;
protected _coverageMap: CoverageMap;
protected _coverageFiles: string[] | undefined;
protected _loadingFunctionalSuites: boolean | undefined;
protected _instrumentBasePath: string | undefined;
protected _instrumenter: Instrumenter | undefined;
protected _sourceMaps: MapStore;
protected _instrumentedMaps: MapStore;
protected _unhookRequire: (() => void) | undefined;
protected _sessionSuites: Suite[] | undefined;
constructor(options?: {
[key in keyof Config]?: any;
});
readonly coverageMap: CoverageMap;
readonly environment: RuntimeEnvironment;
readonly instrumentedMapStore: MapStore;
readonly sourceMapStore: MapStore;
readonly hasCoveredFiles: boolean | undefined;
readonly suites: Suite[];
addSuite(factory: (parentSuite: Suite) => void): void;
getTunnel(name: string): typeof Tunnel;
instrumentCode(code: string, filename: string): string;
loadScript(script: string | string[]): Task<void>;
registerTunnel(name: string, Ctor: typeof Tunnel): void;
shouldInstrumentFile(filename: string): boolean;
protected _afterRun(): Task<void>;
protected _beforeRun(): Task<boolean>;
protected _createSessionSuites(): Task<void>;
protected _loadFunctionalSuites(): Task<void>;
protected _loadSuites(): Task<void>;
protected _processOption(key: keyof Config, value: any): void;
protected _resolveConfig(): Task<void>;
protected _runTests(): Task<void>;
protected _runRemoteTests(): Task<void>;
protected _setInstrumentationHooks(): void;
protected _removeInstrumentationHooks(): void;
}
export { Config, EnvironmentSpec };
export interface NodePlugins extends Plugins {
tunnel: typeof Tunnel;
}
export interface Remote extends Command<any> {
environmentType?: Environment;
setHeartbeatInterval(delay: number): Command<any>;
}
export interface TunnelMessage {
tunnel: Tunnel;
progress?: DownloadProgressEvent;
status?: string;
}
export interface NodeEvents extends Events {
serverEnd: Server;
serverStart: Server;
tunnelDownloadProgress: TunnelMessage;
tunnelStart: TunnelMessage;
tunnelStatus: TunnelMessage;
tunnelStop: TunnelMessage;
}