Skip to content

Commit

Permalink
Tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
mattpocock committed Nov 30, 2024
1 parent f3a067f commit a5263dc
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
6 changes: 2 additions & 4 deletions packages/evalite-vitest/src/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { createHash } from "crypto";

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

Expand Down Expand Up @@ -49,9 +49,7 @@ export const runVitest = async (opts: {

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

console.log(hash);

vitest.provide("evaliteSourceCodeHash", hash);
vitest.provide("evaliteInputHash", hash);

await vitest.start();

Expand Down
2 changes: 1 addition & 1 deletion packages/evalite-vitest/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export const evalite = <TInput, TExpected>(
throw new Error("You must provide at least one scorer.");
}

const sourceCodeHash = inject("evaliteSourceCodeHash");
const sourceCodeHash = inject("evaliteInputHash");

const data = await opts.data();
const start = performance.now();
Expand Down
7 changes: 7 additions & 0 deletions packages/evalite-vitest/src/tests/fixtures/basics/basics.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { setTimeout } from "timers/promises";

export async function basics(input: string) {
// To test whether duration is calculated properly
await setTimeout(10);
return input + "def";
}

0 comments on commit a5263dc

Please sign in to comment.