jest-expect-har
TypeScript icon, indicating that this package has built-in type declarations

7.1.0 • Public • Published

jest-expect-har

A Jest custom matcher for asserting valid HAR definitions. Also supports Vitest.

npm Build

ReadMe Open Source

Installation

npm install jest-expect-har --save-dev

Usage

import toBeAValidHAR from 'jest-expect-har';

expect.extend({ toBeAValidHAR });

test('should be a valid HAR', () => {
  expect(har).toBeAValidHAR();
});

test('should not be a valid HAR', () => {
  expect(invalidHar).not.toBeAValidHAR();
});

The usage is nearly identical in Vitest:

import toBeAValidHAR from 'jest-expect-har';
import { expect, test } from 'vitest';

expect.extend({ toBeAValidHAR });

test('should be a valid HAR', () => {
  expect(har).toBeAValidHAR();
});

test('should not be a valid HAR', () => {
  expect(invalidHar).not.toBeAValidHAR();
});

/jest-expect-har/

    Package Sidebar

    Install

    npm i jest-expect-har

    Weekly Downloads

    197

    Version

    7.1.0

    License

    MIT

    Unpacked Size

    6.95 kB

    Total Files

    5

    Last publish

    Collaborators

    • llimllib
    • darrenyong
    • gratcliff
    • dannobytes
    • gkoberger
    • domharrington
    • mjcuva
    • kanadgupta
    • jonursenbach
    • rafegoldberg
    • dashron
    • iliast