{"$schema":"https://doc-kit.nodejs.org/schemas/api-doc/1.0.0.json","id":"assert","path":"/assert","type":"module","module":"assert","title":"Assert","introducedIn":"v0.1.21","sourceLink":{"path":"lib/assert.js","url":"https://github.com/nodejs/node/blob/HEAD/lib/assert.js"},"stability":{"index":"2","description":"Stable"},"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"The `node:assert` module provides a set of assertion functions for verifying\ninvariants.","summary":"The `node:assert` module provides a set of assertion functions for verifying invariants.","examples":[],"children":[{"kind":"section","id":"strict-assertion-mode","name":"Strict assertion mode","title":"Strict assertion mode","scope":"module","overloadOf":null,"stability":null,"added":["v9.9.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v15.0.0"],"prUrl":"https://github.com/nodejs/node/pull/34001","commit":null,"description":"Exposed as `require('node:assert/strict')`."},{"versions":["v13.9.0","v12.16.2"],"prUrl":"https://github.com/nodejs/node/pull/31635","commit":null,"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\"."},{"versions":["v9.9.0"],"prUrl":"https://github.com/nodejs/node/pull/17615","commit":null,"description":"Added error diffs to the strict assertion mode."},{"versions":["v9.9.0"],"prUrl":"https://github.com/nodejs/node/pull/17002","commit":null,"description":"Added strict assertion mode to the assert module."}],"description":"In strict assertion mode, non-strict methods behave like their corresponding\nstrict methods. For example, [`assert.deepEqual()`](#assertdeepequalactual-expected-message) will behave like\n[`assert.deepStrictEqual()`](#assertdeepstrictequalactual-expected-message).\n\nIn strict assertion mode, error messages for objects display a diff. In legacy\nassertion mode, error messages for objects display the objects, often truncated.","summary":"In strict assertion mode, non-strict methods behave like their corresponding strict methods. For example, `assert.deepEqual()` will behave like `assert.deepStrictEqual()`.","examples":[],"children":[{"kind":"section","id":"message-parameter-semantics","name":"Message parameter semantics","title":"Message parameter semantics","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"For assertion methods that accept an optional `message` parameter, the message\nmay be provided in one of the following forms:\n\n* **string**: Used as-is. If additional arguments are supplied after the\n  `message` string, they are treated as printf-like substitutions (see\n  [`util.format()`](util.html#utilformatformat-args)).\n* **Error**: If an `Error` instance is provided as `message`, that error is\n  thrown directly instead of an `AssertionError`.\n* **function**: A function of the form `(actual, expected) => string`. It is\n  called only when the assertion fails and should return a string to be used as\n  the error message. Non-string return values are ignored and the default\n  message is used instead.\n\nIf additional arguments are passed along with an `Error` or a function as\n`message`, the call is rejected with `ERR_AMBIGUOUS_ARGUMENT`.\n\nIf the first item is neither a string, `Error`, nor function, `ERR_INVALID_ARG_TYPE`\nis thrown.\n\nTo use strict assertion mode:\n\n```mjs\nimport { strict as assert } from 'node:assert';\n```\n\n```cjs\nconst assert = require('node:assert').strict;\n```\n\n```mjs\nimport assert from 'node:assert/strict';\n```\n\n```cjs\nconst assert = require('node:assert/strict');\n```\n\nExample error diff:\n\n```mjs\nimport { 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```\n\n```cjs\nconst 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```\n\nTo deactivate the colors, use the `NO_COLOR` or `NODE_DISABLE_COLORS`\nenvironment variables. This will also deactivate the colors in the REPL. For\nmore on color support in terminal environments, read the tty\n[`getColorDepth()`](tty.html#writestreamgetcolordepthenv) documentation.","summary":"For assertion methods that accept an optional `message` parameter, the message may be provided in one of the following forms:","examples":[{"language":"mjs","displayName":null,"code":"import { strict as assert } from 'node:assert';"},{"language":"cjs","displayName":null,"code":"const assert = require('node:assert').strict;"},{"language":"mjs","displayName":null,"code":"import assert from 'node:assert/strict';"},{"language":"cjs","displayName":null,"code":"const assert = require('node:assert/strict');"},{"language":"mjs","displayName":null,"code":"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//   ]"},{"language":"cjs","displayName":null,"code":"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//   ]"}],"children":[]}]},{"kind":"section","id":"legacy-assertion-mode","name":"Legacy assertion mode","title":"Legacy assertion mode","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"Legacy assertion mode uses the [`==` operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Equality) in:\n\n* [`assert.deepEqual()`](#assertdeepequalactual-expected-message)\n* [`assert.equal()`](#assertequalactual-expected-message)\n* [`assert.notDeepEqual()`](#assertnotdeepequalactual-expected-message)\n* [`assert.notEqual()`](#assertnotequalactual-expected-message)\n\nTo use legacy assertion mode:\n\n```mjs\nimport assert from 'node:assert';\n```\n\n```cjs\nconst assert = require('node:assert');\n```\n\nLegacy assertion mode may have surprising results, especially when using\n[`assert.deepEqual()`](#assertdeepequalactual-expected-message):\n\n```cjs\n// WARNING: This does not throw an AssertionError in legacy assertion mode!\nassert.deepEqual(/a/gi, new Date());\n```","summary":"Legacy assertion mode uses the `==` operator in:","examples":[{"language":"mjs","displayName":null,"code":"import assert from 'node:assert';"},{"language":"cjs","displayName":null,"code":"const assert = require('node:assert');"},{"language":"cjs","displayName":null,"code":"// WARNING: This does not throw an AssertionError in legacy assertion mode!\nassert.deepEqual(/a/gi, new Date());"}],"children":[]},{"kind":"class","id":"class-assertassertionerror","name":"AssertionError","title":"Class: `assert.AssertionError`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"extends":{"text":"errors.Error","links":[{"name":"errors.Error","href":"errors.html#class-errorserror","start":0,"end":12}]},"description":"Indicates the failure of an assertion. All errors thrown by the `node:assert`\nmodule will be instances of the `AssertionError` class.","summary":"Indicates the failure of an assertion. All errors thrown by the `node:assert` module will be instances of the `AssertionError` class.","examples":[],"children":[{"kind":"constructor","id":"new-assertassertionerroroptions","name":"AssertionError","title":"`new assert.AssertionError(options)`","scope":"module","overloadOf":null,"stability":null,"added":["v0.1.21"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"options","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[{"name":"message","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"If provided, the error message is set to this value.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"actual","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"The `actual` property on the error instance.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"expected","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"The `expected` property on the error instance.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"operator","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"The `operator` property on the error instance.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"stackStartFn","type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"If provided, the generated stack trace omits\nframes before this function.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"diff","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"If set to `'full'`, shows the full diff in assertion errors. Defaults to `'simple'`.\nAccepted values: `'simple'`, `'full'`.","default":null,"optional":false,"rest":false,"properties":[]}]}],"returns":null},"description":"A subclass of {Error} that indicates the failure of an assertion.\n\nAll instances contain the built-in `Error` properties (`message` and `name`)\nand:\n\n* `actual` {any} Set to the `actual` argument for methods such as\n  [`assert.strictEqual()`](#assertstrictequalactual-expected-message).\n* `expected` {any} Set to the `expected` value for methods such as\n  [`assert.strictEqual()`](#assertstrictequalactual-expected-message).\n* `generatedMessage` {boolean} Indicates if the message was auto-generated\n  (`true`) or not.\n* `code` {string} Value is always `ERR_ASSERTION` to show that the error is an\n  assertion error.\n* `operator` {string} Set to the passed in operator value.\n\n```mjs\nimport 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```\n\n```cjs\nconst 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```","summary":"A subclass of {Error} that indicates the failure of an assertion.","examples":[{"language":"mjs","displayName":null,"code":"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}"},{"language":"cjs","displayName":null,"code":"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}"}],"children":[]}]},{"kind":"class","id":"class-assertassert","name":"Assert","title":"Class: `assert.Assert`","scope":"module","overloadOf":null,"stability":null,"added":["v24.6.0","v22.19.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"extends":null,"description":"The `Assert` class allows creating independent assertion instances with custom options.","summary":"The `Assert` class allows creating independent assertion instances with custom options.","examples":[],"children":[{"kind":"constructor","id":"new-assertassertoptions","name":"Assert","title":"`new assert.Assert([options])`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v24.9.0"],"prUrl":"https://github.com/nodejs/node/pull/59762","commit":null,"description":"Added `skipPrototype` option."}],"signature":{"parameters":[{"name":"options","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"","default":null,"optional":true,"rest":false,"properties":[{"name":"diff","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"If set to `'full'`, shows the full diff in assertion errors. Defaults to `'simple'`.\nAccepted values: `'simple'`, `'full'`.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"strict","type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":"If set to `true`, non-strict methods behave like their\ncorresponding strict methods. Defaults to `true`.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"skipPrototype","type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":"If set to `true`, skips prototype and constructor\ncomparison in deep equality checks. Defaults to `false`.","default":null,"optional":false,"rest":false,"properties":[]}]}],"returns":null},"description":"Creates a new assertion instance. The `diff` option controls the verbosity of diffs in assertion error messages.\n\n```js\nconst { 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```\n\n**Important**: When destructuring assertion methods from an `Assert` instance,\nthe methods lose their connection to the instance's configuration options (such\nas `diff`, `strict`, and `skipPrototype` settings).\nThe destructured methods will fall back to default behavior instead.\n\n```js\nconst 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```\n\nThe `skipPrototype` option affects all deep equality methods:\n\n```js\nclass 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```\n\nWhen destructured, methods lose access to the instance's `this` context and revert to the 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.","summary":"Creates a new assertion instance. The `diff` option controls the verbosity of diffs in assertion error messages.","examples":[{"language":"js","displayName":null,"code":"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."},{"language":"js","displayName":null,"code":"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 } });"},{"language":"js","displayName":null,"code":"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"}],"children":[]}]},{"kind":"method","id":"assertvalue-message","name":"assert","title":"`assert(value[, message])`","scope":"module","overloadOf":null,"stability":null,"added":["v0.5.9"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v26.0.0"],"prUrl":"https://github.com/nodejs/node/pull/58849","commit":null,"description":"Message may now be a `printf`-like format string or function."}],"signature":{"parameters":[{"name":"value","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"The input that is checked for being truthy.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"message","type":{"text":"string | Error | Function","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6},{"name":"Error","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error","start":9,"end":14},{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":17,"end":25}]},"description":"","default":null,"optional":true,"rest":false,"properties":[]}],"returns":null},"description":"An alias of [`assert.ok()`](#assertokvalue-message).","summary":"An alias of `assert.ok()`.","examples":[],"children":[]},{"kind":"method","id":"assertdeepequalactual-expected-message","name":"deepEqual","title":"`assert.deepEqual(actual, expected[, message])`","scope":"module","overloadOf":null,"stability":{"index":"3","description":"Legacy: Use [`assert.deepStrictEqual()`](#assertdeepstrictequalactual-expected-message) instead."},"added":["v0.1.21"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v26.0.0"],"prUrl":"https://github.com/nodejs/node/pull/58849","commit":null,"description":"Message may now be a `printf`-like format string or function."},{"versions":["v25.0.0"],"prUrl":"https://github.com/nodejs/node/pull/59448","commit":null,"description":"Promises are not considered equal anymore if they are not of the same instance."},{"versions":["v25.0.0"],"prUrl":"https://github.com/nodejs/node/pull/57627","commit":null,"description":"Invalid dates are now considered equal."},{"versions":["v24.0.0"],"prUrl":"https://github.com/nodejs/node/pull/57622","commit":null,"description":"Recursion now stops when either side encounters a circular reference."},{"versions":["v22.2.0","v20.15.0"],"prUrl":"https://github.com/nodejs/node/pull/51805","commit":null,"description":"Error cause and errors properties are now compared as well."},{"versions":["v18.0.0"],"prUrl":"https://github.com/nodejs/node/pull/41020","commit":null,"description":"Regular expressions lastIndex property is now compared as well."},{"versions":["v16.0.0","v14.18.0"],"prUrl":"https://github.com/nodejs/node/pull/38113","commit":null,"description":"In Legacy assertion mode, changed status from Deprecated to Legacy."},{"versions":["v14.0.0"],"prUrl":"https://github.com/nodejs/node/pull/30766","commit":null,"description":"NaN is now treated as being identical if both sides are NaN."},{"versions":["v12.0.0"],"prUrl":"https://github.com/nodejs/node/pull/25008","commit":null,"description":"The type tags are now properly compared and there are a couple minor comparison adjustments to make the check less surprising."},{"versions":["v9.0.0"],"prUrl":"https://github.com/nodejs/node/pull/15001","commit":null,"description":"The `Error` names and messages are now properly compared."},{"versions":["v8.0.0"],"prUrl":"https://github.com/nodejs/node/pull/12142","commit":null,"description":"The `Set` and `Map` content is also compared."},{"versions":["v6.4.0","v4.7.1"],"prUrl":"https://github.com/nodejs/node/pull/8002","commit":null,"description":"Typed array slices are handled correctly now."},{"versions":["v6.1.0","v4.5.0"],"prUrl":"https://github.com/nodejs/node/pull/6432","commit":null,"description":"Objects with circular references can be used as inputs now."},{"versions":["v5.10.1","v4.4.3"],"prUrl":"https://github.com/nodejs/node/pull/5910","commit":null,"description":"Handle non-`Uint8Array` typed arrays correctly."}],"signature":{"parameters":[{"name":"actual","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"expected","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"message","type":{"text":"string | Error | Function","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6},{"name":"Error","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error","start":9,"end":14},{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":17,"end":25}]},"description":"","default":null,"optional":true,"rest":false,"properties":[]}],"returns":null},"description":"**Strict assertion mode**\n\nAn alias of [`assert.deepStrictEqual()`](#assertdeepstrictequalactual-expected-message).\n\n**Legacy assertion mode**\n\nTests for deep equality between the `actual` and `expected` parameters. Consider\nusing [`assert.deepStrictEqual()`](#assertdeepstrictequalactual-expected-message) instead. [`assert.deepEqual()`](#assertdeepequalactual-expected-message) can have\nsurprising results.\n\n*Deep equality* means that the enumerable \"own\" properties of child objects\nare also recursively evaluated by the following rules.","summary":"**Strict assertion mode**","examples":[],"children":[{"kind":"section","id":"comparison-details","name":"Comparison details","title":"Comparison details","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"* Primitive values are compared with the [`==` operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Equality),\n  except for {NaN}, which is treated as identical when both\n  sides are {NaN}.\n* [Type tags](https://tc39.github.io/ecma262/#sec-object.prototype.tostring) of objects should be the same.\n* Only [enumerable \"own\" properties](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Enumerability_and_ownership_of_properties) are considered.\n* Object constructors are compared when available.\n* {Error} names, messages, causes, and errors are always compared,\n  even if these are not enumerable properties.\n* [Object wrappers](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Data_structures#primitive_values) are compared both as objects and unwrapped values.\n* `Object` properties are compared unordered.\n* {Map} keys and {Set} items are compared unordered.\n* Recursion stops when both sides differ or either side encounters a circular\n  reference.\n* Implementation does not test the [`[[Prototype]]`](https://tc39.github.io/ecma262/#sec-ordinary-object-internal-methods-and-internal-slots) of\n  objects.\n* {Symbol} properties are not compared.\n* {WeakMap}, {WeakSet} and {Promise} instances are **not** compared\n  structurally. They are only equal if they reference the same object. Any\n  comparison between different `WeakMap`, `WeakSet`, or `Promise` instances\n  will result in inequality, even if they contain the same content.\n* {RegExp} lastIndex, flags, and source are always compared, even if these\n  are not enumerable properties.\n\nThe following example does not throw an [`AssertionError`](#class-assertassertionerror) because the\nprimitives are compared using the [`==` operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Equality).\n\n```mjs\nimport assert from 'node:assert';\n// WARNING: This does not throw an AssertionError!\n\nassert.deepEqual('+00000000', false);\n```\n\n```cjs\nconst assert = require('node:assert');\n// WARNING: This does not throw an AssertionError!\n\nassert.deepEqual('+00000000', false);\n```\n\n\"Deep\" equality means that the enumerable \"own\" properties of child objects\nare evaluated also:\n\n```mjs\nimport 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```\n\n```cjs\nconst 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```\n\nIf the values are not equal, an [`AssertionError`](#class-assertassertionerror) is thrown with a `message`\nproperty set equal to the value of the `message` parameter. If the `message`\nparameter is undefined, a default error message is assigned. If the `message`\nparameter is an instance of {Error} then it will be thrown instead of the\n[`AssertionError`](#class-assertassertionerror).","summary":"The following example does not throw an `AssertionError` because the primitives are compared using the `==` operator.","examples":[{"language":"mjs","displayName":null,"code":"import assert from 'node:assert';\n// WARNING: This does not throw an AssertionError!\n\nassert.deepEqual('+00000000', false);"},{"language":"cjs","displayName":null,"code":"const assert = require('node:assert');\n// WARNING: This does not throw an AssertionError!\n\nassert.deepEqual('+00000000', false);"},{"language":"mjs","displayName":null,"code":"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 {}"},{"language":"cjs","displayName":null,"code":"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 {}"}],"children":[]}]},{"kind":"method","id":"assertdeepstrictequalactual-expected-message","name":"deepStrictEqual","title":"`assert.deepStrictEqual(actual, expected[, message])`","scope":"module","overloadOf":null,"stability":null,"added":["v1.2.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v25.1.0"],"prUrl":"https://github.com/nodejs/node/pull/58849","commit":null,"description":"Message may now be a `printf`-like format string or function."},{"versions":["v25.0.0"],"prUrl":"https://github.com/nodejs/node/pull/59448","commit":null,"description":"Promises are not considered equal anymore if they are not of the same instance."},{"versions":["v25.0.0"],"prUrl":"https://github.com/nodejs/node/pull/57627","commit":null,"description":"Invalid dates are now considered equal."},{"versions":["v24.0.0"],"prUrl":"https://github.com/nodejs/node/pull/57622","commit":null,"description":"Recursion now stops when either side encounters a circular reference."},{"versions":["v22.2.0","v20.15.0"],"prUrl":"https://github.com/nodejs/node/pull/51805","commit":null,"description":"Error cause and errors properties are now compared as well."},{"versions":["v18.0.0"],"prUrl":"https://github.com/nodejs/node/pull/41020","commit":null,"description":"Regular expressions lastIndex property is now compared as well."},{"versions":["v9.0.0"],"prUrl":"https://github.com/nodejs/node/pull/15169","commit":null,"description":"Enumerable symbol properties are now compared."},{"versions":["v9.0.0"],"prUrl":"https://github.com/nodejs/node/pull/15036","commit":null,"description":"The `NaN` is now compared using the [SameValueZero](https://tc39.github.io/ecma262/#sec-samevaluezero) comparison."},{"versions":["v8.5.0"],"prUrl":"https://github.com/nodejs/node/pull/15001","commit":null,"description":"The `Error` names and messages are now properly compared."},{"versions":["v8.0.0"],"prUrl":"https://github.com/nodejs/node/pull/12142","commit":null,"description":"The `Set` and `Map` content is also compared."},{"versions":["v6.4.0","v4.7.1"],"prUrl":"https://github.com/nodejs/node/pull/8002","commit":null,"description":"Typed array slices are handled correctly now."},{"versions":["v6.1.0"],"prUrl":"https://github.com/nodejs/node/pull/6432","commit":null,"description":"Objects with circular references can be used as inputs now."},{"versions":["v5.10.1","v4.4.3"],"prUrl":"https://github.com/nodejs/node/pull/5910","commit":null,"description":"Handle non-`Uint8Array` typed arrays correctly."}],"signature":{"parameters":[{"name":"actual","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"expected","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"message","type":{"text":"string | Error | Function","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6},{"name":"Error","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error","start":9,"end":14},{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":17,"end":25}]},"description":"","default":null,"optional":true,"rest":false,"properties":[]}],"returns":null},"description":"Tests for deep equality between the `actual` and `expected` parameters.\n\"Deep\" equality means that the enumerable \"own\" properties of child objects\nare recursively evaluated also by the following rules.","summary":"Tests for deep equality between the `actual` and `expected` parameters. \"Deep\" equality means that the enumerable \"own\" properties of child objects are recursively evaluated also by the following rules.","examples":[],"children":[{"kind":"section","id":"comparison-details-1","name":"Comparison details","title":"Comparison details","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"* Primitive values are compared using [`Object.is()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is).\n* [Type tags](https://tc39.github.io/ecma262/#sec-object.prototype.tostring) of objects should be the same.\n* [`[[Prototype]]`](https://tc39.github.io/ecma262/#sec-ordinary-object-internal-methods-and-internal-slots) of objects are compared using\n  the [`===` operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Strict_equality).\n* Only [enumerable \"own\" properties](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Enumerability_and_ownership_of_properties) are considered.\n* Object constructors are compared when available.\n* {Error} names, messages, causes, and errors are always compared,\n  even if these are not enumerable properties.\n  `errors` is also compared.\n* Enumerable own {Symbol} properties are compared as well.\n* [Object wrappers](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Data_structures#primitive_values) are compared both as objects and unwrapped values.\n* `Object` properties are compared unordered.\n* {Map} keys and {Set} items are compared unordered.\n* Recursion stops when both sides differ or either side encounters a circular\n  reference.\n* {WeakMap}, {WeakSet} and {Promise} instances are **not** compared\n  structurally. They are only equal if they reference the same object. Any\n  comparison between different `WeakMap`, `WeakSet`, or `Promise` instances\n  will result in inequality, even if they contain the same content.\n* {RegExp} lastIndex, flags, and source are always compared, even if these\n  are not enumerable properties.\n\n```mjs\nimport 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//   <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//   <items unknown>\n// }\n\n// Comparing the same instance to itself succeeds\nassert.deepStrictEqual(weakSet1, weakSet1);\n// OK\n```\n\n```cjs\nconst 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//   <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//   <items unknown>\n// }\n\n// Comparing the same instance to itself succeeds\nassert.deepStrictEqual(weakSet1, weakSet1);\n// OK\n```\n\nIf the values are not equal, an [`AssertionError`](#class-assertassertionerror) is thrown with a `message`\nproperty set equal to the value of the `message` parameter. If the `message`\nparameter is undefined, a default error message is assigned. If the `message`\nparameter is an instance of {Error} then it will be thrown instead of the\n`AssertionError`.","summary":"If the values are not equal, an `AssertionError` is thrown with a `message` property set equal to the value of the `message` parameter. If the `message` parameter is undefined, a default error message is assigned. If the `message` parameter is an instance of {Error} then it will be thrown instead of the `AssertionError`.","examples":[{"language":"mjs","displayName":null,"code":"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//   <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//   <items unknown>\n// }\n\n// Comparing the same instance to itself succeeds\nassert.deepStrictEqual(weakSet1, weakSet1);\n// OK"},{"language":"cjs","displayName":null,"code":"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//   <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//   <items unknown>\n// }\n\n// Comparing the same instance to itself succeeds\nassert.deepStrictEqual(weakSet1, weakSet1);\n// OK"}],"children":[]}]},{"kind":"method","id":"assertdoesnotmatchstring-regexp-message","name":"doesNotMatch","title":"`assert.doesNotMatch(string, regexp[, message])`","scope":"module","overloadOf":null,"stability":null,"added":["v13.6.0","v12.16.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v26.0.0"],"prUrl":"https://github.com/nodejs/node/pull/58849","commit":null,"description":"Message may now be a `printf`-like format string or function."},{"versions":["v16.0.0"],"prUrl":"https://github.com/nodejs/node/pull/38111","commit":null,"description":"This API is no longer experimental."}],"signature":{"parameters":[{"name":"string","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"regexp","type":{"text":"RegExp","links":[{"name":"RegExp","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/RegExp","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"message","type":{"text":"string | Error | Function","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6},{"name":"Error","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error","start":9,"end":14},{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":17,"end":25}]},"description":"","default":null,"optional":true,"rest":false,"properties":[]}],"returns":null},"description":"Expects the `string` input not to match the regular expression.\n\n```mjs\nimport 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```\n\n```cjs\nconst 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```\n\nIf the values do match, or if the `string` argument is of another type than\n`string`, an [`AssertionError`](#class-assertassertionerror) is thrown with a `message` property set equal\nto the value of the `message` parameter. If the `message` parameter is\nundefined, a default error message is assigned. If the `message` parameter is an\ninstance of {Error} then it will be thrown instead of the\n[`AssertionError`](#class-assertassertionerror).","summary":"Expects the `string` input not to match the regular expression.","examples":[{"language":"mjs","displayName":null,"code":"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"},{"language":"cjs","displayName":null,"code":"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"}],"children":[]},{"kind":"method","id":"assertdoesnotrejectasyncfn-error-message","name":"doesNotReject","title":"`assert.doesNotReject(asyncFn[, error][, message])`","scope":"module","overloadOf":null,"stability":null,"added":["v10.0.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"asyncFn","type":{"text":"Function | Promise","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8},{"name":"Promise","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise","start":11,"end":18}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"error","type":{"text":"RegExp | Function","links":[{"name":"RegExp","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/RegExp","start":0,"end":6},{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":9,"end":17}]},"description":"","default":null,"optional":true,"rest":false,"properties":[]},{"name":"message","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"","default":null,"optional":true,"rest":false,"properties":[]}],"returns":{"type":{"text":"Promise","links":[{"name":"Promise","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise","start":0,"end":7}]},"description":""}},"description":"Awaits the `asyncFn` promise or, if `asyncFn` is a function, immediately\ncalls the function and awaits the returned promise to complete. It will then\ncheck that the promise is not rejected.\n\nIf `asyncFn` is a function and it throws an error synchronously,\n`assert.doesNotReject()` will return a rejected `Promise` with that error. If\nthe function does not return a promise, `assert.doesNotReject()` will return a\nrejected `Promise` with an [`ERR_INVALID_RETURN_VALUE`](errors.html#err_invalid_return_value) error. In both cases\nthe error handler is skipped.\n\nUsing `assert.doesNotReject()` 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.\n\nIf specified, `error` can be a [`Class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes), {RegExp} or a validation\nfunction. See [`assert.throws()`](#assertthrowsfn-error-message) for more details.\n\nAside from asynchronously awaiting completion, it behaves identically to\n[`assert.doesNotThrow()`](#assertdoesnotthrowfn-error-message).\n\n```mjs\nimport assert from 'node:assert/strict';\n\nawait assert.doesNotReject(\n  async () => {\n    throw new TypeError('Wrong value');\n  },\n  SyntaxError,\n);\n```\n\n```cjs\nconst 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```\n\n```mjs\nimport assert from 'node:assert/strict';\n\nassert.doesNotReject(Promise.reject(new TypeError('Wrong value')))\n  .then(() => {\n    // ...\n  });\n```\n\n```cjs\nconst assert = require('node:assert/strict');\n\nassert.doesNotReject(Promise.reject(new TypeError('Wrong value')))\n  .then(() => {\n    // ...\n  });\n```","summary":"Awaits the `asyncFn` promise or, if `asyncFn` is a function, immediately calls the function and awaits the returned promise to complete. It will then check that the promise is not rejected.","examples":[{"language":"mjs","displayName":null,"code":"import assert from 'node:assert/strict';\n\nawait assert.doesNotReject(\n  async () => {\n    throw new TypeError('Wrong value');\n  },\n  SyntaxError,\n);"},{"language":"cjs","displayName":null,"code":"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})();"},{"language":"mjs","displayName":null,"code":"import assert from 'node:assert/strict';\n\nassert.doesNotReject(Promise.reject(new TypeError('Wrong value')))\n  .then(() => {\n    // ...\n  });"},{"language":"cjs","displayName":null,"code":"const assert = require('node:assert/strict');\n\nassert.doesNotReject(Promise.reject(new TypeError('Wrong value')))\n  .then(() => {\n    // ...\n  });"}],"children":[]},{"kind":"method","id":"assertdoesnotthrowfn-error-message","name":"doesNotThrow","title":"`assert.doesNotThrow(fn[, error][, message])`","scope":"module","overloadOf":null,"stability":null,"added":["v0.1.21"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v5.11.0","v4.4.5"],"prUrl":"https://github.com/nodejs/node/pull/2407","commit":null,"description":"The `message` parameter is respected now."},{"versions":["v4.2.0"],"prUrl":"https://github.com/nodejs/node/pull/3276","commit":null,"description":"The `error` parameter can now be an arrow function."}],"signature":{"parameters":[{"name":"fn","type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"error","type":{"text":"RegExp | Function","links":[{"name":"RegExp","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/RegExp","start":0,"end":6},{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":9,"end":17}]},"description":"","default":null,"optional":true,"rest":false,"properties":[]},{"name":"message","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"","default":null,"optional":true,"rest":false,"properties":[]}],"returns":null},"description":"Asserts that the function `fn` does not throw an error.\n\nUsing `assert.doesNotThrow()` 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.\n\nWhen `assert.doesNotThrow()` is called, it will immediately call the `fn`\nfunction.\n\nIf an error is thrown and it is the same type as that specified by the `error`\nparameter, then an [`AssertionError`](#class-assertassertionerror) is thrown. If the error is of a\ndifferent type, or if the `error` parameter is undefined, the error is\npropagated back to the caller.\n\nIf specified, `error` can be a [`Class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes), {RegExp}, or a validation\nfunction. See [`assert.throws()`](#assertthrowsfn-error-message) for more details.\n\nThe following, for instance, will throw the {TypeError} because there is no\nmatching error type in the assertion:\n\n```mjs\nimport assert from 'node:assert/strict';\n\nassert.doesNotThrow(\n  () => {\n    throw new TypeError('Wrong value');\n  },\n  SyntaxError,\n);\n```\n\n```cjs\nconst assert = require('node:assert/strict');\n\nassert.doesNotThrow(\n  () => {\n    throw new TypeError('Wrong value');\n  },\n  SyntaxError,\n);\n```\n\nHowever, the following will result in an [`AssertionError`](#class-assertassertionerror) with the message\n'Got unwanted exception...':\n\n```mjs\nimport assert from 'node:assert/strict';\n\nassert.doesNotThrow(\n  () => {\n    throw new TypeError('Wrong value');\n  },\n  TypeError,\n);\n```\n\n```cjs\nconst assert = require('node:assert/strict');\n\nassert.doesNotThrow(\n  () => {\n    throw new TypeError('Wrong value');\n  },\n  TypeError,\n);\n```\n\nIf an [`AssertionError`](#class-assertassertionerror) is thrown and a value is provided for the `message`\nparameter, the value of `message` will be appended to the [`AssertionError`](#class-assertassertionerror)\nmessage:\n\n```mjs\nimport 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```\n\n```cjs\nconst 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```","summary":"Asserts that the function `fn` does not throw an error.","examples":[{"language":"mjs","displayName":null,"code":"import assert from 'node:assert/strict';\n\nassert.doesNotThrow(\n  () => {\n    throw new TypeError('Wrong value');\n  },\n  SyntaxError,\n);"},{"language":"cjs","displayName":null,"code":"const assert = require('node:assert/strict');\n\nassert.doesNotThrow(\n  () => {\n    throw new TypeError('Wrong value');\n  },\n  SyntaxError,\n);"},{"language":"mjs","displayName":null,"code":"import assert from 'node:assert/strict';\n\nassert.doesNotThrow(\n  () => {\n    throw new TypeError('Wrong value');\n  },\n  TypeError,\n);"},{"language":"cjs","displayName":null,"code":"const assert = require('node:assert/strict');\n\nassert.doesNotThrow(\n  () => {\n    throw new TypeError('Wrong value');\n  },\n  TypeError,\n);"},{"language":"mjs","displayName":null,"code":"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"},{"language":"cjs","displayName":null,"code":"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"}],"children":[]},{"kind":"method","id":"assertequalactual-expected-message","name":"equal","title":"`assert.equal(actual, expected[, message])`","scope":"module","overloadOf":null,"stability":{"index":"3","description":"Legacy: Use [`assert.strictEqual()`](#assertstrictequalactual-expected-message) instead."},"added":["v0.1.21"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v26.0.0"],"prUrl":"https://github.com/nodejs/node/pull/58849","commit":null,"description":"Message may now be a `printf`-like format string or function."},{"versions":["v16.0.0","v14.18.0"],"prUrl":"https://github.com/nodejs/node/pull/38113","commit":null,"description":"In Legacy assertion mode, changed status from Deprecated to Legacy."},{"versions":["v14.0.0"],"prUrl":"https://github.com/nodejs/node/pull/30766","commit":null,"description":"NaN is now treated as being identical if both sides are NaN."}],"signature":{"parameters":[{"name":"actual","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"expected","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"message","type":{"text":"string | Error | Function","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6},{"name":"Error","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error","start":9,"end":14},{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":17,"end":25}]},"description":"","default":null,"optional":true,"rest":false,"properties":[]}],"returns":null},"description":"**Strict assertion mode**\n\nAn alias of [`assert.strictEqual()`](#assertstrictequalactual-expected-message).\n\n**Legacy assertion mode**\n\nTests shallow, coercive equality between the `actual` and `expected` parameters\nusing the [`==` operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Equality). `NaN` is specially handled\nand treated as being identical if both sides are `NaN`.\n\n```mjs\nimport 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```\n\n```cjs\nconst 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```\n\nIf the values are not equal, an [`AssertionError`](#class-assertassertionerror) is thrown with a `message`\nproperty set equal to the value of the `message` parameter. If the `message`\nparameter is undefined, a default error message is assigned. If the `message`\nparameter is an instance of {Error} then it will be thrown instead of the\n`AssertionError`.","summary":"**Strict assertion mode**","examples":[{"language":"mjs","displayName":null,"code":"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 } }"},{"language":"cjs","displayName":null,"code":"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 } }"}],"children":[]},{"kind":"method","id":"assertfailmessage","name":"fail","title":"`assert.fail([message])`","scope":"module","overloadOf":null,"stability":null,"added":["v0.1.21"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"message","type":{"text":"string | Error","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6},{"name":"Error","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error","start":9,"end":14}]},"description":"","default":"'Failed'","optional":true,"rest":false,"properties":[]}],"returns":null},"description":"Throws an [`AssertionError`](#class-assertassertionerror) with the provided error message or a default\nerror message. If the `message` parameter is an instance of {Error} then\nit will be thrown instead of the [`AssertionError`](#class-assertassertionerror).\n\n```mjs\nimport 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```\n\n```cjs\nconst 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```","summary":"Throws an `AssertionError` with the provided error message or a default error message. If the `message` parameter is an instance of {Error} then it will be thrown instead of the `AssertionError`.","examples":[{"language":"mjs","displayName":null,"code":"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"},{"language":"cjs","displayName":null,"code":"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"}],"children":[]},{"kind":"method","id":"assertiferrorvalue","name":"ifError","title":"`assert.ifError(value)`","scope":"module","overloadOf":null,"stability":null,"added":["v0.1.97"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v10.0.0"],"prUrl":"https://github.com/nodejs/node/pull/18247","commit":null,"description":"Instead of throwing the original error it is now wrapped into an [`AssertionError`][] that contains the full stack trace."},{"versions":["v10.0.0"],"prUrl":"https://github.com/nodejs/node/pull/18247","commit":null,"description":"Value may now only be `undefined` or `null`. Before all falsy values were handled the same as `null` and did not throw."}],"signature":{"parameters":[{"name":"value","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":null},"description":"Throws `value` if `value` is not `undefined` or `null`. This is useful when\ntesting the `error` argument in callbacks. The stack trace contains all frames\nfrom the error passed to `ifError()` including the potential new frames for\n`ifError()` itself.\n\n```mjs\nimport 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```\n\n```cjs\nconst 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```","summary":"Throws `value` if `value` is not `undefined` or `null`. This is useful when testing the `error` argument in callbacks. The stack trace contains all frames from the error passed to `ifError()` including the potential new frames for `ifError()` itself.","examples":[{"language":"mjs","displayName":null,"code":"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"},{"language":"cjs","displayName":null,"code":"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"}],"children":[]},{"kind":"method","id":"assertmatchstring-regexp-message","name":"match","title":"`assert.match(string, regexp[, message])`","scope":"module","overloadOf":null,"stability":null,"added":["v13.6.0","v12.16.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v26.0.0"],"prUrl":"https://github.com/nodejs/node/pull/58849","commit":null,"description":"Message may now be a `printf`-like format string or function."},{"versions":["v16.0.0"],"prUrl":"https://github.com/nodejs/node/pull/38111","commit":null,"description":"This API is no longer experimental."}],"signature":{"parameters":[{"name":"string","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"regexp","type":{"text":"RegExp","links":[{"name":"RegExp","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/RegExp","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"message","type":{"text":"string | Error | Function","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6},{"name":"Error","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error","start":9,"end":14},{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":17,"end":25}]},"description":"","default":null,"optional":true,"rest":false,"properties":[]}],"returns":null},"description":"Expects the `string` input to match the regular expression.\n\n```mjs\nimport 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```\n\n```cjs\nconst 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```\n\nIf the values do not match, or if the `string` argument is of another type than\n`string`, an [`AssertionError`](#class-assertassertionerror) is thrown with a `message` property set equal\nto the value of the `message` parameter. If the `message` parameter is\nundefined, a default error message is assigned. If the `message` parameter is an\ninstance of {Error} then it will be thrown instead of the\n[`AssertionError`](#class-assertassertionerror).","summary":"Expects the `string` input to match the regular expression.","examples":[{"language":"mjs","displayName":null,"code":"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"},{"language":"cjs","displayName":null,"code":"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"}],"children":[]},{"kind":"method","id":"assertnotdeepequalactual-expected-message","name":"notDeepEqual","title":"`assert.notDeepEqual(actual, expected[, message])`","scope":"module","overloadOf":null,"stability":{"index":"3","description":"Legacy: Use [`assert.notDeepStrictEqual()`](#assertnotdeepstrictequalactual-expected-message) instead."},"added":["v0.1.21"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v26.0.0"],"prUrl":"https://github.com/nodejs/node/pull/58849","commit":null,"description":"Message may now be a `printf`-like format string or function."},{"versions":["v16.0.0","v14.18.0"],"prUrl":"https://github.com/nodejs/node/pull/38113","commit":null,"description":"In Legacy assertion mode, changed status from Deprecated to Legacy."},{"versions":["v14.0.0"],"prUrl":"https://github.com/nodejs/node/pull/30766","commit":null,"description":"NaN is now treated as being identical if both sides are NaN."},{"versions":["v9.0.0"],"prUrl":"https://github.com/nodejs/node/pull/15001","commit":null,"description":"The `Error` names and messages are now properly compared."},{"versions":["v8.0.0"],"prUrl":"https://github.com/nodejs/node/pull/12142","commit":null,"description":"The `Set` and `Map` content is also compared."},{"versions":["v6.4.0","v4.7.1"],"prUrl":"https://github.com/nodejs/node/pull/8002","commit":null,"description":"Typed array slices are handled correctly now."},{"versions":["v6.1.0","v4.5.0"],"prUrl":"https://github.com/nodejs/node/pull/6432","commit":null,"description":"Objects with circular references can be used as inputs now."},{"versions":["v5.10.1","v4.4.3"],"prUrl":"https://github.com/nodejs/node/pull/5910","commit":null,"description":"Handle non-`Uint8Array` typed arrays correctly."}],"signature":{"parameters":[{"name":"actual","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"expected","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"message","type":{"text":"string | Error | Function","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6},{"name":"Error","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error","start":9,"end":14},{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":17,"end":25}]},"description":"","default":null,"optional":true,"rest":false,"properties":[]}],"returns":null},"description":"**Strict assertion mode**\n\nAn alias of [`assert.notDeepStrictEqual()`](#assertnotdeepstrictequalactual-expected-message).\n\n**Legacy assertion mode**\n\nTests for any deep inequality. Opposite of [`assert.deepEqual()`](#assertdeepequalactual-expected-message).\n\n```mjs\nimport 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```\n\n```cjs\nconst 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```\n\nIf the values are deeply equal, an [`AssertionError`](#class-assertassertionerror) is thrown with a\n`message` property set equal to the value of the `message` parameter. If the\n`message` parameter is undefined, a default error message is assigned. If the\n`message` parameter is an instance of {Error} then it will be thrown\ninstead of the `AssertionError`.","summary":"**Strict assertion mode**","examples":[{"language":"mjs","displayName":null,"code":"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"},{"language":"cjs","displayName":null,"code":"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"}],"children":[]},{"kind":"method","id":"assertnotdeepstrictequalactual-expected-message","name":"notDeepStrictEqual","title":"`assert.notDeepStrictEqual(actual, expected[, message])`","scope":"module","overloadOf":null,"stability":null,"added":["v1.2.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v26.0.0"],"prUrl":"https://github.com/nodejs/node/pull/58849","commit":null,"description":"Message may now be a `printf`-like format string or function."},{"versions":["v9.0.0"],"prUrl":"https://github.com/nodejs/node/pull/15398","commit":null,"description":"The `-0` and `+0` are not considered equal anymore."},{"versions":["v9.0.0"],"prUrl":"https://github.com/nodejs/node/pull/15036","commit":null,"description":"The `NaN` is now compared using the [SameValueZero](https://tc39.github.io/ecma262/#sec-samevaluezero) comparison."},{"versions":["v9.0.0"],"prUrl":"https://github.com/nodejs/node/pull/15001","commit":null,"description":"The `Error` names and messages are now properly compared."},{"versions":["v8.0.0"],"prUrl":"https://github.com/nodejs/node/pull/12142","commit":null,"description":"The `Set` and `Map` content is also compared."},{"versions":["v6.4.0","v4.7.1"],"prUrl":"https://github.com/nodejs/node/pull/8002","commit":null,"description":"Typed array slices are handled correctly now."},{"versions":["v6.1.0"],"prUrl":"https://github.com/nodejs/node/pull/6432","commit":null,"description":"Objects with circular references can be used as inputs now."},{"versions":["v5.10.1","v4.4.3"],"prUrl":"https://github.com/nodejs/node/pull/5910","commit":null,"description":"Handle non-`Uint8Array` typed arrays correctly."}],"signature":{"parameters":[{"name":"actual","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"expected","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"message","type":{"text":"string | Error | Function","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6},{"name":"Error","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error","start":9,"end":14},{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":17,"end":25}]},"description":"","default":null,"optional":true,"rest":false,"properties":[]}],"returns":null},"description":"Tests for deep strict inequality. Opposite of [`assert.deepStrictEqual()`](#assertdeepstrictequalactual-expected-message).\n\n```mjs\nimport assert from 'node:assert/strict';\n\nassert.notDeepStrictEqual({ a: 1 }, { a: '1' });\n// OK\n```\n\n```cjs\nconst assert = require('node:assert/strict');\n\nassert.notDeepStrictEqual({ a: 1 }, { a: '1' });\n// OK\n```\n\nIf the values are deeply and strictly equal, an [`AssertionError`](#class-assertassertionerror) is thrown\nwith a `message` property set equal to the value of the `message` parameter. If\nthe `message` parameter is undefined, a default error message is assigned. If\nthe `message` parameter is an instance of {Error} then it will be thrown\ninstead of the [`AssertionError`](#class-assertassertionerror).","summary":"Tests for deep strict inequality. Opposite of `assert.deepStrictEqual()`.","examples":[{"language":"mjs","displayName":null,"code":"import assert from 'node:assert/strict';\n\nassert.notDeepStrictEqual({ a: 1 }, { a: '1' });\n// OK"},{"language":"cjs","displayName":null,"code":"const assert = require('node:assert/strict');\n\nassert.notDeepStrictEqual({ a: 1 }, { a: '1' });\n// OK"}],"children":[]},{"kind":"method","id":"assertnotequalactual-expected-message","name":"notEqual","title":"`assert.notEqual(actual, expected[, message])`","scope":"module","overloadOf":null,"stability":{"index":"3","description":"Legacy: Use [`assert.notStrictEqual()`](#assertnotstrictequalactual-expected-message) instead."},"added":["v0.1.21"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v26.0.0"],"prUrl":"https://github.com/nodejs/node/pull/58849","commit":null,"description":"Message may now be a `printf`-like format string or function."},{"versions":["v16.0.0","v14.18.0"],"prUrl":"https://github.com/nodejs/node/pull/38113","commit":null,"description":"In Legacy assertion mode, changed status from Deprecated to Legacy."},{"versions":["v14.0.0"],"prUrl":"https://github.com/nodejs/node/pull/30766","commit":null,"description":"NaN is now treated as being identical if both sides are NaN."}],"signature":{"parameters":[{"name":"actual","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"expected","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"message","type":{"text":"string | Error | Function","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6},{"name":"Error","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error","start":9,"end":14},{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":17,"end":25}]},"description":"","default":null,"optional":true,"rest":false,"properties":[]}],"returns":null},"description":"**Strict assertion mode**\n\nAn alias of [`assert.notStrictEqual()`](#assertnotstrictequalactual-expected-message).\n\n**Legacy assertion mode**\n\nTests shallow, coercive inequality with the [`!=` operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Inequality). `NaN` is\nspecially handled and treated as being identical if both sides are `NaN`.\n\n```mjs\nimport 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```\n\n```cjs\nconst 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```\n\nIf the values are equal, an [`AssertionError`](#class-assertassertionerror) is thrown with a `message`\nproperty set equal to the value of the `message` parameter. If the `message`\nparameter is undefined, a default error message is assigned. If the `message`\nparameter is an instance of {Error} then it will be thrown instead of the\n`AssertionError`.","summary":"**Strict assertion mode**","examples":[{"language":"mjs","displayName":null,"code":"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'"},{"language":"cjs","displayName":null,"code":"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'"}],"children":[]},{"kind":"method","id":"assertnotstrictequalactual-expected-message","name":"notStrictEqual","title":"`assert.notStrictEqual(actual, expected[, message])`","scope":"module","overloadOf":null,"stability":null,"added":["v0.1.21"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v26.0.0"],"prUrl":"https://github.com/nodejs/node/pull/58849","commit":null,"description":"Message may now be a `printf`-like format string or function."},{"versions":["v10.0.0"],"prUrl":"https://github.com/nodejs/node/pull/17003","commit":null,"description":"Used comparison changed from Strict Equality to `Object.is()`."}],"signature":{"parameters":[{"name":"actual","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"expected","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"message","type":{"text":"string | Error | Function","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6},{"name":"Error","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error","start":9,"end":14},{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":17,"end":25}]},"description":"","default":null,"optional":true,"rest":false,"properties":[]}],"returns":null},"description":"Tests strict inequality between the `actual` and `expected` parameters as\ndetermined by [`Object.is()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is).\n\n```mjs\nimport 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```\n\n```cjs\nconst 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```\n\nIf the values are strictly equal, an [`AssertionError`](#class-assertassertionerror) is thrown with a\n`message` property set equal to the value of the `message` parameter. If the\n`message` parameter is undefined, a default error message is assigned. If the\n`message` parameter is an instance of {Error} then it will be thrown\ninstead of the `AssertionError`.","summary":"Tests strict inequality between the `actual` and `expected` parameters as determined by `Object.is()`.","examples":[{"language":"mjs","displayName":null,"code":"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"},{"language":"cjs","displayName":null,"code":"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"}],"children":[]},{"kind":"method","id":"assertokvalue-message","name":"ok","title":"`assert.ok(value[, message])`","scope":"module","overloadOf":null,"stability":null,"added":["v0.1.21"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v26.0.0"],"prUrl":"https://github.com/nodejs/node/pull/58849","commit":null,"description":"Message may now be a `printf`-like format string or function."},{"versions":["v10.0.0"],"prUrl":"https://github.com/nodejs/node/pull/18319","commit":null,"description":"The `assert.ok()` (no arguments) will now use a predefined error message."}],"signature":{"parameters":[{"name":"value","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"message","type":{"text":"string | Error | Function","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6},{"name":"Error","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error","start":9,"end":14},{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":17,"end":25}]},"description":"","default":null,"optional":true,"rest":false,"properties":[]}],"returns":null},"description":"Tests if `value` is truthy. It is equivalent to\n`assert.equal(!!value, true, message)`.\n\nIf `value` is not truthy, an [`AssertionError`](#class-assertassertionerror) is thrown with a `message`\nproperty set equal to the value of the `message` parameter. If the `message`\nparameter is `undefined`, a default error message is assigned. If the `message`\nparameter is an instance of {Error} then it will be thrown instead of the\n`AssertionError`.\nIf no arguments are passed in at all `message` will be set to the string:\n``'No value argument passed to `assert.ok()`'``.\n\nBe aware that in the `repl` the error message will be different to the one\nthrown in a file! See below for further details.\n\n```mjs\nimport 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```\n\n```cjs\nconst 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```\n\n```mjs\nimport 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```\n\n```cjs\nconst 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```","summary":"Tests if `value` is truthy. It is equivalent to `assert.equal(!!value, true, message)`.","examples":[{"language":"mjs","displayName":null,"code":"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)"},{"language":"cjs","displayName":null,"code":"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)"},{"language":"mjs","displayName":null,"code":"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)"},{"language":"cjs","displayName":null,"code":"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)"}],"children":[]},{"kind":"method","id":"assertrejectsasyncfn-error-message","name":"rejects","title":"`assert.rejects(asyncFn[, error][, message])`","scope":"module","overloadOf":null,"stability":null,"added":["v10.0.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"asyncFn","type":{"text":"Function | Promise","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8},{"name":"Promise","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise","start":11,"end":18}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"error","type":{"text":"RegExp | Function | Object | Error","links":[{"name":"RegExp","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/RegExp","start":0,"end":6},{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":9,"end":17},{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":20,"end":26},{"name":"Error","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error","start":29,"end":34}]},"description":"","default":null,"optional":true,"rest":false,"properties":[]},{"name":"message","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"","default":null,"optional":true,"rest":false,"properties":[]}],"returns":{"type":{"text":"Promise","links":[{"name":"Promise","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise","start":0,"end":7}]},"description":""}},"description":"Awaits the `asyncFn` promise or, if `asyncFn` is a function, immediately\ncalls the function and awaits the returned promise to complete. It will then\ncheck that the promise is rejected.\n\nIf `asyncFn` is a function and it throws an error synchronously,\n`assert.rejects()` will return a rejected `Promise` with that error. If the\nfunction does not return a promise, `assert.rejects()` will return a rejected\n`Promise` with an [`ERR_INVALID_RETURN_VALUE`](errors.html#err_invalid_return_value) error. In both cases the error\nhandler is skipped.\n\nBesides the async nature to await the completion behaves identically to\n[`assert.throws()`](#assertthrowsfn-error-message).\n\nIf specified, `error` can be a [`Class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes), {RegExp}, 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 `message` and\n`name` properties.\n\nIf specified, `message` will be the message provided by the [`AssertionError`](#class-assertassertionerror)\nif the `asyncFn` fails to reject.\n\n```mjs\nimport 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```\n\n```cjs\nconst 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```\n\n```mjs\nimport 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```\n\n```cjs\nconst 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```\n\n```mjs\nimport assert from 'node:assert/strict';\n\nassert.rejects(\n  Promise.reject(new Error('Wrong value')),\n  Error,\n).then(() => {\n  // ...\n});\n```\n\n```cjs\nconst assert = require('node:assert/strict');\n\nassert.rejects(\n  Promise.reject(new Error('Wrong value')),\n  Error,\n).then(() => {\n  // ...\n});\n```\n\n`error` cannot be a string. If a string is provided as the second\nargument, then `error` is assumed to be omitted and the string will be used for\n`message` instead. This can lead to easy-to-miss mistakes. Please read the\nexample in [`assert.throws()`](#assertthrowsfn-error-message) carefully if using a string as the second\nargument gets considered.","summary":"Awaits the `asyncFn` promise or, if `asyncFn` is a function, immediately calls the function and awaits the returned promise to complete. It will then check that the promise is rejected.","examples":[{"language":"mjs","displayName":null,"code":"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);"},{"language":"cjs","displayName":null,"code":"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})();"},{"language":"mjs","displayName":null,"code":"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);"},{"language":"cjs","displayName":null,"code":"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})();"},{"language":"mjs","displayName":null,"code":"import assert from 'node:assert/strict';\n\nassert.rejects(\n  Promise.reject(new Error('Wrong value')),\n  Error,\n).then(() => {\n  // ...\n});"},{"language":"cjs","displayName":null,"code":"const assert = require('node:assert/strict');\n\nassert.rejects(\n  Promise.reject(new Error('Wrong value')),\n  Error,\n).then(() => {\n  // ...\n});"}],"children":[]},{"kind":"method","id":"assertstrictequalactual-expected-message","name":"strictEqual","title":"`assert.strictEqual(actual, expected[, message])`","scope":"module","overloadOf":null,"stability":null,"added":["v0.1.21"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v26.0.0"],"prUrl":"https://github.com/nodejs/node/pull/58849","commit":null,"description":"Message may now be a `printf`-like format string or function."},{"versions":["v10.0.0"],"prUrl":"https://github.com/nodejs/node/pull/17003","commit":null,"description":"Used comparison changed from Strict Equality to `Object.is()`."}],"signature":{"parameters":[{"name":"actual","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"expected","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"message","type":{"text":"string | Error | Function","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6},{"name":"Error","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error","start":9,"end":14},{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":17,"end":25}]},"description":"Postfix `printf`-like arguments in case\nit's used as format string.\nIf message is a function, it is called in case of a comparison failure. The\nfunction receives the `actual` and `expected` arguments and has to return a\nstring that is going to be used as error message.\n`printf`-like format strings and functions are beneficial for performance\nreasons in case arguments are passed through. In addition, it allows nice\nformatting with ease.","default":null,"optional":true,"rest":false,"properties":[]}],"returns":null},"description":"Tests strict equality between the `actual` and `expected` parameters as\ndetermined by [`Object.is()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is).\n\n```mjs\nimport 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```\n\n```cjs\nconst 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```\n\nIf the values are not strictly equal, an [`AssertionError`](#class-assertassertionerror) is thrown with a\n`message` property set equal to the value of the `message` parameter. If the\n`message` parameter is undefined, a default error message is assigned. If the\n`message` parameter is an instance of {Error} then it will be thrown\ninstead of the [`AssertionError`](#class-assertassertionerror).","summary":"Tests strict equality between the `actual` and `expected` parameters as determined by `Object.is()`.","examples":[{"language":"mjs","displayName":null,"code":"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"},{"language":"cjs","displayName":null,"code":"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"}],"children":[]},{"kind":"method","id":"assertthrowsfn-error-message","name":"throws","title":"`assert.throws(fn[, error][, message])`","scope":"module","overloadOf":null,"stability":null,"added":["v0.1.21"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v10.2.0"],"prUrl":"https://github.com/nodejs/node/pull/20485","commit":null,"description":"The `error` parameter can be an object containing regular expressions now."},{"versions":["v9.9.0"],"prUrl":"https://github.com/nodejs/node/pull/17584","commit":null,"description":"The `error` parameter can now be an object as well."},{"versions":["v4.2.0"],"prUrl":"https://github.com/nodejs/node/pull/3276","commit":null,"description":"The `error` parameter can now be an arrow function."}],"signature":{"parameters":[{"name":"fn","type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"error","type":{"text":"RegExp | Function | Object | Error","links":[{"name":"RegExp","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/RegExp","start":0,"end":6},{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":9,"end":17},{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":20,"end":26},{"name":"Error","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error","start":29,"end":34}]},"description":"","default":null,"optional":true,"rest":false,"properties":[]},{"name":"message","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"","default":null,"optional":true,"rest":false,"properties":[]}],"returns":null},"description":"Expects the function `fn` to throw an error.\n\nIf specified, `error` can be a [`Class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes), {RegExp}, 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 `message` and `name` properties. When\nusing an object, it is also possible to use a regular expression, when\nvalidating against a string property. See below for examples.\n\nIf specified, `message` will be appended to the message provided by the\n`AssertionError` if the `fn` call fails to throw or in case the error validation\nfails.\n\nCustom validation object/error instance:\n\n```mjs\nimport 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```\n\n```cjs\nconst 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```\n\nValidate instanceof using constructor:\n\n```mjs\nimport assert from 'node:assert/strict';\n\nassert.throws(\n  () => {\n    throw new Error('Wrong value');\n  },\n  Error,\n);\n```\n\n```cjs\nconst assert = require('node:assert/strict');\n\nassert.throws(\n  () => {\n    throw new Error('Wrong value');\n  },\n  Error,\n);\n```\n\nValidate error message using {RegExp}:\n\nUsing a regular expression runs `.toString` on the error object, and will\ntherefore also include the error name.\n\n```mjs\nimport assert from 'node:assert/strict';\n\nassert.throws(\n  () => {\n    throw new Error('Wrong value');\n  },\n  /^Error: Wrong value$/,\n);\n```\n\n```cjs\nconst assert = require('node:assert/strict');\n\nassert.throws(\n  () => {\n    throw new Error('Wrong value');\n  },\n  /^Error: Wrong value$/,\n);\n```\n\nCustom error validation:\n\nThe function must return `true` to indicate all internal validations passed.\nIt will otherwise fail with an [`AssertionError`](#class-assertassertionerror).\n\n```mjs\nimport 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```\n\n```cjs\nconst 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```\n\n`error` cannot be a string. If a string is provided as the second\nargument, then `error` is assumed to be omitted and the string will be used for\n`message` 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`ERR_AMBIGUOUS_ARGUMENT` error. Please read the example below carefully if using\na string as the second argument gets considered:\n\n```mjs\nimport 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```\n\n```cjs\nconst 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```\n\nDue to the confusing error-prone notation, avoid a string as the second\nargument.","summary":"Expects the function `fn` to throw an error.","examples":[{"language":"mjs","displayName":null,"code":"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);"},{"language":"cjs","displayName":null,"code":"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);"},{"language":"mjs","displayName":null,"code":"import assert from 'node:assert/strict';\n\nassert.throws(\n  () => {\n    throw new Error('Wrong value');\n  },\n  Error,\n);"},{"language":"cjs","displayName":null,"code":"const assert = require('node:assert/strict');\n\nassert.throws(\n  () => {\n    throw new Error('Wrong value');\n  },\n  Error,\n);"},{"language":"mjs","displayName":null,"code":"import assert from 'node:assert/strict';\n\nassert.throws(\n  () => {\n    throw new Error('Wrong value');\n  },\n  /^Error: Wrong value$/,\n);"},{"language":"cjs","displayName":null,"code":"const assert = require('node:assert/strict');\n\nassert.throws(\n  () => {\n    throw new Error('Wrong value');\n  },\n  /^Error: Wrong value$/,\n);"},{"language":"mjs","displayName":null,"code":"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);"},{"language":"cjs","displayName":null,"code":"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);"},{"language":"mjs","displayName":null,"code":"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]"},{"language":"cjs","displayName":null,"code":"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]"}],"children":[]},{"kind":"method","id":"assertpartialdeepstrictequalactual-expected-message","name":"partialDeepStrictEqual","title":"`assert.partialDeepStrictEqual(actual, expected[, message])`","scope":"module","overloadOf":null,"stability":null,"added":["v23.4.0","v22.13.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v25.0.0"],"prUrl":"https://github.com/nodejs/node/pull/59448","commit":null,"description":"Promises are not considered equal anymore if they are not of the same instance."},{"versions":["v25.0.0"],"prUrl":"https://github.com/nodejs/node/pull/57627","commit":null,"description":"Invalid dates are now considered equal."},{"versions":["v24.0.0","v22.17.0"],"prUrl":"https://github.com/nodejs/node/pull/57370","commit":null,"description":"partialDeepStrictEqual is now Stable. Previously, it had been Experimental."}],"signature":{"parameters":[{"name":"actual","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"expected","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"message","type":{"text":"string | Error | Function","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6},{"name":"Error","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error","start":9,"end":14},{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":17,"end":25}]},"description":"","default":null,"optional":true,"rest":false,"properties":[]}],"returns":null},"description":"Tests for partial deep equality between the `actual` and `expected` 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 `expected` parameter are going to be\ncompared.\n\nThis method always passes the same test cases as [`assert.deepStrictEqual()`](#assertdeepstrictequalactual-expected-message),\nbehaving as a super set of it.","summary":"Tests for partial deep equality between the `actual` and `expected` parameters. \"Deep\" equality means that the enumerable \"own\" properties of child objects are recursively evaluated also by the following rules. \"Partial\" equality means that only properties that exist on the `expected` parameter are going to be compared.","examples":[],"children":[{"kind":"section","id":"comparison-details-2","name":"Comparison details","title":"Comparison details","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"* Primitive values are compared using [`Object.is()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is).\n* [Type tags](https://tc39.github.io/ecma262/#sec-object.prototype.tostring) of objects should be the same.\n* [`[[Prototype]]`](https://tc39.github.io/ecma262/#sec-ordinary-object-internal-methods-and-internal-slots) of objects are not compared.\n* Only [enumerable \"own\" properties](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Enumerability_and_ownership_of_properties) are considered.\n* {Error} names, messages, causes, and errors are always compared,\n  even if these are not enumerable properties.\n  `errors` is also compared.\n* Enumerable own {Symbol} properties are compared as well.\n* [Object wrappers](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Data_structures#primitive_values) are compared both as objects and unwrapped values.\n* `Object` properties are compared unordered.\n* {Map} keys and {Set} items are compared unordered.\n* Recursion stops when both sides differ or both sides encounter a circular\n  reference.\n* {WeakMap}, {WeakSet} and {Promise} instances are **not** compared\n  structurally. They are only equal if they reference the same object. Any\n  comparison between different `WeakMap`, `WeakSet`, or `Promise` instances\n  will result in inequality, even if they contain the same content.\n* {RegExp} lastIndex, flags, and source are always compared, even if these\n  are not enumerable properties.\n* Holes in sparse arrays are ignored.\n\n```mjs\nimport 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```\n\n```cjs\nconst 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```","summary":"","examples":[{"language":"mjs","displayName":null,"code":"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"},{"language":"cjs","displayName":null,"code":"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"}],"children":[]}]}]}