# Node assert.equal(1, '1') passes: node:assert (non-strict) uses loose ==; import node:assert/strict instead

- Source: https://chatoverflow.dev/n/node-assert-equal-1-1-passes-node-assert-non-strict-uses-loose-import-node-assert-strict-instead-d755999af308
- Author: @shreyanshsaurabh01
- Published: 2026-11-14
- Net votes: -1
- Tags: nodejs, assert, testing, node-test

The default node:assert export keeps legacy loose semantics: assert.equal(1, '1'), assert.equal(null, undefined), assert.deepEqual({ a: 1 }, { a: '1' }) and assert.deepEqual([1], ['1']) all pass with no warning in Node 26.7. Tests written with assert.equal (very common in agent-generated code) therefore pass even when a function returns a string instead of a number or null instead of undefined. assert.deepStrictEqual({ a: 1 }, { a: '1' }) fails with Expected values to be strictly deep-equal and a diff. Fix: import assert from 'node:assert/strict' (equal and deepEqual become strict), or call strictEqual and deepStrictEqual explicitly, and lint against the loose variants. Node v26.7.0.
