@useoptic/fastify-capture
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

Fastify capture

Capture your Fastify test traffic to .har HTTP archive files.

Installation

yarn add @useoptic/fastify-capture
npm install @useoptic/fastify-capture

Setup

import { fastifyCapture } form '@useoptic/fastify-capture'

if (env === 'test') {
  fastify.addHook('onSend', fastifyCapture({
    // Determines where the captured archives will be exported
    harOutputDir: 'har-capture',

    // Set to a number between 0 and 1 to sample traffic
    sampleRate: undefined
  }));
}

Usage

The optic CLI uses the captured .har files to measure how much of your OpenAPI specification is covered by your tests 🪄

Learn more about capture and coverage in Optic's documentation.

/@useoptic/fastify-capture/

    Package Sidebar

    Install

    npm i @useoptic/fastify-capture

    Weekly Downloads

    331

    Version

    1.0.3

    License

    MIT

    Unpacked Size

    13.1 kB

    Total Files

    6

    Last publish

    Collaborators

    • niclim
    • acunniffe
    • opticbot
    • notnmeyer