Akryum / peeky

A fast and fun test runner for Vite & Node 🐈️ Powered by Vite ⚡️
https://peeky.dev
MIT License
681 stars 17 forks source link

Top level `beforeAll`, `beforeEach()`, `afterAll`, and `afterEach` #66

Closed posva closed 2 years ago

posva commented 2 years ago

Right now, when these are declared outside of a describe(), they don't run. This would be useful to setup o mocking HTTP server like https://mswjs.io/ and adding it to setupFiles in the peeky config to automatically add this to all test suites:

import { server } from './mock/server.ts' // msw specific

beforeAll(() => server.listen())
afterEach(() => server.resetHandlers())
afterAll(() => server.close())
victorlmneves commented 2 years ago

@posva I'm using it outside a describe() and it's working fine

posva commented 2 years ago

I think @Akryum implemented this but forgot to close it