MCPcopy
hub / github.com/promptfoo/promptfoo / getFinalTest

Function getFinalTest

src/assertions/utils.ts:12–37  ·  view source on GitHub ↗
(test: TestCase, assertion: Assertion)

Source from the content-addressed store, hash-verified

10const clone = Clone();
11
12export function getFinalTest(test: TestCase, assertion: Assertion) {
13 // Deep copy
14 const ret = clone({
15 ...test,
16 ...(test.options &&
17 test.options.provider && {
18 options: {
19 ...test.options,
20 provider: undefined,
21 },
22 }),
23 ...(test.provider && {
24 provider: undefined,
25 }),
26 });
27
28 // Assertion provider overrides test provider
29 ret.options = ret.options || {};
30 // NOTE: Clone does not copy functions so we set the provider again
31 if (test.provider) {
32 ret.provider = test.provider;
33 }
34 ret.options.provider = assertion.provider || test?.options?.provider;
35 ret.options.rubricPrompt = assertion.rubricPrompt || ret.options.rubricPrompt;
36 return Object.freeze(ret);
37}
38
39export async function loadFromJavaScriptFile(
40 filePath: string,

Callers 3

utils.test.tsFile · 0.90
runAssertionFunction · 0.90
runCompareAssertionFunction · 0.90

Calls 1

cloneFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…