{
  "type": "module",
  "source": "doc/api/assert.md",
  "modules": [
    {
      "textRaw": "Assert",
      "name": "assert",
      "introduced_in": "v0.1.21",
      "type": "module",
      "stability": 2,
      "stabilityText": "Stable",
      "desc": "<p>The <code>node:assert</code> module provides a set of assertion functions for verifying\ninvariants.</p>",
      "modules": [
        {
          "textRaw": "Strict assertion mode",
          "name": "strict_assertion_mode",
          "type": "module",
          "meta": {
            "added": [
              "v9.9.0"
            ],
            "changes": [
              {
                "version": "v15.0.0",
                "pr-url": "https://github.com/nodejs/node/pull/34001",
                "description": "Exposed as `require('node:assert/strict')`."
              },
              {
                "version": [
                  "v13.9.0",
                  "v12.16.2"
                ],
                "pr-url": "https://github.com/nodejs/node/pull/31635",
                "description": "Changed \"strict mode\" to \"strict assertion mode\" and \"legacy mode\" to \"legacy assertion mode\" to avoid confusion with the more usual meaning of \"strict mode\"."
              },
              {
                "version": "v9.9.0",
                "pr-url": "https://github.com/nodejs/node/pull/17615",
                "description": "Added error diffs to the strict assertion mode."
              },
              {
                "version": "v9.9.0",
                "pr-url": "https://github.com/nodejs/node/pull/17002",
                "description": "Added strict assertion mode to the assert module."
              }
            ]
          },
          "desc": "<p>In strict assertion mode, non-strict methods behave like their corresponding\nstrict methods. For example, <a href=\"#assertdeepequalactual-expected-message\"><code>assert.deepEqual()</code></a> will behave like\n<a href=\"#assertdeepstrictequalactual-expected-message\"><code>assert.deepStrictEqual()</code></a>.</p>\n<p>In strict assertion mode, error messages for objects display a diff. In legacy\nassertion mode, error messages for objects display the objects, often truncated.</p>",
          "modules": [
            {
              "textRaw": "Message parameter semantics",
              "name": "message_parameter_semantics",
              "type": "module",
              "desc": "<p>For assertion methods that accept an optional <code>message</code> parameter, the message\nmay be provided in one of the following forms:</p>\n<ul>\n<li><strong>string</strong>: Used as-is. If additional arguments are supplied after the\n<code>message</code> string, they are treated as printf-like substitutions (see\n<a href=\"util.html#utilformatformat-args\"><code>util.format()</code></a>).</li>\n<li><strong>Error</strong>: If an <code>Error</code> instance is provided as <code>message</code>, that error is\nthrown directly instead of an <code>AssertionError</code>.</li>\n<li><strong>function</strong>: A function of the form <code>(actual, expected) => string</code>. It is\ncalled only when the assertion fails and should return a string to be used as\nthe error message. Non-string return values are ignored and the default\nmessage is used instead.</li>\n</ul>\n<p>If additional arguments are passed along with an <code>Error</code> or a function as\n<code>message</code>, the call is rejected with <code>ERR_AMBIGUOUS_ARGUMENT</code>.</p>\n<p>If the first item is neither a string, <code>Error</code>, nor function, <code>ERR_INVALID_ARG_TYPE</code>\nis thrown.</p>\n<p>To use strict assertion mode:</p>\n<pre><code class=\"language-mjs\">import { strict as assert } from 'node:assert';\n</code></pre>\n<pre><code class=\"language-cjs\">const assert = require('node:assert').strict;\n</code></pre>\n<pre><code class=\"language-mjs\">import assert from 'node:assert/strict';\n</code></pre>\n<pre><code class=\"language-cjs\">const assert = require('node:assert/strict');\n</code></pre>\n<p>Example error diff:</p>\n<pre><code class=\"language-mjs\">import { strict as assert } from 'node:assert';\n\nassert.deepEqual([[[1, 2, 3]], 4, 5], [[[1, 2, '3']], 4, 5]);\n// AssertionError: Expected inputs to be strictly deep-equal:\n// + actual - expected ... Lines skipped\n//\n//   [\n//     [\n// ...\n//       2,\n// +     3\n// -     '3'\n//     ],\n// ...\n//     5\n//   ]\n</code></pre>\n<pre><code class=\"language-cjs\">const assert = require('node:assert/strict');\n\nassert.deepEqual([[[1, 2, 3]], 4, 5], [[[1, 2, '3']], 4, 5]);\n// AssertionError: Expected inputs to be strictly deep-equal:\n// + actual - expected ... Lines skipped\n//\n//   [\n//     [\n// ...\n//       2,\n// +     3\n// -     '3'\n//     ],\n// ...\n//     5\n//   ]\n</code></pre>\n<p>To deactivate the colors, use the <code>NO_COLOR</code> or <code>NODE_DISABLE_COLORS</code>\nenvironment variables. This will also deactivate the colors in the REPL. For\nmore on color support in terminal environments, read the tty\n<a href=\"tty.html#writestreamgetcolordepthenv\"><code>getColorDepth()</code></a> documentation.</p>",
              "displayName": "Message parameter semantics"
            }
          ],
          "displayName": "Strict assertion mode"
        },
        {
          "textRaw": "Legacy assertion mode",
          "name": "legacy_assertion_mode",
          "type": "module",
          "desc": "<p>Legacy assertion mode uses the <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Equality\"><code>==</code> operator</a> in:</p>\n<ul>\n<li><a href=\"#assertdeepequalactual-expected-message\"><code>assert.deepEqual()</code></a></li>\n<li><a href=\"#assertequalactual-expected-message\"><code>assert.equal()</code></a></li>\n<li><a href=\"#assertnotdeepequalactual-expected-message\"><code>assert.notDeepEqual()</code></a></li>\n<li><a href=\"#assertnotequalactual-expected-message\"><code>assert.notEqual()</code></a></li>\n</ul>\n<p>To use legacy assertion mode:</p>\n<pre><code class=\"language-mjs\">import assert from 'node:assert';\n</code></pre>\n<pre><code class=\"language-cjs\">const assert = require('node:assert');\n</code></pre>\n<p>Legacy assertion mode may have surprising results, especially when using\n<a href=\"#assertdeepequalactual-expected-message\"><code>assert.deepEqual()</code></a>:</p>\n<pre><code class=\"language-cjs\">// WARNING: This does not throw an AssertionError in legacy assertion mode!\nassert.deepEqual(/a/gi, new Date());\n</code></pre>",
          "displayName": "Legacy assertion mode"
        }
      ],
      "classes": [
        {
          "textRaw": "Class: `assert.AssertionError`",
          "name": "assert.AssertionError",
          "type": "class",
          "desc": "<ul>\n<li>Extends: <a href=\"errors.html#class-errorserror\"><code>&#x3C;errors.Error></code></a></li>\n</ul>\n<p>Indicates the failure of an assertion. All errors thrown by the <code>node:assert</code>\nmodule will be instances of the <code>AssertionError</code> class.</p>",
          "signatures": [
            {
              "textRaw": "`new assert.AssertionError(options)`",
              "name": "assert.AssertionError",
              "type": "ctor",
              "meta": {
                "added": [
                  "v0.1.21"
                ],
                "changes": []
              },
              "params": [
                {
                  "textRaw": "`options` {Object}",
                  "name": "options",
                  "type": "Object",
                  "options": [
                    {
                      "textRaw": "`message` {string} If provided, the error message is set to this value.",
                      "name": "message",
                      "type": "string",
                      "desc": "If provided, the error message is set to this value."
                    },
                    {
                      "textRaw": "`actual` {any} The `actual` property on the error instance.",
                      "name": "actual",
                      "type": "any",
                      "desc": "The `actual` property on the error instance."
                    },
                    {
                      "textRaw": "`expected` {any} The `expected` property on the error instance.",
                      "name": "expected",
                      "type": "any",
                      "desc": "The `expected` property on the error instance."
                    },
                    {
                      "textRaw": "`operator` {string} The `operator` property on the error instance.",
                      "name": "operator",
                      "type": "string",
                      "desc": "The `operator` property on the error instance."
                    },
                    {
                      "textRaw": "`stackStartFn` {Function} If provided, the generated stack trace omits frames before this function.",
                      "name": "stackStartFn",
                      "type": "Function",
                      "desc": "If provided, the generated stack trace omits frames before this function."
                    },
                    {
                      "textRaw": "`diff` {string} If set to `'full'`, shows the full diff in assertion errors. Defaults to `'simple'`. Accepted values: `'simple'`, `'full'`.",
                      "name": "diff",
                      "type": "string",
                      "desc": "If set to `'full'`, shows the full diff in assertion errors. Defaults to `'simple'`. Accepted values: `'simple'`, `'full'`."
                    }
                  ]
                }
              ],
              "desc": "<p>A subclass of <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error\"><code>&#x3C;Error></code></a> that indicates the failure of an assertion.</p>\n<p>All instances contain the built-in <code>Error</code> properties (<code>message</code> and <code>name</code>)\nand:</p>\n<ul>\n<li><code>actual</code> <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types\"><code>&#x3C;any></code></a> Set to the <code>actual</code> argument for methods such as\n<a href=\"#assertstrictequalactual-expected-message\"><code>assert.strictEqual()</code></a>.</li>\n<li><code>expected</code> <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types\"><code>&#x3C;any></code></a> Set to the <code>expected</code> value for methods such as\n<a href=\"#assertstrictequalactual-expected-message\"><code>assert.strictEqual()</code></a>.</li>\n<li><code>generatedMessage</code> <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type\"><code>&#x3C;boolean></code></a> Indicates if the message was auto-generated\n(<code>true</code>) or not.</li>\n<li><code>code</code> <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type\"><code>&#x3C;string></code></a> Value is always <code>ERR_ASSERTION</code> to show that the error is an\nassertion error.</li>\n<li><code>operator</code> <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type\"><code>&#x3C;string></code></a> Set to the passed in operator value.</li>\n</ul>\n<pre><code class=\"language-mjs\">import assert from 'node:assert';\n\n// Generate an AssertionError to compare the error message later:\nconst { message } = new assert.AssertionError({\n  actual: 1,\n  expected: 2,\n  operator: 'strictEqual',\n});\n\n// Verify error output:\ntry {\n  assert.strictEqual(1, 2);\n} catch (err) {\n  assert(err instanceof assert.AssertionError);\n  assert.strictEqual(err.message, message);\n  assert.strictEqual(err.name, 'AssertionError');\n  assert.strictEqual(err.actual, 1);\n  assert.strictEqual(err.expected, 2);\n  assert.strictEqual(err.code, 'ERR_ASSERTION');\n  assert.strictEqual(err.operator, 'strictEqual');\n  assert.strictEqual(err.generatedMessage, true);\n}\n</code></pre>\n<pre><code class=\"language-cjs\">const assert = require('node:assert');\n\n// Generate an AssertionError to compare the error message later:\nconst { message } = new assert.AssertionError({\n  actual: 1,\n  expected: 2,\n  operator: 'strictEqual',\n});\n\n// Verify error output:\ntry {\n  assert.strictEqual(1, 2);\n} catch (err) {\n  assert(err instanceof assert.AssertionError);\n  assert.strictEqual(err.message, message);\n  assert.strictEqual(err.name, 'AssertionError');\n  assert.strictEqual(err.actual, 1);\n  assert.strictEqual(err.expected, 2);\n  assert.strictEqual(err.code, 'ERR_ASSERTION');\n  assert.strictEqual(err.operator, 'strictEqual');\n  assert.strictEqual(err.generatedMessage, true);\n}\n</code></pre>"
            }
          ]
        },
        {
          "textRaw": "Class: `assert.Assert`",
          "name": "assert.Assert",
          "type": "class",
          "meta": {
            "added": [
              "v24.6.0",
              "v22.19.0"
            ],
            "changes": []
          },
          "desc": "<p>The <code>Assert</code> class allows creating independent assertion instances with custom options.</p>",
          "signatures": [
            {
              "textRaw": "`new assert.Assert([options])`",
              "name": "assert.Assert",
              "type": "ctor",
              "meta": {
                "changes": [
                  {
                    "version": "v24.9.0",
                    "pr-url": "https://github.com/nodejs/node/pull/59762",
                    "description": "Added `skipPrototype` option."
                  }
                ]
              },
              "params": [
                {
                  "textRaw": "`options` {Object}",
                  "name": "options",
                  "type": "Object",
                  "options": [
                    {
                      "textRaw": "`diff` {string} If set to `'full'`, shows the full diff in assertion errors. Defaults to `'simple'`. Accepted values: `'simple'`, `'full'`.",
                      "name": "diff",
                      "type": "string",
                      "desc": "If set to `'full'`, shows the full diff in assertion errors. Defaults to `'simple'`. Accepted values: `'simple'`, `'full'`."
                    },
                    {
                      "textRaw": "`strict` {boolean} If set to `true`, non-strict methods behave like their corresponding strict methods. Defaults to `true`.",
                      "name": "strict",
                      "type": "boolean",
                      "desc": "If set to `true`, non-strict methods behave like their corresponding strict methods. Defaults to `true`."
                    },
                    {
                      "textRaw": "`skipPrototype` {boolean} If set to `true`, skips prototype and constructor comparison in deep equality checks. Defaults to `false`.",
                      "name": "skipPrototype",
                      "type": "boolean",
                      "desc": "If set to `true`, skips prototype and constructor comparison in deep equality checks. Defaults to `false`."
                    }
                  ],
                  "optional": true
                }
              ],
              "desc": "<p>Creates a new assertion instance. The <code>diff</code> option controls the verbosity of diffs in assertion error messages.</p>\n<pre><code class=\"language-js\">const { Assert } = require('node:assert');\nconst assertInstance = new Assert({ diff: 'full' });\nassertInstance.deepStrictEqual({ a: 1 }, { a: 2 });\n// Shows a full diff in the error message.\n</code></pre>\n<p><strong>Important</strong>: When destructuring assertion methods from an <code>Assert</code> instance,\nthe methods lose their connection to the instance's configuration options (such\nas <code>diff</code>, <code>strict</code>, and <code>skipPrototype</code> settings).\nThe destructured methods will fall back to default behavior instead.</p>\n<pre><code class=\"language-js\">const myAssert = new Assert({ diff: 'full' });\n\n// This works as expected - uses 'full' diff\nmyAssert.strictEqual({ a: 1 }, { b: { c: 1 } });\n\n// This loses the 'full' diff setting - falls back to default 'simple' diff\nconst { strictEqual } = myAssert;\nstrictEqual({ a: 1 }, { b: { c: 1 } });\n</code></pre>\n<p>The <code>skipPrototype</code> option affects all deep equality methods:</p>\n<pre><code class=\"language-js\">class Foo {\n  constructor(a) {\n    this.a = a;\n  }\n}\n\nclass Bar {\n  constructor(a) {\n    this.a = a;\n  }\n}\n\nconst foo = new Foo(1);\nconst bar = new Bar(1);\n\n// Default behavior - fails due to different constructors\nconst assert1 = new Assert();\nassert1.deepStrictEqual(foo, bar); // AssertionError\n\n// Skip prototype comparison - passes if properties are equal\nconst assert2 = new Assert({ skipPrototype: true });\nassert2.deepStrictEqual(foo, bar); // OK\n</code></pre>\n<p>When destructured, methods lose access to the instance's <code>this</code> context and revert to default assertion behavior\n(diff: 'simple', non-strict mode).\nTo maintain custom options when using destructured methods, avoid\ndestructuring and call methods directly on the instance.</p>"
            }
          ]
        }
      ],
      "methods": [
        {
          "textRaw": "`assert(value[, message])`",
          "name": "assert",
          "type": "method",
          "meta": {
            "added": [
              "v0.5.9"
            ],
            "changes": [
              {
                "version": "v26.0.0",
                "pr-url": "https://github.com/nodejs/node/pull/58849",
                "description": "Message may now be a `printf`-like format string or function."
              }
            ]
          },
          "signatures": [
            {
              "params": [
                {
                  "textRaw": "`value` {any} The input that is checked for being truthy.",
                  "name": "value",
                  "type": "any",
                  "desc": "The input that is checked for being truthy."
                },
                {
                  "textRaw": "`message` {string|Error|Function}",
                  "name": "message",
                  "type": "string|Error|Function",
                  "optional": true
                }
              ]
            }
          ],
          "desc": "<p>An alias of <a href=\"#assertokvalue-message\"><code>assert.ok()</code></a>.</p>"
        },
        {
          "textRaw": "`assert.deepEqual(actual, expected[, message])`",
          "name": "deepEqual",
          "type": "method",
          "meta": {
            "added": [
              "v0.1.21"
            ],
            "changes": [
              {
                "version": "v26.0.0",
                "pr-url": "https://github.com/nodejs/node/pull/58849",
                "description": "Message may now be a `printf`-like format string or function."
              },
              {
                "version": "v25.0.0",
                "pr-url": "https://github.com/nodejs/node/pull/59448",
                "description": "Promises are not considered equal anymore if they are not of the same instance."
              },
              {
                "version": "v25.0.0",
                "pr-url": "https://github.com/nodejs/node/pull/57627",
                "description": "Invalid dates are now considered equal."
              },
              {
                "version": "v24.0.0",
                "pr-url": "https://github.com/nodejs/node/pull/57622",
                "description": "Recursion now stops when either side encounters a circular reference."
              },
              {
                "version": [
                  "v22.2.0",
                  "v20.15.0"
                ],
                "pr-url": "https://github.com/nodejs/node/pull/51805",
                "description": "Error cause and errors properties are now compared as well."
              },
              {
                "version": "v18.0.0",
                "pr-url": "https://github.com/nodejs/node/pull/41020",
                "description": "Regular expressions lastIndex property is now compared as well."
              },
              {
                "version": [
                  "v16.0.0",
                  "v14.18.0"
                ],
                "pr-url": "https://github.com/nodejs/node/pull/38113",
                "description": "In Legacy assertion mode, changed status from Deprecated to Legacy."
              },
              {
                "version": "v14.0.0",
                "pr-url": "https://github.com/nodejs/node/pull/30766",
                "description": "NaN is now treated as being identical if both sides are NaN."
              },
              {
                "version": "v12.0.0",
                "pr-url": "https://github.com/nodejs/node/pull/25008",
                "description": "The type tags are now properly compared and there are a couple minor comparison adjustments to make the check less surprising."
              },
              {
                "version": "v9.0.0",
                "pr-url": "https://github.com/nodejs/node/pull/15001",
                "description": "The `Error` names and messages are now properly compared."
              },
              {
                "version": "v8.0.0",
                "pr-url": "https://github.com/nodejs/node/pull/12142",
                "description": "The `Set` and `Map` content is also compared."
              },
              {
                "version": [
                  "v6.4.0",
                  "v4.7.1"
                ],
                "pr-url": "https://github.com/nodejs/node/pull/8002",
                "description": "Typed array slices are handled correctly now."
              },
              {
                "version": [
                  "v6.1.0",
                  "v4.5.0"
                ],
                "pr-url": "https://github.com/nodejs/node/pull/6432",
                "description": "Objects with circular references can be used as inputs now."
              },
              {
                "version": [
                  "v5.10.1",
                  "v4.4.3"
                ],
                "pr-url": "https://github.com/nodejs/node/pull/5910",
                "description": "Handle non-`Uint8Array` typed arrays correctly."
              }
            ]
          },
          "stability": 3,
          "stabilityText": "Legacy: Use `assert.deepStrictEqual()` instead.",
          "signatures": [
            {
              "params": [
                {
                  "textRaw": "`actual` {any}",
                  "name": "actual",
                  "type": "any"
                },
                {
                  "textRaw": "`expected` {any}",
                  "name": "expected",
                  "type": "any"
                },
                {
                  "textRaw": "`message` {string|Error|Function}",
                  "name": "message",
                  "type": "string|Error|Function",
                  "optional": true
                }
              ]
            }
          ],
          "desc": "<p><strong>Strict assertion mode</strong></p>\n<p>An alias of <a href=\"#assertdeepstrictequalactual-expected-message\"><code>assert.deepStrictEqual()</code></a>.</p>\n<p><strong>Legacy assertion mode</strong></p>\n<p>Tests for deep equality between the <code>actual</code> and <code>expected</code> parameters. Consider\nusing <a href=\"#assertdeepstrictequalactual-expected-message\"><code>assert.deepStrictEqual()</code></a> instead. <a href=\"#assertdeepequalactual-expected-message\"><code>assert.deepEqual()</code></a> can have\nsurprising results.</p>\n<p><em>Deep equality</em> means that the enumerable \"own\" properties of child objects\nare also recursively evaluated by the following rules.</p>",
          "modules": [
            {
              "textRaw": "Comparison details",
              "name": "comparison_details",
              "type": "module",
              "desc": "<ul>\n<li>Primitive values are compared with the <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Equality\"><code>==</code> operator</a>,\nwith the exception of <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NaN\"><code>&#x3C;NaN></code></a>. It is treated as being identical in case\nboth sides are <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NaN\"><code>&#x3C;NaN></code></a>.</li>\n<li><a href=\"https://tc39.github.io/ecma262/#sec-object.prototype.tostring\">Type tags</a> of objects should be the same.</li>\n<li>Only <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Enumerability_and_ownership_of_properties\">enumerable \"own\" properties</a> are considered.</li>\n<li>Object constructors are compared when available.</li>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error\"><code>&#x3C;Error></code></a> names, messages, causes, and errors are always compared,\neven if these are not enumerable properties.</li>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Data_structures#primitive_values\">Object wrappers</a> are compared both as objects and unwrapped values.</li>\n<li><code>Object</code> properties are compared unordered.</li>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map\"><code>&#x3C;Map></code></a> keys and <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set\"><code>&#x3C;Set></code></a> items are compared unordered.</li>\n<li>Recursion stops when both sides differ or either side encounters a circular\nreference.</li>\n<li>Implementation does not test the <a href=\"https://tc39.github.io/ecma262/#sec-ordinary-object-internal-methods-and-internal-slots\"><code>[[Prototype]]</code></a> of\nobjects.</li>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#symbol_type\"><code>&#x3C;Symbol></code></a> properties are not compared.</li>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakMap\"><code>&#x3C;WeakMap></code></a>, <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakSet\"><code>&#x3C;WeakSet></code></a> and <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise\"><code>&#x3C;Promise></code></a> instances are <strong>not</strong> compared\nstructurally. They are only equal if they reference the same object. Any\ncomparison between different <code>WeakMap</code>, <code>WeakSet</code>, or <code>Promise</code> instances\nwill result in inequality, even if they contain the same content.</li>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp\"><code>&#x3C;RegExp></code></a> lastIndex, flags, and source are always compared, even if these\nare not enumerable properties.</li>\n</ul>\n<p>The following example does not throw an <a href=\"#class-assertassertionerror\"><code>AssertionError</code></a> because the\nprimitives are compared using the <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Equality\"><code>==</code> operator</a>.</p>\n<pre><code class=\"language-mjs\">import assert from 'node:assert';\n// WARNING: This does not throw an AssertionError!\n\nassert.deepEqual('+00000000', false);\n</code></pre>\n<pre><code class=\"language-cjs\">const assert = require('node:assert');\n// WARNING: This does not throw an AssertionError!\n\nassert.deepEqual('+00000000', false);\n</code></pre>\n<p>\"Deep\" equality means that the enumerable \"own\" properties of child objects\nare evaluated also:</p>\n<pre><code class=\"language-mjs\">import assert from 'node:assert';\n\nconst obj1 = {\n  a: {\n    b: 1,\n  },\n};\nconst obj2 = {\n  a: {\n    b: 2,\n  },\n};\nconst obj3 = {\n  a: {\n    b: 1,\n  },\n};\nconst obj4 = { __proto__: obj1 };\n\nassert.deepEqual(obj1, obj1);\n// OK\n\n// Values of b are different:\nassert.deepEqual(obj1, obj2);\n// AssertionError: { a: { b: 1 } } deepEqual { a: { b: 2 } }\n\nassert.deepEqual(obj1, obj3);\n// OK\n\n// Prototypes are ignored:\nassert.deepEqual(obj1, obj4);\n// AssertionError: { a: { b: 1 } } deepEqual {}\n</code></pre>\n<pre><code class=\"language-cjs\">const assert = require('node:assert');\n\nconst obj1 = {\n  a: {\n    b: 1,\n  },\n};\nconst obj2 = {\n  a: {\n    b: 2,\n  },\n};\nconst obj3 = {\n  a: {\n    b: 1,\n  },\n};\nconst obj4 = { __proto__: obj1 };\n\nassert.deepEqual(obj1, obj1);\n// OK\n\n// Values of b are different:\nassert.deepEqual(obj1, obj2);\n// AssertionError: { a: { b: 1 } } deepEqual { a: { b: 2 } }\n\nassert.deepEqual(obj1, obj3);\n// OK\n\n// Prototypes are ignored:\nassert.deepEqual(obj1, obj4);\n// AssertionError: { a: { b: 1 } } deepEqual {}\n</code></pre>\n<p>If the values are not equal, an <a href=\"#class-assertassertionerror\"><code>AssertionError</code></a> is thrown with a <code>message</code>\nproperty set equal to the value of the <code>message</code> parameter. If the <code>message</code>\nparameter is undefined, a default error message is assigned. If the <code>message</code> parameter is an instance of <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error\"><code>&#x3C;Error></code></a> then it will be thrown instead of the <a href=\"#class-assertassertionerror\"><code>AssertionError</code></a>.</p>",
              "displayName": "Comparison details"
            }
          ]
        },
        {
          "textRaw": "`assert.deepStrictEqual(actual, expected[, message])`",
          "name": "deepStrictEqual",
          "type": "method",
          "meta": {
            "added": [
              "v1.2.0"
            ],
            "changes": [
              {
                "version": "v25.1.0",
                "pr-url": "https://github.com/nodejs/node/pull/58849",
                "description": "Message may now be a `printf`-like format string or function."
              },
              {
                "version": "v25.0.0",
                "pr-url": "https://github.com/nodejs/node/pull/59448",
                "description": "Promises are not considered equal anymore if they are not of the same instance."
              },
              {
                "version": "v25.0.0",
                "pr-url": "https://github.com/nodejs/node/pull/57627",
                "description": "Invalid dates are now considered equal."
              },
              {
                "version": "v24.0.0",
                "pr-url": "https://github.com/nodejs/node/pull/57622",
                "description": "Recursion now stops when either side encounters a circular reference."
              },
              {
                "version": [
                  "v22.2.0",
                  "v20.15.0"
                ],
                "pr-url": "https://github.com/nodejs/node/pull/51805",
                "description": "Error cause and errors properties are now compared as well."
              },
              {
                "version": "v18.0.0",
                "pr-url": "https://github.com/nodejs/node/pull/41020",
                "description": "Regular expressions lastIndex property is now compared as well."
              },
              {
                "version": "v9.0.0",
                "pr-url": "https://github.com/nodejs/node/pull/15169",
                "description": "Enumerable symbol properties are now compared."
              },
              {
                "version": "v9.0.0",
                "pr-url": "https://github.com/nodejs/node/pull/15036",
                "description": "The `NaN` is now compared using the [SameValueZero](https://tc39.github.io/ecma262/#sec-samevaluezero) comparison."
              },
              {
                "version": "v8.5.0",
                "pr-url": "https://github.com/nodejs/node/pull/15001",
                "description": "The `Error` names and messages are now properly compared."
              },
              {
                "version": "v8.0.0",
                "pr-url": "https://github.com/nodejs/node/pull/12142",
                "description": "The `Set` and `Map` content is also compared."
              },
              {
                "version": [
                  "v6.4.0",
                  "v4.7.1"
                ],
                "pr-url": "https://github.com/nodejs/node/pull/8002",
                "description": "Typed array slices are handled correctly now."
              },
              {
                "version": "v6.1.0",
                "pr-url": "https://github.com/nodejs/node/pull/6432",
                "description": "Objects with circular references can be used as inputs now."
              },
              {
                "version": [
                  "v5.10.1",
                  "v4.4.3"
                ],
                "pr-url": "https://github.com/nodejs/node/pull/5910",
                "description": "Handle non-`Uint8Array` typed arrays correctly."
              }
            ]
          },
          "signatures": [
            {
              "params": [
                {
                  "textRaw": "`actual` {any}",
                  "name": "actual",
                  "type": "any"
                },
                {
                  "textRaw": "`expected` {any}",
                  "name": "expected",
                  "type": "any"
                },
                {
                  "textRaw": "`message` {string|Error|Function}",
                  "name": "message",
                  "type": "string|Error|Function",
                  "optional": true
                }
              ]
            }
          ],
          "desc": "<p>Tests for deep equality between the <code>actual</code> and <code>expected</code> parameters.\n\"Deep\" equality means that the enumerable \"own\" properties of child objects\nare recursively evaluated also by the following rules.</p>",
          "modules": [
            {
              "textRaw": "Comparison details",
              "name": "comparison_details",
              "type": "module",
              "desc": "<ul>\n<li>Primitive values are compared using <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is\"><code>Object.is()</code></a>.</li>\n<li><a href=\"https://tc39.github.io/ecma262/#sec-object.prototype.tostring\">Type tags</a> of objects should be the same.</li>\n<li><a href=\"https://tc39.github.io/ecma262/#sec-ordinary-object-internal-methods-and-internal-slots\"><code>[[Prototype]]</code></a> of objects are compared using\nthe <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Strict_equality\"><code>===</code> operator</a>.</li>\n<li>Only <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Enumerability_and_ownership_of_properties\">enumerable \"own\" properties</a> are considered.</li>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error\"><code>&#x3C;Error></code></a> names, messages, causes, and errors are always compared,\neven if these are not enumerable properties. <code>errors</code> is also compared.</li>\n<li>Enumerable own <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#symbol_type\"><code>&#x3C;Symbol></code></a> properties are compared as well.</li>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Data_structures#primitive_values\">Object wrappers</a> are compared both as objects and unwrapped values.</li>\n<li><code>Object</code> properties are compared unordered.</li>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map\"><code>&#x3C;Map></code></a> keys and <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set\"><code>&#x3C;Set></code></a> items are compared unordered.</li>\n<li>Recursion stops when both sides differ or either side encounters a circular\nreference.</li>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakMap\"><code>&#x3C;WeakMap></code></a>, <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakSet\"><code>&#x3C;WeakSet></code></a> and <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise\"><code>&#x3C;Promise></code></a> instances are <strong>not</strong> compared\nstructurally. They are only equal if they reference the same object. Any\ncomparison between different <code>WeakMap</code>, <code>WeakSet</code>, or <code>Promise</code> instances\nwill result in inequality, even if they contain the same content.</li>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp\"><code>&#x3C;RegExp></code></a> lastIndex, flags, and source are always compared, even if these\nare not enumerable properties.</li>\n</ul>\n<pre><code class=\"language-mjs\">import assert from 'node:assert/strict';\n\n// This fails because 1 !== '1'.\nassert.deepStrictEqual({ a: 1 }, { a: '1' });\n// AssertionError: Expected inputs to be strictly deep-equal:\n// + actual - expected\n//\n//   {\n// +   a: 1\n// -   a: '1'\n//   }\n\n// The following objects don't have own properties\nconst date = new Date();\nconst object = {};\nconst fakeDate = {};\nObject.setPrototypeOf(fakeDate, Date.prototype);\n\n// Different [[Prototype]]:\nassert.deepStrictEqual(object, fakeDate);\n// AssertionError: Expected inputs to be strictly deep-equal:\n// + actual - expected\n//\n// + {}\n// - Date {}\n\n// Different type tags:\nassert.deepStrictEqual(date, fakeDate);\n// AssertionError: Expected inputs to be strictly deep-equal:\n// + actual - expected\n//\n// + 2018-04-26T00:49:08.604Z\n// - Date {}\n\nassert.deepStrictEqual(NaN, NaN);\n// OK because Object.is(NaN, NaN) is true.\n\n// Different unwrapped numbers:\nassert.deepStrictEqual(new Number(1), new Number(2));\n// AssertionError: Expected inputs to be strictly deep-equal:\n// + actual - expected\n//\n// + [Number: 1]\n// - [Number: 2]\n\nassert.deepStrictEqual(new String('foo'), Object('foo'));\n// OK because the object and the string are identical when unwrapped.\n\nassert.deepStrictEqual(-0, -0);\n// OK\n\n// Different zeros:\nassert.deepStrictEqual(0, -0);\n// AssertionError: Expected inputs to be strictly deep-equal:\n// + actual - expected\n//\n// + 0\n// - -0\n\nconst symbol1 = Symbol();\nconst symbol2 = Symbol();\nassert.deepStrictEqual({ [symbol1]: 1 }, { [symbol1]: 1 });\n// OK, because it is the same symbol on both objects.\n\nassert.deepStrictEqual({ [symbol1]: 1 }, { [symbol2]: 1 });\n// AssertionError [ERR_ASSERTION]: Inputs identical but not reference equal:\n//\n// {\n//   Symbol(): 1\n// }\n\nconst weakMap1 = new WeakMap();\nconst weakMap2 = new WeakMap();\nconst obj = {};\n\nweakMap1.set(obj, 'value');\nweakMap2.set(obj, 'value');\n\n// Comparing different instances fails, even with same contents\nassert.deepStrictEqual(weakMap1, weakMap2);\n// AssertionError: Values have same structure but are not reference-equal:\n//\n// WeakMap {\n//   &#x3C;items unknown>\n// }\n\n// Comparing the same instance to itself succeeds\nassert.deepStrictEqual(weakMap1, weakMap1);\n// OK\n\nconst weakSet1 = new WeakSet();\nconst weakSet2 = new WeakSet();\nweakSet1.add(obj);\nweakSet2.add(obj);\n\n// Comparing different instances fails, even with same contents\nassert.deepStrictEqual(weakSet1, weakSet2);\n// AssertionError: Values have same structure but are not reference-equal:\n// + actual - expected\n//\n// WeakSet {\n//   &#x3C;items unknown>\n// }\n\n// Comparing the same instance to itself succeeds\nassert.deepStrictEqual(weakSet1, weakSet1);\n// OK\n</code></pre>\n<pre><code class=\"language-cjs\">const assert = require('node:assert/strict');\n\n// This fails because 1 !== '1'.\nassert.deepStrictEqual({ a: 1 }, { a: '1' });\n// AssertionError: Expected inputs to be strictly deep-equal:\n// + actual - expected\n//\n//   {\n// +   a: 1\n// -   a: '1'\n//   }\n\n// The following objects don't have own properties\nconst date = new Date();\nconst object = {};\nconst fakeDate = {};\nObject.setPrototypeOf(fakeDate, Date.prototype);\n\n// Different [[Prototype]]:\nassert.deepStrictEqual(object, fakeDate);\n// AssertionError: Expected inputs to be strictly deep-equal:\n// + actual - expected\n//\n// + {}\n// - Date {}\n\n// Different type tags:\nassert.deepStrictEqual(date, fakeDate);\n// AssertionError: Expected inputs to be strictly deep-equal:\n// + actual - expected\n//\n// + 2018-04-26T00:49:08.604Z\n// - Date {}\n\nassert.deepStrictEqual(NaN, NaN);\n// OK because Object.is(NaN, NaN) is true.\n\n// Different unwrapped numbers:\nassert.deepStrictEqual(new Number(1), new Number(2));\n// AssertionError: Expected inputs to be strictly deep-equal:\n// + actual - expected\n//\n// + [Number: 1]\n// - [Number: 2]\n\nassert.deepStrictEqual(new String('foo'), Object('foo'));\n// OK because the object and the string are identical when unwrapped.\n\nassert.deepStrictEqual(-0, -0);\n// OK\n\n// Different zeros:\nassert.deepStrictEqual(0, -0);\n// AssertionError: Expected inputs to be strictly deep-equal:\n// + actual - expected\n//\n// + 0\n// - -0\n\nconst symbol1 = Symbol();\nconst symbol2 = Symbol();\nassert.deepStrictEqual({ [symbol1]: 1 }, { [symbol1]: 1 });\n// OK, because it is the same symbol on both objects.\n\nassert.deepStrictEqual({ [symbol1]: 1 }, { [symbol2]: 1 });\n// AssertionError [ERR_ASSERTION]: Inputs identical but not reference equal:\n//\n// {\n//   Symbol(): 1\n// }\n\nconst weakMap1 = new WeakMap();\nconst weakMap2 = new WeakMap();\nconst obj = {};\n\nweakMap1.set(obj, 'value');\nweakMap2.set(obj, 'value');\n\n// Comparing different instances fails, even with same contents\nassert.deepStrictEqual(weakMap1, weakMap2);\n// AssertionError: Values have same structure but are not reference-equal:\n//\n// WeakMap {\n//   &#x3C;items unknown>\n// }\n\n// Comparing the same instance to itself succeeds\nassert.deepStrictEqual(weakMap1, weakMap1);\n// OK\n\nconst weakSet1 = new WeakSet();\nconst weakSet2 = new WeakSet();\nweakSet1.add(obj);\nweakSet2.add(obj);\n\n// Comparing different instances fails, even with same contents\nassert.deepStrictEqual(weakSet1, weakSet2);\n// AssertionError: Values have same structure but are not reference-equal:\n// + actual - expected\n//\n// WeakSet {\n//   &#x3C;items unknown>\n// }\n\n// Comparing the same instance to itself succeeds\nassert.deepStrictEqual(weakSet1, weakSet1);\n// OK\n</code></pre>\n<p>If the values are not equal, an <a href=\"#class-assertassertionerror\"><code>AssertionError</code></a> is thrown with a <code>message</code>\nproperty set equal to the value of the <code>message</code> parameter. If the <code>message</code>\nparameter is undefined, a default error message is assigned. If the <code>message</code> parameter is an instance of <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error\"><code>&#x3C;Error></code></a> then it will be thrown instead of the <code>AssertionError</code>.</p>",
              "displayName": "Comparison details"
            }
          ]
        },
        {
          "textRaw": "`assert.doesNotMatch(string, regexp[, message])`",
          "name": "doesNotMatch",
          "type": "method",
          "meta": {
            "added": [
              "v13.6.0",
              "v12.16.0"
            ],
            "changes": [
              {
                "version": "v26.0.0",
                "pr-url": "https://github.com/nodejs/node/pull/58849",
                "description": "Message may now be a `printf`-like format string or function."
              },
              {
                "version": "v16.0.0",
                "pr-url": "https://github.com/nodejs/node/pull/38111",
                "description": "This API is no longer experimental."
              }
            ]
          },
          "signatures": [
            {
              "params": [
                {
                  "textRaw": "`string` {string}",
                  "name": "string",
                  "type": "string"
                },
                {
                  "textRaw": "`regexp` {RegExp}",
                  "name": "regexp",
                  "type": "RegExp"
                },
                {
                  "textRaw": "`message` {string|Error|Function}",
                  "name": "message",
                  "type": "string|Error|Function",
                  "optional": true
                }
              ]
            }
          ],
          "desc": "<p>Expects the <code>string</code> input not to match the regular expression.</p>\n<pre><code class=\"language-mjs\">import assert from 'node:assert/strict';\n\nassert.doesNotMatch('I will fail', /fail/);\n// AssertionError [ERR_ASSERTION]: The input was expected to not match the ...\n\nassert.doesNotMatch(123, /pass/);\n// AssertionError [ERR_ASSERTION]: The \"string\" argument must be of type string.\n\nassert.doesNotMatch('I will pass', /different/);\n// OK\n</code></pre>\n<pre><code class=\"language-cjs\">const assert = require('node:assert/strict');\n\nassert.doesNotMatch('I will fail', /fail/);\n// AssertionError [ERR_ASSERTION]: The input was expected to not match the ...\n\nassert.doesNotMatch(123, /pass/);\n// AssertionError [ERR_ASSERTION]: The \"string\" argument must be of type string.\n\nassert.doesNotMatch('I will pass', /different/);\n// OK\n</code></pre>\n<p>If the values do match, or if the <code>string</code> argument is of another type than\n<code>string</code>, an <a href=\"#class-assertassertionerror\"><code>AssertionError</code></a> is thrown with a <code>message</code> property set equal\nto the value of the <code>message</code> parameter. If the <code>message</code> parameter is\nundefined, a default error message is assigned. If the <code>message</code> parameter is an\ninstance of <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error\"><code>&#x3C;Error></code></a> then it will be thrown instead of the <a href=\"#class-assertassertionerror\"><code>AssertionError</code></a>.</p>"
        },
        {
          "textRaw": "`assert.doesNotReject(asyncFn[, error][, message])`",
          "name": "doesNotReject",
          "type": "method",
          "meta": {
            "added": [
              "v10.0.0"
            ],
            "changes": []
          },
          "signatures": [
            {
              "params": [
                {
                  "textRaw": "`asyncFn` {Function|Promise}",
                  "name": "asyncFn",
                  "type": "Function|Promise"
                },
                {
                  "textRaw": "`error` {RegExp|Function}",
                  "name": "error",
                  "type": "RegExp|Function",
                  "optional": true
                },
                {
                  "textRaw": "`message` {string}",
                  "name": "message",
                  "type": "string",
                  "optional": true
                }
              ],
              "return": {
                "textRaw": "Returns: {Promise}",
                "name": "return",
                "type": "Promise"
              }
            }
          ],
          "desc": "<p>Awaits the <code>asyncFn</code> promise or, if <code>asyncFn</code> is a function, immediately\ncalls the function and awaits the returned promise to complete. It will then\ncheck that the promise is not rejected.</p>\n<p>If <code>asyncFn</code> is a function and it throws an error synchronously,\n<code>assert.doesNotReject()</code> will return a rejected <code>Promise</code> with that error. If\nthe function does not return a promise, <code>assert.doesNotReject()</code> will return a\nrejected <code>Promise</code> with an <a href=\"errors.html#err_invalid_return_value\"><code>ERR_INVALID_RETURN_VALUE</code></a> error. In both cases\nthe error handler is skipped.</p>\n<p>Using <code>assert.doesNotReject()</code> is actually not useful because there is little\nbenefit in catching a rejection and then rejecting it again. Instead, consider\nadding a comment next to the specific code path that should not reject and keep\nerror messages as expressive as possible.</p>\n<p>If specified, <code>error</code> can be a <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes\"><code>Class</code></a>, <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp\"><code>&#x3C;RegExp></code></a> or a validation\nfunction. See <a href=\"#assertthrowsfn-error-message\"><code>assert.throws()</code></a> for more details.</p>\n<p>Besides the async nature to await the completion behaves identically to\n<a href=\"#assertdoesnotthrowfn-error-message\"><code>assert.doesNotThrow()</code></a>.</p>\n<pre><code class=\"language-mjs\">import assert from 'node:assert/strict';\n\nawait assert.doesNotReject(\n  async () => {\n    throw new TypeError('Wrong value');\n  },\n  SyntaxError,\n);\n</code></pre>\n<pre><code class=\"language-cjs\">const assert = require('node:assert/strict');\n\n(async () => {\n  await assert.doesNotReject(\n    async () => {\n      throw new TypeError('Wrong value');\n    },\n    SyntaxError,\n  );\n})();\n</code></pre>\n<pre><code class=\"language-mjs\">import assert from 'node:assert/strict';\n\nassert.doesNotReject(Promise.reject(new TypeError('Wrong value')))\n  .then(() => {\n    // ...\n  });\n</code></pre>\n<pre><code class=\"language-cjs\">const assert = require('node:assert/strict');\n\nassert.doesNotReject(Promise.reject(new TypeError('Wrong value')))\n  .then(() => {\n    // ...\n  });\n</code></pre>"
        },
        {
          "textRaw": "`assert.doesNotThrow(fn[, error][, message])`",
          "name": "doesNotThrow",
          "type": "method",
          "meta": {
            "added": [
              "v0.1.21"
            ],
            "changes": [
              {
                "version": [
                  "v5.11.0",
                  "v4.4.5"
                ],
                "pr-url": "https://github.com/nodejs/node/pull/2407",
                "description": "The `message` parameter is respected now."
              },
              {
                "version": "v4.2.0",
                "pr-url": "https://github.com/nodejs/node/pull/3276",
                "description": "The `error` parameter can now be an arrow function."
              }
            ]
          },
          "signatures": [
            {
              "params": [
                {
                  "textRaw": "`fn` {Function}",
                  "name": "fn",
                  "type": "Function"
                },
                {
                  "textRaw": "`error` {RegExp|Function}",
                  "name": "error",
                  "type": "RegExp|Function",
                  "optional": true
                },
                {
                  "textRaw": "`message` {string}",
                  "name": "message",
                  "type": "string",
                  "optional": true
                }
              ]
            }
          ],
          "desc": "<p>Asserts that the function <code>fn</code> does not throw an error.</p>\n<p>Using <code>assert.doesNotThrow()</code> is actually not useful because there\nis no benefit in catching an error and then rethrowing it. Instead, consider\nadding a comment next to the specific code path that should not throw and keep\nerror messages as expressive as possible.</p>\n<p>When <code>assert.doesNotThrow()</code> is called, it will immediately call the <code>fn</code>\nfunction.</p>\n<p>If an error is thrown and it is the same type as that specified by the <code>error</code>\nparameter, then an <a href=\"#class-assertassertionerror\"><code>AssertionError</code></a> is thrown. If the error is of a\ndifferent type, or if the <code>error</code> parameter is undefined, the error is\npropagated back to the caller.</p>\n<p>If specified, <code>error</code> can be a <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes\"><code>Class</code></a>, <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp\"><code>&#x3C;RegExp></code></a>, or a validation\nfunction. See <a href=\"#assertthrowsfn-error-message\"><code>assert.throws()</code></a> for more details.</p>\n<p>The following, for instance, will throw the <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypeError\"><code>&#x3C;TypeError></code></a> because there is no\nmatching error type in the assertion:</p>\n<pre><code class=\"language-mjs\">import assert from 'node:assert/strict';\n\nassert.doesNotThrow(\n  () => {\n    throw new TypeError('Wrong value');\n  },\n  SyntaxError,\n);\n</code></pre>\n<pre><code class=\"language-cjs\">const assert = require('node:assert/strict');\n\nassert.doesNotThrow(\n  () => {\n    throw new TypeError('Wrong value');\n  },\n  SyntaxError,\n);\n</code></pre>\n<p>However, the following will result in an <a href=\"#class-assertassertionerror\"><code>AssertionError</code></a> with the message\n'Got unwanted exception...':</p>\n<pre><code class=\"language-mjs\">import assert from 'node:assert/strict';\n\nassert.doesNotThrow(\n  () => {\n    throw new TypeError('Wrong value');\n  },\n  TypeError,\n);\n</code></pre>\n<pre><code class=\"language-cjs\">const assert = require('node:assert/strict');\n\nassert.doesNotThrow(\n  () => {\n    throw new TypeError('Wrong value');\n  },\n  TypeError,\n);\n</code></pre>\n<p>If an <a href=\"#class-assertassertionerror\"><code>AssertionError</code></a> is thrown and a value is provided for the <code>message</code>\nparameter, the value of <code>message</code> will be appended to the <a href=\"#class-assertassertionerror\"><code>AssertionError</code></a>\nmessage:</p>\n<pre><code class=\"language-mjs\">import assert from 'node:assert/strict';\n\nassert.doesNotThrow(\n  () => {\n    throw new TypeError('Wrong value');\n  },\n  /Wrong value/,\n  'Whoops',\n);\n// Throws: AssertionError: Got unwanted exception: Whoops\n</code></pre>\n<pre><code class=\"language-cjs\">const assert = require('node:assert/strict');\n\nassert.doesNotThrow(\n  () => {\n    throw new TypeError('Wrong value');\n  },\n  /Wrong value/,\n  'Whoops',\n);\n// Throws: AssertionError: Got unwanted exception: Whoops\n</code></pre>"
        },
        {
          "textRaw": "`assert.equal(actual, expected[, message])`",
          "name": "equal",
          "type": "method",
          "meta": {
            "added": [
              "v0.1.21"
            ],
            "changes": [
              {
                "version": "v26.0.0",
                "pr-url": "https://github.com/nodejs/node/pull/58849",
                "description": "Message may now be a `printf`-like format string or function."
              },
              {
                "version": [
                  "v16.0.0",
                  "v14.18.0"
                ],
                "pr-url": "https://github.com/nodejs/node/pull/38113",
                "description": "In Legacy assertion mode, changed status from Deprecated to Legacy."
              },
              {
                "version": "v14.0.0",
                "pr-url": "https://github.com/nodejs/node/pull/30766",
                "description": "NaN is now treated as being identical if both sides are NaN."
              }
            ]
          },
          "stability": 3,
          "stabilityText": "Legacy: Use `assert.strictEqual()` instead.",
          "signatures": [
            {
              "params": [
                {
                  "textRaw": "`actual` {any}",
                  "name": "actual",
                  "type": "any"
                },
                {
                  "textRaw": "`expected` {any}",
                  "name": "expected",
                  "type": "any"
                },
                {
                  "textRaw": "`message` {string|Error|Function}",
                  "name": "message",
                  "type": "string|Error|Function",
                  "optional": true
                }
              ]
            }
          ],
          "desc": "<p><strong>Strict assertion mode</strong></p>\n<p>An alias of <a href=\"#assertstrictequalactual-expected-message\"><code>assert.strictEqual()</code></a>.</p>\n<p><strong>Legacy assertion mode</strong></p>\n<p>Tests shallow, coercive equality between the <code>actual</code> and <code>expected</code> parameters\nusing the <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Equality\"><code>==</code> operator</a>. <code>NaN</code> is specially handled\nand treated as being identical if both sides are <code>NaN</code>.</p>\n<pre><code class=\"language-mjs\">import assert from 'node:assert';\n\nassert.equal(1, 1);\n// OK, 1 == 1\nassert.equal(1, '1');\n// OK, 1 == '1'\nassert.equal(NaN, NaN);\n// OK\n\nassert.equal(1, 2);\n// AssertionError: 1 == 2\nassert.equal({ a: { b: 1 } }, { a: { b: 1 } });\n// AssertionError: { a: { b: 1 } } == { a: { b: 1 } }\n</code></pre>\n<pre><code class=\"language-cjs\">const assert = require('node:assert');\n\nassert.equal(1, 1);\n// OK, 1 == 1\nassert.equal(1, '1');\n// OK, 1 == '1'\nassert.equal(NaN, NaN);\n// OK\n\nassert.equal(1, 2);\n// AssertionError: 1 == 2\nassert.equal({ a: { b: 1 } }, { a: { b: 1 } });\n// AssertionError: { a: { b: 1 } } == { a: { b: 1 } }\n</code></pre>\n<p>If the values are not equal, an <a href=\"#class-assertassertionerror\"><code>AssertionError</code></a> is thrown with a <code>message</code>\nproperty set equal to the value of the <code>message</code> parameter. If the <code>message</code>\nparameter is undefined, a default error message is assigned. If the <code>message</code> parameter is an instance of <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error\"><code>&#x3C;Error></code></a> then it will be thrown instead of the <code>AssertionError</code>.</p>"
        },
        {
          "textRaw": "`assert.fail([message])`",
          "name": "fail",
          "type": "method",
          "meta": {
            "added": [
              "v0.1.21"
            ],
            "changes": []
          },
          "signatures": [
            {
              "params": [
                {
                  "textRaw": "`message` {string|Error} **Default:** `'Failed'`",
                  "name": "message",
                  "type": "string|Error",
                  "default": "`'Failed'`",
                  "optional": true
                }
              ]
            }
          ],
          "desc": "<p>Throws an <a href=\"#class-assertassertionerror\"><code>AssertionError</code></a> with the provided error message or a default\nerror message. If the <code>message</code> parameter is an instance of <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error\"><code>&#x3C;Error></code></a> then\nit will be thrown instead of the <a href=\"#class-assertassertionerror\"><code>AssertionError</code></a>.</p>\n<pre><code class=\"language-mjs\">import assert from 'node:assert/strict';\n\nassert.fail();\n// AssertionError [ERR_ASSERTION]: Failed\n\nassert.fail('boom');\n// AssertionError [ERR_ASSERTION]: boom\n\nassert.fail(new TypeError('need array'));\n// TypeError: need array\n</code></pre>\n<pre><code class=\"language-cjs\">const assert = require('node:assert/strict');\n\nassert.fail();\n// AssertionError [ERR_ASSERTION]: Failed\n\nassert.fail('boom');\n// AssertionError [ERR_ASSERTION]: boom\n\nassert.fail(new TypeError('need array'));\n// TypeError: need array\n</code></pre>"
        },
        {
          "textRaw": "`assert.ifError(value)`",
          "name": "ifError",
          "type": "method",
          "meta": {
            "added": [
              "v0.1.97"
            ],
            "changes": [
              {
                "version": "v10.0.0",
                "pr-url": "https://github.com/nodejs/node/pull/18247",
                "description": "Instead of throwing the original error it is now wrapped into an [`AssertionError`][] that contains the full stack trace."
              },
              {
                "version": "v10.0.0",
                "pr-url": "https://github.com/nodejs/node/pull/18247",
                "description": "Value may now only be `undefined` or `null`. Before all falsy values were handled the same as `null` and did not throw."
              }
            ]
          },
          "signatures": [
            {
              "params": [
                {
                  "textRaw": "`value` {any}",
                  "name": "value",
                  "type": "any"
                }
              ]
            }
          ],
          "desc": "<p>Throws <code>value</code> if <code>value</code> is not <code>undefined</code> or <code>null</code>. This is useful when\ntesting the <code>error</code> argument in callbacks. The stack trace contains all frames\nfrom the error passed to <code>ifError()</code> including the potential new frames for\n<code>ifError()</code> itself.</p>\n<pre><code class=\"language-mjs\">import assert from 'node:assert/strict';\n\nassert.ifError(null);\n// OK\nassert.ifError(0);\n// AssertionError [ERR_ASSERTION]: ifError got unwanted exception: 0\nassert.ifError('error');\n// AssertionError [ERR_ASSERTION]: ifError got unwanted exception: 'error'\nassert.ifError(new Error());\n// AssertionError [ERR_ASSERTION]: ifError got unwanted exception: Error\n\n// Create some random error frames.\nlet err;\n(function errorFrame() {\n  err = new Error('test error');\n})();\n\n(function ifErrorFrame() {\n  assert.ifError(err);\n})();\n// AssertionError [ERR_ASSERTION]: ifError got unwanted exception: test error\n//     at ifErrorFrame\n//     at errorFrame\n</code></pre>\n<pre><code class=\"language-cjs\">const assert = require('node:assert/strict');\n\nassert.ifError(null);\n// OK\nassert.ifError(0);\n// AssertionError [ERR_ASSERTION]: ifError got unwanted exception: 0\nassert.ifError('error');\n// AssertionError [ERR_ASSERTION]: ifError got unwanted exception: 'error'\nassert.ifError(new Error());\n// AssertionError [ERR_ASSERTION]: ifError got unwanted exception: Error\n\n// Create some random error frames.\nlet err;\n(function errorFrame() {\n  err = new Error('test error');\n})();\n\n(function ifErrorFrame() {\n  assert.ifError(err);\n})();\n// AssertionError [ERR_ASSERTION]: ifError got unwanted exception: test error\n//     at ifErrorFrame\n//     at errorFrame\n</code></pre>"
        },
        {
          "textRaw": "`assert.match(string, regexp[, message])`",
          "name": "match",
          "type": "method",
          "meta": {
            "added": [
              "v13.6.0",
              "v12.16.0"
            ],
            "changes": [
              {
                "version": "v26.0.0",
                "pr-url": "https://github.com/nodejs/node/pull/58849",
                "description": "Message may now be a `printf`-like format string or function."
              },
              {
                "version": "v16.0.0",
                "pr-url": "https://github.com/nodejs/node/pull/38111",
                "description": "This API is no longer experimental."
              }
            ]
          },
          "signatures": [
            {
              "params": [
                {
                  "textRaw": "`string` {string}",
                  "name": "string",
                  "type": "string"
                },
                {
                  "textRaw": "`regexp` {RegExp}",
                  "name": "regexp",
                  "type": "RegExp"
                },
                {
                  "textRaw": "`message` {string|Error|Function}",
                  "name": "message",
                  "type": "string|Error|Function",
                  "optional": true
                }
              ]
            }
          ],
          "desc": "<p>Expects the <code>string</code> input to match the regular expression.</p>\n<pre><code class=\"language-mjs\">import assert from 'node:assert/strict';\n\nassert.match('I will fail', /pass/);\n// AssertionError [ERR_ASSERTION]: The input did not match the regular ...\n\nassert.match(123, /pass/);\n// AssertionError [ERR_ASSERTION]: The \"string\" argument must be of type string.\n\nassert.match('I will pass', /pass/);\n// OK\n</code></pre>\n<pre><code class=\"language-cjs\">const assert = require('node:assert/strict');\n\nassert.match('I will fail', /pass/);\n// AssertionError [ERR_ASSERTION]: The input did not match the regular ...\n\nassert.match(123, /pass/);\n// AssertionError [ERR_ASSERTION]: The \"string\" argument must be of type string.\n\nassert.match('I will pass', /pass/);\n// OK\n</code></pre>\n<p>If the values do not match, or if the <code>string</code> argument is of another type than\n<code>string</code>, an <a href=\"#class-assertassertionerror\"><code>AssertionError</code></a> is thrown with a <code>message</code> property set equal\nto the value of the <code>message</code> parameter. If the <code>message</code> parameter is\nundefined, a default error message is assigned. If the <code>message</code> parameter is an\ninstance of <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error\"><code>&#x3C;Error></code></a> then it will be thrown instead of the <a href=\"#class-assertassertionerror\"><code>AssertionError</code></a>.</p>"
        },
        {
          "textRaw": "`assert.notDeepEqual(actual, expected[, message])`",
          "name": "notDeepEqual",
          "type": "method",
          "meta": {
            "added": [
              "v0.1.21"
            ],
            "changes": [
              {
                "version": "v26.0.0",
                "pr-url": "https://github.com/nodejs/node/pull/58849",
                "description": "Message may now be a `printf`-like format string or function."
              },
              {
                "version": [
                  "v16.0.0",
                  "v14.18.0"
                ],
                "pr-url": "https://github.com/nodejs/node/pull/38113",
                "description": "In Legacy assertion mode, changed status from Deprecated to Legacy."
              },
              {
                "version": "v14.0.0",
                "pr-url": "https://github.com/nodejs/node/pull/30766",
                "description": "NaN is now treated as being identical if both sides are NaN."
              },
              {
                "version": "v9.0.0",
                "pr-url": "https://github.com/nodejs/node/pull/15001",
                "description": "The `Error` names and messages are now properly compared."
              },
              {
                "version": "v8.0.0",
                "pr-url": "https://github.com/nodejs/node/pull/12142",
                "description": "The `Set` and `Map` content is also compared."
              },
              {
                "version": [
                  "v6.4.0",
                  "v4.7.1"
                ],
                "pr-url": "https://github.com/nodejs/node/pull/8002",
                "description": "Typed array slices are handled correctly now."
              },
              {
                "version": [
                  "v6.1.0",
                  "v4.5.0"
                ],
                "pr-url": "https://github.com/nodejs/node/pull/6432",
                "description": "Objects with circular references can be used as inputs now."
              },
              {
                "version": [
                  "v5.10.1",
                  "v4.4.3"
                ],
                "pr-url": "https://github.com/nodejs/node/pull/5910",
                "description": "Handle non-`Uint8Array` typed arrays correctly."
              }
            ]
          },
          "stability": 3,
          "stabilityText": "Legacy: Use `assert.notDeepStrictEqual()` instead.",
          "signatures": [
            {
              "params": [
                {
                  "textRaw": "`actual` {any}",
                  "name": "actual",
                  "type": "any"
                },
                {
                  "textRaw": "`expected` {any}",
                  "name": "expected",
                  "type": "any"
                },
                {
                  "textRaw": "`message` {string|Error|Function}",
                  "name": "message",
                  "type": "string|Error|Function",
                  "optional": true
                }
              ]
            }
          ],
          "desc": "<p><strong>Strict assertion mode</strong></p>\n<p>An alias of <a href=\"#assertnotdeepstrictequalactual-expected-message\"><code>assert.notDeepStrictEqual()</code></a>.</p>\n<p><strong>Legacy assertion mode</strong></p>\n<p>Tests for any deep inequality. Opposite of <a href=\"#assertdeepequalactual-expected-message\"><code>assert.deepEqual()</code></a>.</p>\n<pre><code class=\"language-mjs\">import assert from 'node:assert';\n\nconst obj1 = {\n  a: {\n    b: 1,\n  },\n};\nconst obj2 = {\n  a: {\n    b: 2,\n  },\n};\nconst obj3 = {\n  a: {\n    b: 1,\n  },\n};\nconst obj4 = { __proto__: obj1 };\n\nassert.notDeepEqual(obj1, obj1);\n// AssertionError: { a: { b: 1 } } notDeepEqual { a: { b: 1 } }\n\nassert.notDeepEqual(obj1, obj2);\n// OK\n\nassert.notDeepEqual(obj1, obj3);\n// AssertionError: { a: { b: 1 } } notDeepEqual { a: { b: 1 } }\n\nassert.notDeepEqual(obj1, obj4);\n// OK\n</code></pre>\n<pre><code class=\"language-cjs\">const assert = require('node:assert');\n\nconst obj1 = {\n  a: {\n    b: 1,\n  },\n};\nconst obj2 = {\n  a: {\n    b: 2,\n  },\n};\nconst obj3 = {\n  a: {\n    b: 1,\n  },\n};\nconst obj4 = { __proto__: obj1 };\n\nassert.notDeepEqual(obj1, obj1);\n// AssertionError: { a: { b: 1 } } notDeepEqual { a: { b: 1 } }\n\nassert.notDeepEqual(obj1, obj2);\n// OK\n\nassert.notDeepEqual(obj1, obj3);\n// AssertionError: { a: { b: 1 } } notDeepEqual { a: { b: 1 } }\n\nassert.notDeepEqual(obj1, obj4);\n// OK\n</code></pre>\n<p>If the values are deeply equal, an <a href=\"#class-assertassertionerror\"><code>AssertionError</code></a> is thrown with a\n<code>message</code> property set equal to the value of the <code>message</code> parameter. If the\n<code>message</code> parameter is undefined, a default error message is assigned. If the\n<code>message</code> parameter is an instance of <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error\"><code>&#x3C;Error></code></a> then it will be thrown\ninstead of the <code>AssertionError</code>.</p>"
        },
        {
          "textRaw": "`assert.notDeepStrictEqual(actual, expected[, message])`",
          "name": "notDeepStrictEqual",
          "type": "method",
          "meta": {
            "added": [
              "v1.2.0"
            ],
            "changes": [
              {
                "version": "v26.0.0",
                "pr-url": "https://github.com/nodejs/node/pull/58849",
                "description": "Message may now be a `printf`-like format string or function."
              },
              {
                "version": "v9.0.0",
                "pr-url": "https://github.com/nodejs/node/pull/15398",
                "description": "The `-0` and `+0` are not considered equal anymore."
              },
              {
                "version": "v9.0.0",
                "pr-url": "https://github.com/nodejs/node/pull/15036",
                "description": "The `NaN` is now compared using the [SameValueZero](https://tc39.github.io/ecma262/#sec-samevaluezero) comparison."
              },
              {
                "version": "v9.0.0",
                "pr-url": "https://github.com/nodejs/node/pull/15001",
                "description": "The `Error` names and messages are now properly compared."
              },
              {
                "version": "v8.0.0",
                "pr-url": "https://github.com/nodejs/node/pull/12142",
                "description": "The `Set` and `Map` content is also compared."
              },
              {
                "version": [
                  "v6.4.0",
                  "v4.7.1"
                ],
                "pr-url": "https://github.com/nodejs/node/pull/8002",
                "description": "Typed array slices are handled correctly now."
              },
              {
                "version": "v6.1.0",
                "pr-url": "https://github.com/nodejs/node/pull/6432",
                "description": "Objects with circular references can be used as inputs now."
              },
              {
                "version": [
                  "v5.10.1",
                  "v4.4.3"
                ],
                "pr-url": "https://github.com/nodejs/node/pull/5910",
                "description": "Handle non-`Uint8Array` typed arrays correctly."
              }
            ]
          },
          "signatures": [
            {
              "params": [
                {
                  "textRaw": "`actual` {any}",
                  "name": "actual",
                  "type": "any"
                },
                {
                  "textRaw": "`expected` {any}",
                  "name": "expected",
                  "type": "any"
                },
                {
                  "textRaw": "`message` {string|Error|Function}",
                  "name": "message",
                  "type": "string|Error|Function",
                  "optional": true
                }
              ]
            }
          ],
          "desc": "<p>Tests for deep strict inequality. Opposite of <a href=\"#assertdeepstrictequalactual-expected-message\"><code>assert.deepStrictEqual()</code></a>.</p>\n<pre><code class=\"language-mjs\">import assert from 'node:assert/strict';\n\nassert.notDeepStrictEqual({ a: 1 }, { a: '1' });\n// OK\n</code></pre>\n<pre><code class=\"language-cjs\">const assert = require('node:assert/strict');\n\nassert.notDeepStrictEqual({ a: 1 }, { a: '1' });\n// OK\n</code></pre>\n<p>If the values are deeply and strictly equal, an <a href=\"#class-assertassertionerror\"><code>AssertionError</code></a> is thrown\nwith a <code>message</code> property set equal to the value of the <code>message</code> parameter. If\nthe <code>message</code> parameter is undefined, a default error message is assigned. If\nthe <code>message</code> parameter is an instance of <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error\"><code>&#x3C;Error></code></a> then it will be thrown\ninstead of the <a href=\"#class-assertassertionerror\"><code>AssertionError</code></a>.</p>"
        },
        {
          "textRaw": "`assert.notEqual(actual, expected[, message])`",
          "name": "notEqual",
          "type": "method",
          "meta": {
            "added": [
              "v0.1.21"
            ],
            "changes": [
              {
                "version": "v26.0.0",
                "pr-url": "https://github.com/nodejs/node/pull/58849",
                "description": "Message may now be a `printf`-like format string or function."
              },
              {
                "version": [
                  "v16.0.0",
                  "v14.18.0"
                ],
                "pr-url": "https://github.com/nodejs/node/pull/38113",
                "description": "In Legacy assertion mode, changed status from Deprecated to Legacy."
              },
              {
                "version": "v14.0.0",
                "pr-url": "https://github.com/nodejs/node/pull/30766",
                "description": "NaN is now treated as being identical if both sides are NaN."
              }
            ]
          },
          "stability": 3,
          "stabilityText": "Legacy: Use `assert.notStrictEqual()` instead.",
          "signatures": [
            {
              "params": [
                {
                  "textRaw": "`actual` {any}",
                  "name": "actual",
                  "type": "any"
                },
                {
                  "textRaw": "`expected` {any}",
                  "name": "expected",
                  "type": "any"
                },
                {
                  "textRaw": "`message` {string|Error|Function}",
                  "name": "message",
                  "type": "string|Error|Function",
                  "optional": true
                }
              ]
            }
          ],
          "desc": "<p><strong>Strict assertion mode</strong></p>\n<p>An alias of <a href=\"#assertnotstrictequalactual-expected-message\"><code>assert.notStrictEqual()</code></a>.</p>\n<p><strong>Legacy assertion mode</strong></p>\n<p>Tests shallow, coercive inequality with the <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Inequality\"><code>!=</code> operator</a>. <code>NaN</code> is\nspecially handled and treated as being identical if both sides are <code>NaN</code>.</p>\n<pre><code class=\"language-mjs\">import assert from 'node:assert';\n\nassert.notEqual(1, 2);\n// OK\n\nassert.notEqual(1, 1);\n// AssertionError: 1 != 1\n\nassert.notEqual(1, '1');\n// AssertionError: 1 != '1'\n</code></pre>\n<pre><code class=\"language-cjs\">const assert = require('node:assert');\n\nassert.notEqual(1, 2);\n// OK\n\nassert.notEqual(1, 1);\n// AssertionError: 1 != 1\n\nassert.notEqual(1, '1');\n// AssertionError: 1 != '1'\n</code></pre>\n<p>If the values are equal, an <a href=\"#class-assertassertionerror\"><code>AssertionError</code></a> is thrown with a <code>message</code>\nproperty set equal to the value of the <code>message</code> parameter. If the <code>message</code>\nparameter is undefined, a default error message is assigned. If the <code>message</code> parameter is an instance of <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error\"><code>&#x3C;Error></code></a> then it will be thrown instead of the <code>AssertionError</code>.</p>"
        },
        {
          "textRaw": "`assert.notStrictEqual(actual, expected[, message])`",
          "name": "notStrictEqual",
          "type": "method",
          "meta": {
            "added": [
              "v0.1.21"
            ],
            "changes": [
              {
                "version": "v26.0.0",
                "pr-url": "https://github.com/nodejs/node/pull/58849",
                "description": "Message may now be a `printf`-like format string or function."
              },
              {
                "version": "v10.0.0",
                "pr-url": "https://github.com/nodejs/node/pull/17003",
                "description": "Used comparison changed from Strict Equality to `Object.is()`."
              }
            ]
          },
          "signatures": [
            {
              "params": [
                {
                  "textRaw": "`actual` {any}",
                  "name": "actual",
                  "type": "any"
                },
                {
                  "textRaw": "`expected` {any}",
                  "name": "expected",
                  "type": "any"
                },
                {
                  "textRaw": "`message` {string|Error|Function}",
                  "name": "message",
                  "type": "string|Error|Function",
                  "optional": true
                }
              ]
            }
          ],
          "desc": "<p>Tests strict inequality between the <code>actual</code> and <code>expected</code> parameters as\ndetermined by <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is\"><code>Object.is()</code></a>.</p>\n<pre><code class=\"language-mjs\">import assert from 'node:assert/strict';\n\nassert.notStrictEqual(1, 2);\n// OK\n\nassert.notStrictEqual(1, 1);\n// AssertionError [ERR_ASSERTION]: Expected \"actual\" to be strictly unequal to:\n//\n// 1\n\nassert.notStrictEqual(1, '1');\n// OK\n</code></pre>\n<pre><code class=\"language-cjs\">const assert = require('node:assert/strict');\n\nassert.notStrictEqual(1, 2);\n// OK\n\nassert.notStrictEqual(1, 1);\n// AssertionError [ERR_ASSERTION]: Expected \"actual\" to be strictly unequal to:\n//\n// 1\n\nassert.notStrictEqual(1, '1');\n// OK\n</code></pre>\n<p>If the values are strictly equal, an <a href=\"#class-assertassertionerror\"><code>AssertionError</code></a> is thrown with a\n<code>message</code> property set equal to the value of the <code>message</code> parameter. If the\n<code>message</code> parameter is undefined, a default error message is assigned. If the\n<code>message</code> parameter is an instance of <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error\"><code>&#x3C;Error></code></a> then it will be thrown\ninstead of the <code>AssertionError</code>.</p>"
        },
        {
          "textRaw": "`assert.ok(value[, message])`",
          "name": "ok",
          "type": "method",
          "meta": {
            "added": [
              "v0.1.21"
            ],
            "changes": [
              {
                "version": "v26.0.0",
                "pr-url": "https://github.com/nodejs/node/pull/58849",
                "description": "Message may now be a `printf`-like format string or function."
              },
              {
                "version": "v10.0.0",
                "pr-url": "https://github.com/nodejs/node/pull/18319",
                "description": "The `assert.ok()` (no arguments) will now use a predefined error message."
              }
            ]
          },
          "signatures": [
            {
              "params": [
                {
                  "textRaw": "`value` {any}",
                  "name": "value",
                  "type": "any"
                },
                {
                  "textRaw": "`message` {string|Error|Function}",
                  "name": "message",
                  "type": "string|Error|Function",
                  "optional": true
                }
              ]
            }
          ],
          "desc": "<p>Tests if <code>value</code> is truthy. It is equivalent to\n<code>assert.equal(!!value, true, message)</code>.</p>\n<p>If <code>value</code> is not truthy, an <a href=\"#class-assertassertionerror\"><code>AssertionError</code></a> is thrown with a <code>message</code>\nproperty set equal to the value of the <code>message</code> parameter. If the <code>message</code>\nparameter is <code>undefined</code>, a default error message is assigned. If the <code>message</code> parameter is an instance of <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error\"><code>&#x3C;Error></code></a> then it will be thrown instead of the <code>AssertionError</code>.\nIf no arguments are passed in at all <code>message</code> will be set to the string:\n<code>'No value argument passed to `assert.ok()`'</code>.</p>\n<p>Be aware that in the <code>repl</code> the error message will be different to the one\nthrown in a file! See below for further details.</p>\n<pre><code class=\"language-mjs\">import assert from 'node:assert/strict';\n\nassert.ok(true);\n// OK\nassert.ok(1);\n// OK\n\nassert.ok();\n// AssertionError: No value argument passed to `assert.ok()`\n\nassert.ok(false, 'it\\'s false');\n// AssertionError: it's false\n\n// In the repl:\nassert.ok(typeof 123 === 'string');\n// AssertionError: false == true\n\n// In a file (e.g. test.js):\nassert.ok(typeof 123 === 'string');\n// AssertionError: The expression evaluated to a falsy value:\n//\n//   assert.ok(typeof 123 === 'string')\n\nassert.ok(false);\n// AssertionError: The expression evaluated to a falsy value:\n//\n//   assert.ok(false)\n\nassert.ok(0);\n// AssertionError: The expression evaluated to a falsy value:\n//\n//   assert.ok(0)\n</code></pre>\n<pre><code class=\"language-cjs\">const assert = require('node:assert/strict');\n\nassert.ok(true);\n// OK\nassert.ok(1);\n// OK\n\nassert.ok();\n// AssertionError: No value argument passed to `assert.ok()`\n\nassert.ok(false, 'it\\'s false');\n// AssertionError: it's false\n\n// In the repl:\nassert.ok(typeof 123 === 'string');\n// AssertionError: false == true\n\n// In a file (e.g. test.js):\nassert.ok(typeof 123 === 'string');\n// AssertionError: The expression evaluated to a falsy value:\n//\n//   assert.ok(typeof 123 === 'string')\n\nassert.ok(false);\n// AssertionError: The expression evaluated to a falsy value:\n//\n//   assert.ok(false)\n\nassert.ok(0);\n// AssertionError: The expression evaluated to a falsy value:\n//\n//   assert.ok(0)\n</code></pre>\n<pre><code class=\"language-mjs\">import assert from 'node:assert/strict';\n\n// Using `assert()` works the same:\nassert(2 + 2 > 5);\n// AssertionError: The expression evaluated to a falsy value:\n//\n//   assert(2 + 2 > 5)\n</code></pre>\n<pre><code class=\"language-cjs\">const assert = require('node:assert');\n\n// Using `assert()` works the same:\nassert(2 + 2 > 5);\n// AssertionError: The expression evaluated to a falsy value:\n//\n//   assert(2 + 2 > 5)\n</code></pre>"
        },
        {
          "textRaw": "`assert.rejects(asyncFn[, error][, message])`",
          "name": "rejects",
          "type": "method",
          "meta": {
            "added": [
              "v10.0.0"
            ],
            "changes": []
          },
          "signatures": [
            {
              "params": [
                {
                  "textRaw": "`asyncFn` {Function|Promise}",
                  "name": "asyncFn",
                  "type": "Function|Promise"
                },
                {
                  "textRaw": "`error` {RegExp|Function|Object|Error}",
                  "name": "error",
                  "type": "RegExp|Function|Object|Error",
                  "optional": true
                },
                {
                  "textRaw": "`message` {string}",
                  "name": "message",
                  "type": "string",
                  "optional": true
                }
              ],
              "return": {
                "textRaw": "Returns: {Promise}",
                "name": "return",
                "type": "Promise"
              }
            }
          ],
          "desc": "<p>Awaits the <code>asyncFn</code> promise or, if <code>asyncFn</code> is a function, immediately\ncalls the function and awaits the returned promise to complete. It will then\ncheck that the promise is rejected.</p>\n<p>If <code>asyncFn</code> is a function and it throws an error synchronously,\n<code>assert.rejects()</code> will return a rejected <code>Promise</code> with that error. If the\nfunction does not return a promise, <code>assert.rejects()</code> will return a rejected\n<code>Promise</code> with an <a href=\"errors.html#err_invalid_return_value\"><code>ERR_INVALID_RETURN_VALUE</code></a> error. In both cases the error\nhandler is skipped.</p>\n<p>Besides the async nature to await the completion behaves identically to\n<a href=\"#assertthrowsfn-error-message\"><code>assert.throws()</code></a>.</p>\n<p>If specified, <code>error</code> can be a <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes\"><code>Class</code></a>, <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp\"><code>&#x3C;RegExp></code></a>, a validation function,\nan object where each property will be tested for, or an instance of error where\neach property will be tested for including the non-enumerable <code>message</code> and\n<code>name</code> properties.</p>\n<p>If specified, <code>message</code> will be the message provided by the <a href=\"#class-assertassertionerror\"><code>AssertionError</code></a>\nif the <code>asyncFn</code> fails to reject.</p>\n<pre><code class=\"language-mjs\">import assert from 'node:assert/strict';\n\nawait assert.rejects(\n  async () => {\n    throw new TypeError('Wrong value');\n  },\n  {\n    name: 'TypeError',\n    message: 'Wrong value',\n  },\n);\n</code></pre>\n<pre><code class=\"language-cjs\">const assert = require('node:assert/strict');\n\n(async () => {\n  await assert.rejects(\n    async () => {\n      throw new TypeError('Wrong value');\n    },\n    {\n      name: 'TypeError',\n      message: 'Wrong value',\n    },\n  );\n})();\n</code></pre>\n<pre><code class=\"language-mjs\">import assert from 'node:assert/strict';\n\nawait assert.rejects(\n  async () => {\n    throw new TypeError('Wrong value');\n  },\n  (err) => {\n    assert.strictEqual(err.name, 'TypeError');\n    assert.strictEqual(err.message, 'Wrong value');\n    return true;\n  },\n);\n</code></pre>\n<pre><code class=\"language-cjs\">const assert = require('node:assert/strict');\n\n(async () => {\n  await assert.rejects(\n    async () => {\n      throw new TypeError('Wrong value');\n    },\n    (err) => {\n      assert.strictEqual(err.name, 'TypeError');\n      assert.strictEqual(err.message, 'Wrong value');\n      return true;\n    },\n  );\n})();\n</code></pre>\n<pre><code class=\"language-mjs\">import assert from 'node:assert/strict';\n\nassert.rejects(\n  Promise.reject(new Error('Wrong value')),\n  Error,\n).then(() => {\n  // ...\n});\n</code></pre>\n<pre><code class=\"language-cjs\">const assert = require('node:assert/strict');\n\nassert.rejects(\n  Promise.reject(new Error('Wrong value')),\n  Error,\n).then(() => {\n  // ...\n});\n</code></pre>\n<p><code>error</code> cannot be a string. If a string is provided as the second\nargument, then <code>error</code> is assumed to be omitted and the string will be used for\n<code>message</code> instead. This can lead to easy-to-miss mistakes. Please read the\nexample in <a href=\"#assertthrowsfn-error-message\"><code>assert.throws()</code></a> carefully if using a string as the second\nargument gets considered.</p>"
        },
        {
          "textRaw": "`assert.strictEqual(actual, expected[, message])`",
          "name": "strictEqual",
          "type": "method",
          "meta": {
            "added": [
              "v0.1.21"
            ],
            "changes": [
              {
                "version": "v26.0.0",
                "pr-url": "https://github.com/nodejs/node/pull/58849",
                "description": "Message may now be a `printf`-like format string or function."
              },
              {
                "version": "v10.0.0",
                "pr-url": "https://github.com/nodejs/node/pull/17003",
                "description": "Used comparison changed from Strict Equality to `Object.is()`."
              }
            ]
          },
          "signatures": [
            {
              "params": [
                {
                  "textRaw": "`actual` {any}",
                  "name": "actual",
                  "type": "any"
                },
                {
                  "textRaw": "`expected` {any}",
                  "name": "expected",
                  "type": "any"
                },
                {
                  "textRaw": "`message` {string|Error|Function} Postfix `printf`-like arguments in case it's used as format string. If message is a function, it is called in case of a comparison failure. The function receives the `actual` and `expected` arguments and has to return a string that is going to be used as error message. `printf`-like format strings and functions are beneficial for performance reasons in case arguments are passed through. In addition, it allows nice formatting with ease.",
                  "name": "message",
                  "type": "string|Error|Function",
                  "desc": "Postfix `printf`-like arguments in case it's used as format string. If message is a function, it is called in case of a comparison failure. The function receives the `actual` and `expected` arguments and has to return a string that is going to be used as error message. `printf`-like format strings and functions are beneficial for performance reasons in case arguments are passed through. In addition, it allows nice formatting with ease.",
                  "optional": true
                }
              ]
            }
          ],
          "desc": "<p>Tests strict equality between the <code>actual</code> and <code>expected</code> parameters as\ndetermined by <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is\"><code>Object.is()</code></a>.</p>\n<pre><code class=\"language-mjs\">import assert from 'node:assert/strict';\n\nassert.strictEqual(1, 2);\n// AssertionError [ERR_ASSERTION]: Expected inputs to be strictly equal:\n//\n// 1 !== 2\n\nassert.strictEqual(1, 1);\n// OK\n\nassert.strictEqual('Hello foobar', 'Hello World!');\n// AssertionError [ERR_ASSERTION]: Expected inputs to be strictly equal:\n// + actual - expected\n//\n// + 'Hello foobar'\n// - 'Hello World!'\n//          ^\n\nconst apples = 1;\nconst oranges = 2;\nassert.strictEqual(apples, oranges, `apples ${apples} !== oranges ${oranges}`);\n// AssertionError [ERR_ASSERTION]: apples 1 !== oranges 2\n\nassert.strictEqual(apples, oranges, 'apples %s !== oranges %s', apples, oranges);\n// AssertionError [ERR_ASSERTION]: apples 1 !== oranges 2\n\nassert.strictEqual(1, '1', new TypeError('Inputs are not identical'));\n// TypeError: Inputs are not identical\n\nassert.strictEqual(apples, oranges, (actual, expected) => {\n  // Do 'heavy' computations\n  return `I expected ${expected} but I got ${actual}`;\n});\n// AssertionError [ERR_ASSERTION]: I expected oranges but I got apples\n</code></pre>\n<pre><code class=\"language-cjs\">const assert = require('node:assert/strict');\n\nassert.strictEqual(1, 2);\n// AssertionError [ERR_ASSERTION]: Expected inputs to be strictly equal:\n//\n// 1 !== 2\n\nassert.strictEqual(1, 1);\n// OK\n\nassert.strictEqual('Hello foobar', 'Hello World!');\n// AssertionError [ERR_ASSERTION]: Expected inputs to be strictly equal:\n// + actual - expected\n//\n// + 'Hello foobar'\n// - 'Hello World!'\n//          ^\n\nconst apples = 1;\nconst oranges = 2;\nassert.strictEqual(apples, oranges, `apples ${apples} !== oranges ${oranges}`);\n// AssertionError [ERR_ASSERTION]: apples 1 !== oranges 2\n\nassert.strictEqual(apples, oranges, 'apples %s !== oranges %s', apples, oranges);\n// AssertionError [ERR_ASSERTION]: apples 1 !== oranges 2\n\nassert.strictEqual(1, '1', new TypeError('Inputs are not identical'));\n// TypeError: Inputs are not identical\n\nassert.strictEqual(apples, oranges, (actual, expected) => {\n  // Do 'heavy' computations\n  return `I expected ${expected} but I got ${actual}`;\n});\n// AssertionError [ERR_ASSERTION]: I expected oranges but I got apples\n</code></pre>\n<p>If the values are not strictly equal, an <a href=\"#class-assertassertionerror\"><code>AssertionError</code></a> is thrown with a\n<code>message</code> property set equal to the value of the <code>message</code> parameter. If the\n<code>message</code> parameter is undefined, a default error message is assigned. If the\n<code>message</code> parameter is an instance of <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error\"><code>&#x3C;Error></code></a> then it will be thrown\ninstead of the <a href=\"#class-assertassertionerror\"><code>AssertionError</code></a>.</p>"
        },
        {
          "textRaw": "`assert.throws(fn[, error][, message])`",
          "name": "throws",
          "type": "method",
          "meta": {
            "added": [
              "v0.1.21"
            ],
            "changes": [
              {
                "version": "v10.2.0",
                "pr-url": "https://github.com/nodejs/node/pull/20485",
                "description": "The `error` parameter can be an object containing regular expressions now."
              },
              {
                "version": "v9.9.0",
                "pr-url": "https://github.com/nodejs/node/pull/17584",
                "description": "The `error` parameter can now be an object as well."
              },
              {
                "version": "v4.2.0",
                "pr-url": "https://github.com/nodejs/node/pull/3276",
                "description": "The `error` parameter can now be an arrow function."
              }
            ]
          },
          "signatures": [
            {
              "params": [
                {
                  "textRaw": "`fn` {Function}",
                  "name": "fn",
                  "type": "Function"
                },
                {
                  "textRaw": "`error` {RegExp|Function|Object|Error}",
                  "name": "error",
                  "type": "RegExp|Function|Object|Error",
                  "optional": true
                },
                {
                  "textRaw": "`message` {string}",
                  "name": "message",
                  "type": "string",
                  "optional": true
                }
              ]
            }
          ],
          "desc": "<p>Expects the function <code>fn</code> to throw an error.</p>\n<p>If specified, <code>error</code> can be a <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes\"><code>Class</code></a>, <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp\"><code>&#x3C;RegExp></code></a>, a validation function,\na validation object where each property will be tested for strict deep equality,\nor an instance of error where each property will be tested for strict deep\nequality including the non-enumerable <code>message</code> and <code>name</code> properties. When\nusing an object, it is also possible to use a regular expression, when\nvalidating against a string property. See below for examples.</p>\n<p>If specified, <code>message</code> will be appended to the message provided by the\n<code>AssertionError</code> if the <code>fn</code> call fails to throw or in case the error validation\nfails.</p>\n<p>Custom validation object/error instance:</p>\n<pre><code class=\"language-mjs\">import assert from 'node:assert/strict';\n\nconst err = new TypeError('Wrong value');\nerr.code = 404;\nerr.foo = 'bar';\nerr.info = {\n  nested: true,\n  baz: 'text',\n};\nerr.reg = /abc/i;\n\nassert.throws(\n  () => {\n    throw err;\n  },\n  {\n    name: 'TypeError',\n    message: 'Wrong value',\n    info: {\n      nested: true,\n      baz: 'text',\n    },\n    // Only properties on the validation object will be tested for.\n    // Using nested objects requires all properties to be present. Otherwise\n    // the validation is going to fail.\n  },\n);\n\n// Using regular expressions to validate error properties:\nassert.throws(\n  () => {\n    throw err;\n  },\n  {\n    // The `name` and `message` properties are strings and using regular\n    // expressions on those will match against the string. If they fail, an\n    // error is thrown.\n    name: /^TypeError$/,\n    message: /Wrong/,\n    foo: 'bar',\n    info: {\n      nested: true,\n      // It is not possible to use regular expressions for nested properties!\n      baz: 'text',\n    },\n    // The `reg` property contains a regular expression and only if the\n    // validation object contains an identical regular expression, it is going\n    // to pass.\n    reg: /abc/i,\n  },\n);\n\n// Fails due to the different `message` and `name` properties:\nassert.throws(\n  () => {\n    const otherErr = new Error('Not found');\n    // Copy all enumerable properties from `err` to `otherErr`.\n    for (const [key, value] of Object.entries(err)) {\n      otherErr[key] = value;\n    }\n    throw otherErr;\n  },\n  // The error's `message` and `name` properties will also be checked when using\n  // an error as validation object.\n  err,\n);\n</code></pre>\n<pre><code class=\"language-cjs\">const assert = require('node:assert/strict');\n\nconst err = new TypeError('Wrong value');\nerr.code = 404;\nerr.foo = 'bar';\nerr.info = {\n  nested: true,\n  baz: 'text',\n};\nerr.reg = /abc/i;\n\nassert.throws(\n  () => {\n    throw err;\n  },\n  {\n    name: 'TypeError',\n    message: 'Wrong value',\n    info: {\n      nested: true,\n      baz: 'text',\n    },\n    // Only properties on the validation object will be tested for.\n    // Using nested objects requires all properties to be present. Otherwise\n    // the validation is going to fail.\n  },\n);\n\n// Using regular expressions to validate error properties:\nassert.throws(\n  () => {\n    throw err;\n  },\n  {\n    // The `name` and `message` properties are strings and using regular\n    // expressions on those will match against the string. If they fail, an\n    // error is thrown.\n    name: /^TypeError$/,\n    message: /Wrong/,\n    foo: 'bar',\n    info: {\n      nested: true,\n      // It is not possible to use regular expressions for nested properties!\n      baz: 'text',\n    },\n    // The `reg` property contains a regular expression and only if the\n    // validation object contains an identical regular expression, it is going\n    // to pass.\n    reg: /abc/i,\n  },\n);\n\n// Fails due to the different `message` and `name` properties:\nassert.throws(\n  () => {\n    const otherErr = new Error('Not found');\n    // Copy all enumerable properties from `err` to `otherErr`.\n    for (const [key, value] of Object.entries(err)) {\n      otherErr[key] = value;\n    }\n    throw otherErr;\n  },\n  // The error's `message` and `name` properties will also be checked when using\n  // an error as validation object.\n  err,\n);\n</code></pre>\n<p>Validate instanceof using constructor:</p>\n<pre><code class=\"language-mjs\">import assert from 'node:assert/strict';\n\nassert.throws(\n  () => {\n    throw new Error('Wrong value');\n  },\n  Error,\n);\n</code></pre>\n<pre><code class=\"language-cjs\">const assert = require('node:assert/strict');\n\nassert.throws(\n  () => {\n    throw new Error('Wrong value');\n  },\n  Error,\n);\n</code></pre>\n<p>Validate error message using <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp\"><code>&#x3C;RegExp></code></a>:</p>\n<p>Using a regular expression runs <code>.toString</code> on the error object, and will\ntherefore also include the error name.</p>\n<pre><code class=\"language-mjs\">import assert from 'node:assert/strict';\n\nassert.throws(\n  () => {\n    throw new Error('Wrong value');\n  },\n  /^Error: Wrong value$/,\n);\n</code></pre>\n<pre><code class=\"language-cjs\">const assert = require('node:assert/strict');\n\nassert.throws(\n  () => {\n    throw new Error('Wrong value');\n  },\n  /^Error: Wrong value$/,\n);\n</code></pre>\n<p>Custom error validation:</p>\n<p>The function must return <code>true</code> to indicate all internal validations passed.\nIt will otherwise fail with an <a href=\"#class-assertassertionerror\"><code>AssertionError</code></a>.</p>\n<pre><code class=\"language-mjs\">import assert from 'node:assert/strict';\n\nassert.throws(\n  () => {\n    throw new Error('Wrong value');\n  },\n  (err) => {\n    assert(err instanceof Error);\n    assert(/value/.test(err));\n    // Avoid returning anything from validation functions besides `true`.\n    // Otherwise, it's not clear what part of the validation failed. Instead,\n    // throw an error about the specific validation that failed (as done in this\n    // example) and add as much helpful debugging information to that error as\n    // possible.\n    return true;\n  },\n  'unexpected error',\n);\n</code></pre>\n<pre><code class=\"language-cjs\">const assert = require('node:assert/strict');\n\nassert.throws(\n  () => {\n    throw new Error('Wrong value');\n  },\n  (err) => {\n    assert(err instanceof Error);\n    assert(/value/.test(err));\n    // Avoid returning anything from validation functions besides `true`.\n    // Otherwise, it's not clear what part of the validation failed. Instead,\n    // throw an error about the specific validation that failed (as done in this\n    // example) and add as much helpful debugging information to that error as\n    // possible.\n    return true;\n  },\n  'unexpected error',\n);\n</code></pre>\n<p><code>error</code> cannot be a string. If a string is provided as the second\nargument, then <code>error</code> is assumed to be omitted and the string will be used for\n<code>message</code> instead. This can lead to easy-to-miss mistakes. Using the same\nmessage as the thrown error message is going to result in an\n<code>ERR_AMBIGUOUS_ARGUMENT</code> error. Please read the example below carefully if using\na string as the second argument gets considered:</p>\n<pre><code class=\"language-mjs\">import assert from 'node:assert/strict';\n\nfunction throwingFirst() {\n  throw new Error('First');\n}\n\nfunction throwingSecond() {\n  throw new Error('Second');\n}\n\nfunction notThrowing() {}\n\n// The second argument is a string and the input function threw an Error.\n// The first case will not throw as it does not match for the error message\n// thrown by the input function!\nassert.throws(throwingFirst, 'Second');\n// In the next example the message has no benefit over the message from the\n// error and since it is not clear if the user intended to actually match\n// against the error message, Node.js throws an `ERR_AMBIGUOUS_ARGUMENT` error.\nassert.throws(throwingSecond, 'Second');\n// TypeError [ERR_AMBIGUOUS_ARGUMENT]\n\n// The string is only used (as message) in case the function does not throw:\nassert.throws(notThrowing, 'Second');\n// AssertionError [ERR_ASSERTION]: Missing expected exception: Second\n\n// If it was intended to match for the error message do this instead:\n// It does not throw because the error messages match.\nassert.throws(throwingSecond, /Second$/);\n\n// If the error message does not match, an AssertionError is thrown.\nassert.throws(throwingFirst, /Second$/);\n// AssertionError [ERR_ASSERTION]\n</code></pre>\n<pre><code class=\"language-cjs\">const assert = require('node:assert/strict');\n\nfunction throwingFirst() {\n  throw new Error('First');\n}\n\nfunction throwingSecond() {\n  throw new Error('Second');\n}\n\nfunction notThrowing() {}\n\n// The second argument is a string and the input function threw an Error.\n// The first case will not throw as it does not match for the error message\n// thrown by the input function!\nassert.throws(throwingFirst, 'Second');\n// In the next example the message has no benefit over the message from the\n// error and since it is not clear if the user intended to actually match\n// against the error message, Node.js throws an `ERR_AMBIGUOUS_ARGUMENT` error.\nassert.throws(throwingSecond, 'Second');\n// TypeError [ERR_AMBIGUOUS_ARGUMENT]\n\n// The string is only used (as message) in case the function does not throw:\nassert.throws(notThrowing, 'Second');\n// AssertionError [ERR_ASSERTION]: Missing expected exception: Second\n\n// If it was intended to match for the error message do this instead:\n// It does not throw because the error messages match.\nassert.throws(throwingSecond, /Second$/);\n\n// If the error message does not match, an AssertionError is thrown.\nassert.throws(throwingFirst, /Second$/);\n// AssertionError [ERR_ASSERTION]\n</code></pre>\n<p>Due to the confusing error-prone notation, avoid a string as the second\nargument.</p>"
        },
        {
          "textRaw": "`assert.partialDeepStrictEqual(actual, expected[, message])`",
          "name": "partialDeepStrictEqual",
          "type": "method",
          "meta": {
            "added": [
              "v23.4.0",
              "v22.13.0"
            ],
            "changes": [
              {
                "version": "v25.0.0",
                "pr-url": "https://github.com/nodejs/node/pull/59448",
                "description": "Promises are not considered equal anymore if they are not of the same instance."
              },
              {
                "version": "v25.0.0",
                "pr-url": "https://github.com/nodejs/node/pull/57627",
                "description": "Invalid dates are now considered equal."
              },
              {
                "version": [
                  "v24.0.0",
                  "v22.17.0"
                ],
                "pr-url": "https://github.com/nodejs/node/pull/57370",
                "description": "partialDeepStrictEqual is now Stable. Previously, it had been Experimental."
              }
            ]
          },
          "signatures": [
            {
              "params": [
                {
                  "textRaw": "`actual` {any}",
                  "name": "actual",
                  "type": "any"
                },
                {
                  "textRaw": "`expected` {any}",
                  "name": "expected",
                  "type": "any"
                },
                {
                  "textRaw": "`message` {string|Error|Function}",
                  "name": "message",
                  "type": "string|Error|Function",
                  "optional": true
                }
              ]
            }
          ],
          "desc": "<p>Tests for partial deep equality between the <code>actual</code> and <code>expected</code> parameters.\n\"Deep\" equality means that the enumerable \"own\" properties of child objects\nare recursively evaluated also by the following rules. \"Partial\" equality means\nthat only properties that exist on the <code>expected</code> parameter are going to be\ncompared.</p>\n<p>This method always passes the same test cases as <a href=\"#assertdeepstrictequalactual-expected-message\"><code>assert.deepStrictEqual()</code></a>,\nbehaving as a super set of it.</p>",
          "modules": [
            {
              "textRaw": "Comparison details",
              "name": "comparison_details",
              "type": "module",
              "desc": "<ul>\n<li>Primitive values are compared using <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is\"><code>Object.is()</code></a>.</li>\n<li><a href=\"https://tc39.github.io/ecma262/#sec-object.prototype.tostring\">Type tags</a> of objects should be the same.</li>\n<li><a href=\"https://tc39.github.io/ecma262/#sec-ordinary-object-internal-methods-and-internal-slots\"><code>[[Prototype]]</code></a> of objects are not compared.</li>\n<li>Only <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Enumerability_and_ownership_of_properties\">enumerable \"own\" properties</a> are considered.</li>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error\"><code>&#x3C;Error></code></a> names, messages, causes, and errors are always compared,\neven if these are not enumerable properties. <code>errors</code> is also compared.</li>\n<li>Enumerable own <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#symbol_type\"><code>&#x3C;Symbol></code></a> properties are compared as well.</li>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Data_structures#primitive_values\">Object wrappers</a> are compared both as objects and unwrapped values.</li>\n<li><code>Object</code> properties are compared unordered.</li>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map\"><code>&#x3C;Map></code></a> keys and <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set\"><code>&#x3C;Set></code></a> items are compared unordered.</li>\n<li>Recursion stops when both sides differ or both sides encounter a circular\nreference.</li>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakMap\"><code>&#x3C;WeakMap></code></a>, <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakSet\"><code>&#x3C;WeakSet></code></a> and <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise\"><code>&#x3C;Promise></code></a> instances are <strong>not</strong> compared\nstructurally. They are only equal if they reference the same object. Any\ncomparison between different <code>WeakMap</code>, <code>WeakSet</code>, or <code>Promise</code> instances\nwill result in inequality, even if they contain the same content.</li>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp\"><code>&#x3C;RegExp></code></a> lastIndex, flags, and source are always compared, even if these\nare not enumerable properties.</li>\n<li>Holes in sparse arrays are ignored.</li>\n</ul>\n<pre><code class=\"language-mjs\">import assert from 'node:assert';\n\nassert.partialDeepStrictEqual(\n  { a: { b: { c: 1 } } },\n  { a: { b: { c: 1 } } },\n);\n// OK\n\nassert.partialDeepStrictEqual(\n  { a: 1, b: 2, c: 3 },\n  { b: 2 },\n);\n// OK\n\nassert.partialDeepStrictEqual(\n  [1, 2, 3, 4, 5, 6, 7, 8, 9],\n  [4, 5, 8],\n);\n// OK\n\nassert.partialDeepStrictEqual(\n  new Set([{ a: 1 }, { b: 1 }]),\n  new Set([{ a: 1 }]),\n);\n// OK\n\nassert.partialDeepStrictEqual(\n  new Map([['key1', 'value1'], ['key2', 'value2']]),\n  new Map([['key2', 'value2']]),\n);\n// OK\n\nassert.partialDeepStrictEqual(123n, 123n);\n// OK\n\nassert.partialDeepStrictEqual(\n  [1, 2, 3, 4, 5, 6, 7, 8, 9],\n  [5, 4, 8],\n);\n// AssertionError\n\nassert.partialDeepStrictEqual(\n  { a: 1 },\n  { a: 1, b: 2 },\n);\n// AssertionError\n\nassert.partialDeepStrictEqual(\n  { a: { b: 2 } },\n  { a: { b: '2' } },\n);\n// AssertionError\n</code></pre>\n<pre><code class=\"language-cjs\">const assert = require('node:assert');\n\nassert.partialDeepStrictEqual(\n  { a: { b: { c: 1 } } },\n  { a: { b: { c: 1 } } },\n);\n// OK\n\nassert.partialDeepStrictEqual(\n  { a: 1, b: 2, c: 3 },\n  { b: 2 },\n);\n// OK\n\nassert.partialDeepStrictEqual(\n  [1, 2, 3, 4, 5, 6, 7, 8, 9],\n  [4, 5, 8],\n);\n// OK\n\nassert.partialDeepStrictEqual(\n  new Set([{ a: 1 }, { b: 1 }]),\n  new Set([{ a: 1 }]),\n);\n// OK\n\nassert.partialDeepStrictEqual(\n  new Map([['key1', 'value1'], ['key2', 'value2']]),\n  new Map([['key2', 'value2']]),\n);\n// OK\n\nassert.partialDeepStrictEqual(123n, 123n);\n// OK\n\nassert.partialDeepStrictEqual(\n  [1, 2, 3, 4, 5, 6, 7, 8, 9],\n  [5, 4, 8],\n);\n// AssertionError\n\nassert.partialDeepStrictEqual(\n  { a: 1 },\n  { a: 1, b: 2 },\n);\n// AssertionError\n\nassert.partialDeepStrictEqual(\n  { a: { b: 2 } },\n  { a: { b: '2' } },\n);\n// AssertionError\n</code></pre>",
              "displayName": "Comparison details"
            }
          ]
        }
      ],
      "displayName": "Assert"
    }
  ]
}