refactor(test-utils): deprecate the isDockerDisabledForTests function

Signed-off-by: Camila Belo <camilaibs@gmail.com>
This commit is contained in:
Camila Belo
2024-07-10 12:53:32 +02:00
parent 95a3a0b91c
commit b82aff92aa
106 changed files with 329 additions and 272 deletions
@@ -61,7 +61,7 @@ requests and return mock responses. This lets you stub out remote services
rather than the local clients, leading to more thorough and robust tests. You
can read more about how it works [in their documentation](https://mswjs.io/).
The `@backstage/backend-test-utils` package exports a `setupRequestMockHandlers`
The `@backstage/backend-test-utils` package exports a `registerMswTestHooks`
function which ensures that the correct `jest` lifecycle hooks are invoked to
set up and tear down your `msw` instance, and enables the option that completely
rejects requests that don't match one of your mock rules. This ensures that your
@@ -70,13 +70,13 @@ tests cannot accidentally leak traffic into production from tests.
Example:
```ts
import { setupRequestMockHandlers } from '@backstage/backend-test-utils';
import { registerMswTestHooks } from '@backstage/backend-test-utils';
import { rest } from 'msw';
import { setupServer } from 'msw/node';
describe('read from remote', () => {
const worker = setupServer();
setupRequestMockHandlers(worker);
registerMswTestHooks(worker);
it('should auth and read successfully', async () => {
expect.assertions(1);