Skip to content
Source
Sign inSign up
Open History to see the last commit

SqlStatementCounter.integration.ts

18 lines561 Bytes

1import * as Tracer from "effect/Tracer";
2​
3export interface SqlStatementCounter {
4 readonly tracer: Tracer.Tracer;
5 readonly count: () => number;
6}
7​
8/** Install on every test runtime to include background reactor statements. */
9export function makeSqlStatementCounter(): SqlStatementCounter {
10 let statements = 0;
11 const tracer = Tracer.make({
12 span: (options) => {
13 if (options.kind === "client" && options.name === "sqlite") statements += 1;
14 return new Tracer.NativeSpan(options);
15 },
16 });
17 return { tracer, count: () => statements };