JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1176
  • Score
    100M100P100Q112469F
  • License MIT

Jest/Vitest matcher for asserting valid OpenAPI definitions

Package Exports

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (jest-expect-openapi) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    jest-expect-openapi

    A Vitest and Jest custom matcher for asserting valid OpenAPI definitions.

    npm Build

    ReadMe Open Source

    Installation

    npm install jest-expect-openapi --save-dev

    Usage

    import toBeAValidOpenAPIDefinition from 'jest-expect-openapi';
    import { expect, test } from 'vitest';
    
    expect.extend({ toBeAValidOpenAPIDefinition });
    
    test('should be a valid OpenAPI definition', () => {
      expect(oas).toBeAValidOpenAPIDefinition();
    });
    
    test('should not be a valid OpenAPI definition', () => {
      expect(invalidOas).not.toBeAValidOpenAPIDefinition();
    });

    The usage is nearly identical in Jest:

    import toBeAValidOpenAPIDefinition from 'jest-expect-openapi';
    
    expect.extend({ toBeAValidOpenAPIDefinition });
    
    test('should be a valid OpenAPI definition', () => {
      expect(oas).toBeAValidOpenAPIDefinition();
    });
    
    test('should not be a valid OpenAPI definition', () => {
      expect(invalidOas).not.toBeAValidOpenAPIDefinition();
    });