@teambit/jest
Version:
47 lines (46 loc) • 1.76 kB
TypeScript
import type { Logger } from '@teambit/logger';
import type { HarmonyWorker } from '@teambit/worker';
import type { Tester, CallbackFn, TesterContext } from '@teambit/tester';
import { Tests } from '@teambit/tester';
import type { Component } from '@teambit/component';
import type { JestWorker } from './jest.worker';
export type JestTesterOptions = {
/**
* array of patterns to test. (override the patterns provided by the context)
*/
patterns?: string[];
/**
* add more root paths to look for tests.
*/
roots?: string[];
/**
* A function that knows to resolve the paths of the spec files.
* This usually used when you want only subset of your spec files to be used
* (usually when you use multi tester with different specs files for each tester instance).
*/
resolveSpecPaths?: (component: Component, context: TesterContext) => string[];
};
export declare class JestTester implements Tester {
readonly id: string;
readonly jestConfig: any;
private jestModulePath;
private jestWorker;
private logger;
private opts;
private readonly jestModule;
constructor(id: string, jestConfig: any, jestModulePath: string, jestWorker: HarmonyWorker<JestWorker>, logger: Logger, opts?: JestTesterOptions);
configPath: any;
displayName: string;
_callback: CallbackFn | undefined;
displayConfig(): string;
version(): any;
private attachTestsToComponent;
private buildTestsObj;
private getErrors;
onTestRunComplete(callback: CallbackFn): Promise<void>;
test(context: TesterContext): Promise<Tests>;
watch(context: TesterContext): Promise<Tests>;
private patternsToArray;
private resolveComponentPattern;
private resolvePattern;
}