diff options
author | Antoine du Hamel <duhamelantoine1995@gmail.com> | 2022-05-02 20:46:24 +0300 |
---|---|---|
committer | RafaelGSS <rafael.nunu@hotmail.com> | 2022-05-10 15:13:16 +0300 |
commit | e74a8da287329d5d1901b698029ef6c2dc75c5fd (patch) | |
tree | 9517f028e325ad673192894d4789e95015861e14 /test | |
parent | 88692d8fd617b8d5225bde447e448fcb2b933e76 (diff) |
assert: make `assert.fail` less affected by prototype tampering
PR-URL: https://github.com/nodejs/node/pull/42918
Reviewed-By: Michaƫl Zasso <targos@protonmail.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/parallel/test-assert-fail.js | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/test/parallel/test-assert-fail.js b/test/parallel/test-assert-fail.js index e2003f2ce91..37e2087a2fd 100644 --- a/test/parallel/test-assert-fail.js +++ b/test/parallel/test-assert-fail.js @@ -1,6 +1,6 @@ 'use strict'; -require('../common'); +const common = require('../common'); const assert = require('assert'); // No args @@ -38,3 +38,7 @@ assert.throws(() => { name: 'TypeError', message: 'custom message' }); + +Object.prototype.get = common.mustNotCall(); +assert.throws(() => assert.fail(''), { code: 'ERR_ASSERTION' }); +delete Object.prototype.get; |