File tree Expand file tree Collapse file tree 4 files changed +13
-3
lines changed
Expand file tree Collapse file tree 4 files changed +13
-3
lines changed Original file line number Diff line number Diff line change 2424 "lint-fix" : " run-p lint-fix:*" ,
2525 "lint-fix:format" : " yarn --silent prettier --write" ,
2626 "lint-fix:tslint" : " yarn --silent tslint --fix" ,
27- "lint:format" : " yarn --silent prettier -l " ,
27+ "lint:format" : " yarn --silent prettier --check " ,
2828 "lint:tslint" : " yarn --silent tslint" ,
2929 "prepare" : " run-s build" ,
3030 "test" : " run-s lint test:*" ,
Original file line number Diff line number Diff line change 1+ import Ajv from "ajv" ;
2+
3+ export const errorLogger : Ajv . CustomLogger = {
4+ // tslint:disable-next-line:no-console
5+ error : ( ...args ) => console . log ( ...args ) ,
6+ log : ( ) => null ,
7+ warn : ( ) => null ,
8+ } ;
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import { MatcherState } from "expect";
33import { matcherHint } from "jest-matcher-utils" ;
44import get from "lodash/get" ;
55import { ajvCompile } from "./ajvCompile" ;
6+ import { errorLogger } from "./ajvLogger" ;
67import { getErrorMessage } from "./getErrorMessage" ;
78
89export type Method =
@@ -137,7 +138,7 @@ export async function toMatchApiResponse(
137138 } ;
138139 }
139140
140- const validate = ajvCompile ( schema ) ;
141+ const validate = ajvCompile ( schema , { logger : errorLogger } ) ;
141142 const body = received . body ;
142143 const pass = await validate ( body ) ;
143144 if ( ! pass ) {
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import RefParser from "@apidevtools/json-schema-ref-parser";
22import { MatcherState } from "expect" ;
33import { matcherHint } from "jest-matcher-utils" ;
44import { ajvCompile } from "./ajvCompile" ;
5+ import { errorLogger } from "./ajvLogger" ;
56import { getErrorMessage } from "./getErrorMessage" ;
67
78declare global {
@@ -45,7 +46,7 @@ export async function toMatchRef$(
4546 } ;
4647 }
4748
48- const validate = ajvCompile ( desiredSpec ) ;
49+ const validate = ajvCompile ( desiredSpec , { logger : errorLogger } ) ;
4950 const pass = await validate ( received ) ;
5051 if ( ! pass ) {
5152 return {
You can’t perform that action at this time.
0 commit comments