Error with Missing DATABASE_URL in Tests

hi again 😅
i'm trying to write tests for my rpc layer that depend on a db
/* imports omitted for brevity */
const handler = RpcRouter.toHandler(appRouter);
const resolver = RpcResolver.make(handler)<typeof appRouter>()
const withCtx = RequestResolver.contextFromServices(PgRootDB)(resolver)
const client = RpcResolver.toClient(withCtx)

describe("posts", () => {
  it.live("can make a new post", () =>
    Effect.gen(function* () {
      const result = yield* client(new CreatePost({ body: "hello world" }));
      Effect.log(result)
      expect(result).toBeInstanceOf(Object);
      expect(result.body).toEqual("hello world");
    }).pipe(
      Effect.provide(PgRootLive),
      Effect.provide(PgClient.layer({ url: Config.redacted("DATABASE_URL") })),
    )
  );
  // more tests
});
this makes the types happy, but when actually running vitest it throws
Error: (Missing data at DATABASE_URL: "Expected DATABASE_URL to exist in the process context")
and I can't figure out how put it into the expected context.. i tried piping through
Effect.provide(Layer.setConfigProvider(ConfigProvider.fromEnv()))
but this had no effect, nor using it.effect or just it() or anything else i tried
Was this page helpful?