assert.strictEqual()

version added: 1.0.0.

Description

strictEqual( actual, expected, message = "" )

A strict type and value comparison.

name description
actual Expression being tested
expected Known comparison value
message (string) Short description of the actual expression

The strictEqual() assertion provides the most rigid comparison of type and value with the strict equality operator (===).

assert.equal() can be used to test non-strict equality.

assert.notStrictEqual() can be used to explicitly test strict inequality.

Changelog

  • Prior to QUnit 1.1, this method was known as assert.same().
    The alias was removed in QUnit 1.3.

Examples

Compare the value of two primitives, having the same value and type.

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

  assert.strictEqual(result, 2);
});