Managing Effect Wrappers and Conditional Test Execution in @effect/vitest

in @effect/vitest is there
1. a way to do it.effect.only or it.effect.skip, etc?
2. a way to share some effect wrapper between tests?
maybe like
const testServices = pipe(
  Layer.mergeAll(...)
  Layer.tapErrorCause((error) => Effect.logError('LAYER ERROR', error)),
) satisfies Layer.Layer<any, any, never>;

const manageRuntime = ManagedRuntime.make(testServices);
afterAll(() => manageRuntime.dispose());

const test = <
  A,
  E,
  Eff extends Effect.Effect<A, E, Layer.Layer.Success<typeof testServices>>,
>(
  effect: Eff,
) =>
  pipe(
    effect,
    Effect.tapErrorCause((error) => Effect.logError('TEST ERROR', error)),
    manageRuntime.runPromise,
  );

describe.concurrent('tests', () => {
  it('foo', () =>
    test(
      Effect.gen(function* () {...}),
    ));
  it('bar', () =>
    test(
      Effect.gen(function* () {...}),
    ));
})
Was this page helpful?