assert.notStrictEqual()

添加版本:1.0.0.

描述

notStrictEqual( actual, expected, message = "" )

严格比较,检查不等式。

名称 描述
实际 正在测试的表达式
预期 已知比较值
message (字符串) 简短描述

notStrictEqual 断言使用严格的反向比较运算符 (!==) 来比较实际和预期参数。当它们不相等时,断言通过;否则,它失败。当它失败时,实际值和预期值都会显示在测试结果中,以及给定的消息。

assert.equal() 可用于测试相等性。

assert.strictEqual() 可用于测试严格相等性。

示例

QUnit.test('example', assert => {
  const result = '2';

  // succeeds, while the number 2 and string 2 are similar, they are strictly different.
  assert.notStrictEqual(result, 2);
});