@touca/node
Version:
Touca SDK for JavaScript
72 lines • 3.17 kB
TypeScript
import { Transport } from './transport.js';
type TestcaseGenerator = () => Array<string> | Promise<Array<string>>;
type WorkflowCallback = (testcase: string) => void | Promise<void>;
type Workflow = {
suite?: string;
version?: string;
callback?: WorkflowCallback;
testcases?: Array<string> | TestcaseGenerator;
};
type ErrorCode = 'auth_invalid_key' | 'auth_invalid_response' | 'auth_server_down' | 'config_file_missing' | 'config_file_invalid' | 'config_option_invalid' | 'config_option_missing' | 'config_option_fetch' | 'capture_not_configured' | 'capture_forget' | 'capture_type_mismatch' | 'transport_http' | 'transport_post' | 'transport_seal';
export declare class ToucaError extends Error {
private static codes;
constructor(code: ErrorCode, ...args: unknown[]);
}
export type NodeOptions = Partial<{
/**
* API Key issued by the Touca server that identifies who is submitting
* the data. Since the value should be treated as a secret, we recommend
* that you pass it as an environment variable `TOUCA_API_KEY` instead.
*/
api_key: string;
/**
* URL to the Touca server API. Can be provided either in long format
* like `https://api.touca.io/@/myteam/mysuite/version` or in short
* format like `https://api.touca.io`. If the team, suite, or version
* are specified, you do not need to specify them separately.
*/
api_url: string;
/** slug of your team on the Touca server. */
team: string;
/** slug of the suite on the Touca server */
suite: string;
/** version of your workflow under test. */
version: string;
/**
* determines whether client should connect with the Touca server during
* the configuration. Will be set to `false` when neither `api_url` nor
* `api_key` are set.
*/
offline: boolean;
/**
* determines whether the scope of test case declaration is bound to
* the thread performing the declaration, or covers all other threads.
* Defaults to `true`.
*
* If set to `true`, when a thread calls {@link declare_testcase}, all
* other threads also have their most recent test case changed to the
* newly declared test case and any subsequent call to data capturing
* functions such as {@link check} will affect the newly declared
* test case.
*/
concurrency: boolean;
}>;
export type RunnerOptions = NodeOptions & Partial<{
colored_output: boolean;
config_file: string;
output_directory: string;
overwrite_results: boolean;
save_binary: boolean;
save_json: boolean;
submit_async: boolean;
testcases: Array<string>;
workflow_filter: string;
workflows: Array<Workflow>;
webUrl: string;
}>;
export declare function assignOptions(target: Record<string, unknown>, source: Record<string, unknown>): void;
export declare function findHomeDirectory(): string;
export declare function updateCoreOptions(options: NodeOptions, transport?: Transport): Promise<boolean>;
export declare function updateRunnerOptions(options: RunnerOptions, transport?: Transport): Promise<void>;
export {};
//# sourceMappingURL=options.d.ts.map