diff --git a/assert/equal.ts b/assert/equal.ts index ce66424d2c07..97aaabfe699a 100644 --- a/assert/equal.ts +++ b/assert/equal.ts @@ -89,10 +89,18 @@ function sameValueZero(a: unknown, b: unknown) { /** * Deep equality comparison used in assertions. * + * This function is based on value equality, but for some cases (such as data + * that can only be read asynchronously or function properties) value equality + * is not possible to determine. In such cases, reference equality is used + * instead, which may cause false negatives for objects such as `Blob`s or + * `Request`s. + * * @param a The actual value * @param b The expected value * @returns `true` if the values are deeply equal, `false` otherwise * + * @throws {TypeError} If either value is a `WeakMap` or `WeakSet`. + * * @example Usage * ```ts * import { equal } from "@std/assert/equal"; diff --git a/assert/equals.ts b/assert/equals.ts index e1a077a81686..b8370584425b 100644 --- a/assert/equals.ts +++ b/assert/equals.ts @@ -15,9 +15,11 @@ import { AssertionError } from "./assertion_error.ts"; * Type parameter can be specified to ensure values under comparison have the * same type. * - * Note: When comparing `Blob` objects, you should first convert them to - * `Uint8Array` using the `Blob.bytes()` method and then compare their - * contents. + * Note: This function is based on value equality, but for some cases (such as + * data that can only be read asynchronously or function properties) value + * equality is not possible to determine. In such cases, reference equality is + * used instead, which may cause false negatives for objects such as `Blob`s or + * `Request`s. * * @example Usage * ```ts ignore diff --git a/assert/not_equals.ts b/assert/not_equals.ts index 07164446f645..12a26234d07b 100644 --- a/assert/not_equals.ts +++ b/assert/not_equals.ts @@ -11,6 +11,12 @@ import { format } from "@std/internal/format"; * * Type parameter can be specified to ensure values under comparison have the same type. * + * Note: This function is based on value equality, but for some cases (such as + * data that can only be read asynchronously or function properties) value + * equality is not possible to determine. In such cases, reference equality is + * used instead, which may cause false negatives for objects such as `Blob`s or + * `Request`s. + * * @example Usage * ```ts ignore * import { assertNotEquals } from "@std/assert";