Replacing the Default Runtime's Config Provider in Tests

How do I replace the defaultRuntime's configProvider, so that I don't have to provide it to all my test cases?

Here is how my tests look like now and the two lines I wish I could dedupe to not create new Contexts for each test case:

describe("ContentDeliveryService (Integration)", () => {
  it.effect("should successfully be able to retrieve de-de news by ID", () =>
    Effect.gen(function* () {
      const svc = yield* ContentDeliveryService
      const id = NewsId.make("bltab9ed59fd4d998eb")
      const locale = Locale.make("de-de")
      const response = yield* svc.getNewsById(id, locale)
      expect(response.entry.uid).toBe(id)
      expect(response.entry.locale).toBe(locale)
    }).pipe(
      Effect.provide(ContentDeliveryService.Default),
      // how do I dedupe these two lines perhaps in a beforeAll call:
      Effect.provide(PlatformConfigProvider.layerDotEnv(".env")),
      Effect.provide(NodeFileSystem.layer)
    )
  )

  // similar it.effect test cases here...
})
Was this page helpful?