Files
vscode/extensions/copilot/test/base/rubric.ts
T
kieferrm 333d9a4053 Hello Copilot
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
2025-06-27 11:35:20 +02:00

28 lines
982 B
TypeScript

/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { ITestingServicesAccessor } from '../../src/platform/test/node/services';
import { ISimulationTestRuntime } from './stest';
export function rubric(accessor: ITestingServicesAccessor, ...assertions: (() => void)[]) {
const runtime = accessor.get(ISimulationTestRuntime);
let passed = 0;
for (const a of assertions) {
try {
a();
passed++;
} catch (e) {
runtime.log(String(e));
// ignored
}
}
if (passed === 0) {
runtime.setOutcome({ kind: 'failed', hitContentFilter: false, error: 'no passed assertions', critical: false });
} else {
runtime.setExplicitScore(passed / assertions.length);
}
}