Replies: 1 comment
-
Actually I've just made a more minimal reproduction and it appears Option 2 should work, so I need to investigate why in our more detailed setup it's not... |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi there,
I'm using msw to mock some API responses on a per-test basis. Within MSW there is some relatively new functionality called Server Boundary where you can isolate the responses for a single test run - full API docs here. The server boundary works by passing your work into a callback within the boundary.
I'm trying to work out how to best integrate this with my vitest test suite.
I've tried a couple of things
Option 1 - within the test callback doesn't work
Option 2 - shifting server.boundary up to the test callback doesn't work
Option 3 - making the boundary an iife does work 🎉
Option 4 - invoking using a name does work 🎉
I'm just wondering if anyone else has any tips for how they might structure a test suite with this sort of code.
Thanks
Beta Was this translation helpful? Give feedback.
All reactions