1
0

feat: ValueMatcher 支持 primitive 原始值简写,等价于 { equals: value }

This commit is contained in:
2026-05-19 17:07:47 +08:00
parent 8d8549d07f
commit 12cd05b04e
37 changed files with 1836 additions and 1022 deletions

View File

@@ -6,7 +6,7 @@ import type { HttpExpectConfig, HttpTargetConfig, ResolvedHttpTarget } from "./t
import { checkContentRules } from "../../expect/content";
import { errorFailure, mismatchFailure } from "../../expect/failure";
import { checkValueMatcher } from "../../expect/matcher";
import { checkValueMatcher, isValueMatcherObject } from "../../expect/matcher";
import { parseSize } from "../../utils";
import { checkHeaders, checkStatus } from "./expect";
import { httpCheckerSchemas } from "./schema";
@@ -198,7 +198,7 @@ function checkEarlyTimeout(
start: number,
durationMatcher: HttpExpectConfig["durationMs"] | undefined,
): null | { elapsed: number; failure: CheckResult["failure"] } {
if (durationMatcher === undefined) return null;
if (!isValueMatcherObject(durationMatcher)) return null;
const limit = Math.min(
durationMatcher.lte ?? Number.POSITIVE_INFINITY,
durationMatcher.lt ?? Number.POSITIVE_INFINITY,