CARVIEW |
Select Language
HTTP/2 200
date: Mon, 13 Oct 2025 23:18:53 GMT
content-type: text/html
content-encoding: gzip
cf-cache-status: MISS
access-control-allow-origin: *
cache-control: public, max-age=0, must-revalidate
set-cookie: __cf_bm=V8VvU.ar6rXZGLqBjawrvyFEnyuygLEWRB2OSWdP2zk-1760397533-1.0.1.1-rS5t92MZNNDQxljMwJ1HhNYjqaj9gvjCeUeAbfWiwEjAi9PFmn2u6usch0HQVZ57ObZsqNYpyYAmpz8hLPsc3x6F5lFu5lAr2vQGL2fLf7o; path=/; expires=Mon, 13-Oct-25 23:48:53 GMT; domain=.developers.cloudflare.com; HttpOnly; Secure; SameSite=None
vary: Accept-Encoding
strict-transport-security: max-age=15552000; preload
x-content-type-options: nosniff
speculation-rules: "/cdn-cgi/speculation"
server: cloudflare
cf-ray: 98e28f067b651f95-BLR
alt-svc: h3=":443"; ma=86400
assert · Cloudflare Workers docs
Skip to content
JavaScript
assert
The node:assert
↗ module in Node.js provides a number of useful assertions that are useful when building tests.
import { strictEqual, deepStrictEqual, ok, doesNotReject } from "node:assert";
strictEqual(1, 1); // ok!strictEqual(1, "1"); // fails! throws AssertionError
deepStrictEqual({ a: { b: 1 } }, { a: { b: 1 } }); // ok!deepStrictEqual({ a: { b: 1 } }, { a: { b: 2 } }); // fails! throws AssertionError
ok(true); // ok!ok(false); // fails! throws AssertionError
await doesNotReject(async () => {}); // ok!await doesNotReject(async () => { throw new Error("boom");}); // fails! throws AssertionError
Refer to the Node.js documentation for assert
↗ for more information.
Was this helpful?
- Resources
- API
- New to Cloudflare?
- Directory
- Sponsorships
- Open Source
- Support
- Help Center
- System Status
- Compliance
- GDPR
- Company
- cloudflare.com
- Our team
- Careers
- © 2025 Cloudflare, Inc.
- Privacy Policy
- Terms of Use
- Report Security Issues
- Trademark
-