@mocky-balboa/shared-config

v1.0.8

Published

Shared configuration for Mocky Balboa packages.

Readme

🥊 Mocky Balboa

A network mocking library for your SSR applications. Fixture http network requests on your server-side application for browser automation testing without having to modify your application logic.

Getting started

Check out the documentation to get started.

Server integrations

Browser automation tool support

Custom integrations

Don't see your framework? Create a custom server integration or a custom client integration. Alternatively submit a pull request or report an issue to add support for your framework.

Examples

Playwright example

import { expect } from "@playwright/test";
import { test } from "@mocky-balboa/playwright";

test("a route that performs server and client network requests", async ({ page, mocky }) => {
  // Mocks the request on both the client and the server
  mocky.route("**/api/endpoint", (route) => {
    return route.fulfill({
      status: 200,
      body: JSON.stringify({ message: "Hello, World!" }),
      headers: { "Content-Type": "application/json" },
    });
  }, {
    // Optionally configure the route
    // type: "both" to mock on both client and server (default behaviour)
    // type: "server-only" to mock on the server only
    // type: "client-only" to mock on the client only
  });

  await page.goto("http://localhost:3000");
});

More examples

See examples for example projects.

Contributing

See contributing for more information.