Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAntoine du Hamel <duhamelantoine1995@gmail.com>2022-05-02 20:46:24 +0300
committerRafaelGSS <rafael.nunu@hotmail.com>2022-05-10 15:13:16 +0300
commite74a8da287329d5d1901b698029ef6c2dc75c5fd (patch)
tree9517f028e325ad673192894d4789e95015861e14 /test
parent88692d8fd617b8d5225bde447e448fcb2b933e76 (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.js6
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;