You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

@launchtray/hatch-mock-server

Package Overview
Dependencies
Maintainers
1
Versions
148
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@launchtray/hatch-mock-server

This project is a TypeScript library which provides a mock server for testing.

0.23.0
latest
npmnpm
Version published
Maintainers
1
Created
Source

hatch-mock-server

This project is a TypeScript library which provides a mock server for testing.

Usage

The mock server can be started via the mock-server command, e.g. within a script defined in package.json. To set the port that is used, set the PORT environment variable, e.g.:

    "start:service-mock": "PORT=8080 mock-server",

Interacting with the mock server (e.g. within a test) is done via the MockServerClient class:

  const mockClient = new MockServerClient({
    host: 'localhost',
    port: 8080,
  });

  ...

  // Refer to SimpleMockResponseOptions for the full list of options
  await mockClient.mockSimpleResponse({
    path: '/api/my-api',
    method: 'GET',
    statusCode: 200,
    queryParams: {'id': '123'},
    responseBody: 'Hello, world!',
  });

FAQs

Package last updated on 12 Feb 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts