(test: TestCase, assertion: Assertion)
| 10 | const clone = Clone(); |
| 11 | |
| 12 | export 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 | |
| 39 | export async function loadFromJavaScriptFile( |
| 40 | filePath: string, |
no test coverage detected
searching dependent graphs…