jest-expect-har
v7.1.1
Published
Jest/Vitest matcher for asserting valid HAR definitions
Downloads
2,604
Readme
jest-expect-har
A Jest custom matcher for asserting valid HAR definitions. Also supports Vitest.
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();
});