严格断言模式


🌐 Strict assertion mode

版本历史
版本变更
v15.0.0

Exposed as require('node:assert/strict').

v13.9.0, v12.16.2

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".

v9.9.0

Added error diffs to the strict assertion mode.

v9.9.0

Added strict assertion mode to the assert module.

v9.9.0

新增于: v9.9.0

在严格断言模式下,非严格方法的行为就像它们对应的严格方法。例如,assert.deepEqual() 的行为将像 assert.deepStrictEqual() 一样。

🌐 In strict assertion mode, non-strict methods behave like their corresponding strict methods. For example, assert.deepEqual() will behave like assert.deepStrictEqual().

在严格断言模式下,对象的错误消息会显示差异。在传统断言模式下,对象的错误消息会显示对象,通常会被截断。

🌐 In strict assertion mode, error messages for objects display a diff. In legacy assertion mode, error messages for objects display the objects, often truncated.

AltStyle によって変換されたページ (->オリジナル) /