///
import type { ExecaChildProcess } from 'execa';
import type { FSJetpack } from 'fs-jetpack/types';
/**
* Base test context.
*/
export type BaseContext = {
tmpDir: string;
fs: FSJetpack;
mocked: {
cwd: string;
};
/**
* Set up the temporary directory based on the contents of some fixture.
*/
fixture: (name: string) => void;
/**
* Spawn the Prisma cli using the temporary directory as the CWD.
*
* @remarks
*
* For this to work the source must be built
*/
cli: (...input: string[]) => ExecaChildProcess;
printDir(dir: string, extensions: string[]): void;
/**
* JavaScript-friendly implementation of the `tree` command. It skips the `node_modules` directory.
* @param itemPath The path to start the tree from, defaults to the root of the temporary directory
* @param indent How much to indent each level of the tree, defaults to ''
* @returns String representation of the directory tree
*/
tree: (itemPath?: string, indent?: string) => void;
};
/**
* Create test context to use in tests. Provides the following:
*
* - A temporary directory
* - an fs-jetpack instance bound to the temporary directory
* - Mocked process.cwd via Node process.chdir
* - Fixture loader for bootstrapping the temporary directory with content
*/
export declare const jestContext: {
new: (ctx?: BaseContext) => {
add(contextContributor: ContextContributor): {
add(contextContributor: ContextContributor): {
add(contextContributor: ContextContributor): {
add(contextContributor: ContextContributor): {
add(contextContributor: ContextContributor): {
add(contextContributor: ContextContributor): {
add(contextContributor: ContextContributor): {
add(contextContributor: ContextContributor): {
add(contextContributor: ContextContributor): {
add(contextContributor: ContextContributor): {
add(contextContributor: ContextContributor): any;
assemble(): BaseContext & NewContext & NewContext_1 & NewContext_2 & NewContext_3 & NewContext_4 & NewContext_5 & NewContext_6 & NewContext_7 & NewContext_8 & NewContext_9;
};
assemble(): BaseContext & NewContext & NewContext_1 & NewContext_2 & NewContext_3 & NewContext_4 & NewContext_5 & NewContext_6 & NewContext_7 & NewContext_8;
};
assemble(): BaseContext & NewContext & NewContext_1 & NewContext_2 & NewContext_3 & NewContext_4 & NewContext_5 & NewContext_6 & NewContext_7;
};
assemble(): BaseContext & NewContext & NewContext_1 & NewContext_2 & NewContext_3 & NewContext_4 & NewContext_5 & NewContext_6;
};
assemble(): BaseContext & NewContext & NewContext_1 & NewContext_2 & NewContext_3 & NewContext_4 & NewContext_5;
};
assemble(): BaseContext & NewContext & NewContext_1 & NewContext_2 & NewContext_3 & NewContext_4;
};
assemble(): BaseContext & NewContext & NewContext_1 & NewContext_2 & NewContext_3;
};
assemble(): BaseContext & NewContext & NewContext_1 & NewContext_2;
};
assemble(): BaseContext & NewContext & NewContext_1;
};
assemble(): BaseContext & NewContext;
};
assemble(): BaseContext;
};
};
/**
* Factory for creating a context contributor possibly configured in some special way.
*/
type ContextContributorFactory = Settings extends {} ? () => ContextContributor : (settings: Settings) => ContextContributor;
/**
* A function that provides additional test context.
*/
type ContextContributor = (ctx: Context) => Context & NewContext;
/**
* Test context contributor. Mocks console.error with a Jest spy before each test.
*/
type ConsoleContext = {
mocked: {
'console.error': jest.SpyInstance;
'console.log': jest.SpyInstance;
'console.info': jest.SpyInstance;
'console.warn': jest.SpyInstance;
};
};
export declare const jestConsoleContext: ContextContributorFactory<{}, BaseContext, ConsoleContext>;
/**
* Test context contributor. Mocks process.std(out|err).write with a Jest spy before each test.
*/
type ProcessContext = {
mocked: {
'process.stderr.write': jest.SpyInstance;
'process.stdout.write': jest.SpyInstance;
};
};
export declare const jestProcessContext: ContextContributorFactory<{}, BaseContext, ProcessContext>;
export {};