Skip to content

Commit

Permalink
Removed sourceCodeHash, no longer used
Browse files Browse the repository at this point in the history
  • Loading branch information
mattpocock committed Dec 10, 2024
1 parent 1abcb45 commit 6c06903
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 27 deletions.
1 change: 0 additions & 1 deletion packages/evalite-core/src/db/tests/db.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ describe("getEvalsAverageScores", () => {
meta: {
evalite: {
duration: 100,
sourceCodeHash: "abc",
results: [
{
input: "input",
Expand Down
1 change: 0 additions & 1 deletion packages/evalite-core/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ export declare namespace Evalite {
export type TaskMeta = {
results: Result[];
duration: number | undefined;
sourceCodeHash: string;
};

export type Task<TInput, TExpected> = (
Expand Down
6 changes: 0 additions & 6 deletions packages/evalite/src/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@ import { Command } from "commander";
import { runVitest } from "./run-vitest.js";
import { createDatabase } from "@evalite/core/db";

declare module "vitest" {
export interface ProvidedContext {
evaliteInputHash: string;
}
}

export const program = new Command();

program.description("Run evals once and exit").action(() => {
Expand Down
3 changes: 0 additions & 3 deletions packages/evalite/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,6 @@ export const evalite = <TInput, TExpected = TInput>(
opts: Evalite.RunnerOpts<TInput, TExpected>
) => {
return it(testName, async ({ task }) => {
const sourceCodeHash = inject("evaliteInputHash");

const data = await opts.data();
const start = performance.now();
const results = await Promise.all(
Expand All @@ -107,7 +105,6 @@ export const evalite = <TInput, TExpected = TInput>(
task.meta.evalite = {
results,
duration: Math.round(performance.now() - start),
sourceCodeHash,
};
});
};
Expand Down
16 changes: 0 additions & 16 deletions packages/evalite/src/run-vitest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,22 +60,6 @@ export const runVitest = async (opts: {
}
);

await vitest.collect(filters);

const allFileResults = Array.from(vitest.vitenode.fetchCache);

const sourceFileResults = allFileResults.filter(([path, item]) => {
return !(path.endsWith(".eval.ts") || path.endsWith(".eval.js"));
});

const codeFromSourceFiles = sourceFileResults.reduce((acc, [path, item]) => {
return acc + (item.result.code ?? "");
}, "");

const hash = createHash("sha256").update(codeFromSourceFiles).digest("hex");

vitest.provide("evaliteInputHash", hash);

await vitest.start(filters);

const dispose = registerConsoleShortcuts(
Expand Down

0 comments on commit 6c06903

Please sign in to comment.