@gentrace/core
Version:
Core Gentrace Node.JS library
54 lines (53 loc) • 3.01 kB
TypeScript
import { TestCase, TestCaseV2, V1TestResultPost200Response } from "../models";
import { ResultContext } from "./context";
import { Pipeline } from "./pipeline";
import { GentracePlugin } from "./plugin";
import { PipelineRunDataTuple } from "./test-result";
import { LocalTestData } from "./utils";
/**
* Retrieves test runners for a given pipeline
* @async
* @param {Pipeline<{ [key: string]: GentracePlugin<any, any> }>} pipeline - The pipeline instance
* @param {string} [datasetId] - Optional dataset ID to filter test cases by.
* @throws {Error} Throws an error if the SDK is not initialized. Call init() first.
* @returns {Promise<Array<PipelineRunDataTuple>>} A Promise that resolves with an array of PipelineRunDataTuple.
*/
export declare const getTestRunners: (pipeline: Pipeline<{
[key: string]: GentracePlugin<any, any>;
}>, datasetId?: string, caseFilter?: (testCase: Omit<TestCase, "createdAt" | "updatedAt" | "archivedAt">) => boolean) => Promise<Array<PipelineRunDataTuple>>;
interface SubmitTestRunnersOptions {
context?: ResultContext;
caseFilter?: (testCase: Omit<TestCase | TestCaseV2, "createdAt" | "updatedAt" | "archivedAt">) => boolean;
triggerRemoteEvals?: boolean;
}
/**
* Submits test runners for a given pipeline
* @async
* @param {Pipeline<{ [key: string]: GentracePlugin<any, any> }>} pipeline - The pipeline instance
* @param {Array<PipelineRunTestCaseTuple>} pipelineRunTestCases - an array of PipelineRunTestCaseTuple
* @param {SubmitTestRunnersOptions} [options] - Optional configuration for submitting test runners
* @returns {Promise<V1TestResultPost200Response>} A Promise that resolves with the response from the Gentrace API
*/
export declare function submitTestRunners(pipeline: Pipeline<{
[key: string]: GentracePlugin<any, any>;
}>, pipelineRunTestCases: Array<PipelineRunDataTuple>, options?: SubmitTestRunnersOptions): Promise<V1TestResultPost200Response>;
/**
* Updates a test result with the provided runners.
*
* @async
* @param {string} resultId - The ID of the test result to update.
* @param {Array<PipelineRunTestCaseTuple>} runners - Additional test runs to add to the existing test result.
* @returns {Promise<any>} A Promise that resolves with the response data from the Gentrace API.
* @throws {Error} Throws an error if the update operation fails.
*/
export declare function updateTestResultWithRunners(resultId: string, runners: PipelineRunDataTuple[]): Promise<V1TestResultPost200Response>;
/**
* Creates test runners for a given pipeline using locally provided test data
* @param {Pipeline<{ [key: string]: GentracePlugin<any, any> }>} pipeline - The pipeline instance
* @param {LocalTestData[]} localData - Array of local test data objects
* @returns {Array<PipelineRunLocalDataTuple>} An array of PipelineRunTestCaseTuple
*/
export declare function createTestRunners(pipeline: Pipeline<{
[key: string]: GentracePlugin<any, any>;
}>, localData: LocalTestData[]): Array<PipelineRunDataTuple>;
export {};