openapi-library / OpenAPIValidators

Use Jest or Chai to assert that HTTP responses satisfy an OpenAPI spec
MIT License
189 stars 35 forks source link

Property 'toSatisfyApiSpec' does not exist on type 'Matchers<void, Response>' #285

Closed valtonia closed 1 year ago

valtonia commented 1 year ago

Are you using jest or chai? jest

Are you using OpenAPI 2, 3.0.X, or 3.1.0? 3.0

Describe the bug clearly Following the example for using jest-openapi when running the tests I get this message:

tests/openapi.test.ts:148:34 - error TS2339: Property 'toSatisfyApiSpec' does not exist on type 'Matchers<void, Response>'.

The environment is node 16.x running inside a docker container, configured as Typescript 4.8.x, ESM, and jest 27.x

Steps to reproduce the bug:

What did you expect to happen instead? Test should run successfully

markdowney commented 1 year ago

Got it to work by installing types from @types/jest and removing

import { expect } from '@jest/globals';