From 43bbca2c08f375118291b7c046a58890eb3af2c8 Mon Sep 17 00:00:00 2001 From: Aviv Keller Date: Sun, 22 Sep 2024 18:27:36 -0400 Subject: [PATCH] test: make `test-runner-assert` more robust PR-URL: https://github.com/nodejs/node/pull/55036 Reviewed-By: James M Snell Reviewed-By: Colin Ihrig Reviewed-By: Chemi Atlow --- test/parallel/test-runner-assert.js | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/test/parallel/test-runner-assert.js b/test/parallel/test-runner-assert.js index 51c6ee67ebe4d3..8052a0fd84ac32 100644 --- a/test/parallel/test-runner-assert.js +++ b/test/parallel/test-runner-assert.js @@ -1,28 +1,16 @@ 'use strict'; require('../common'); -const { deepStrictEqual } = require('node:assert'); +const assert = require('node:assert'); const test = require('node:test'); +const uncopiedKeys = [ + 'AssertionError', + 'CallTracker', + 'strict', +]; test('only methods from node:assert are on t.assert', (t) => { - deepStrictEqual(Object.keys(t.assert).sort(), [ - 'deepEqual', - 'deepStrictEqual', - 'doesNotMatch', - 'doesNotReject', - 'doesNotThrow', - 'equal', - 'fail', - 'ifError', - 'match', - 'notDeepEqual', - 'notDeepStrictEqual', - 'notEqual', - 'notStrictEqual', - 'ok', - 'rejects', - 'strictEqual', - 'throws', - ]); + const expectedKeys = Object.keys(assert).filter((key) => !uncopiedKeys.includes(key)).sort(); + assert.deepStrictEqual(Object.keys(t.assert).sort(), expectedKeys); }); test('t.assert.ok correctly parses the stacktrace', (t) => {