Skip to content

Commit

Permalink
test: make test-runner-assert more robust
Browse files Browse the repository at this point in the history
PR-URL: #55036
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
  • Loading branch information
Aviv Keller authored and marco-ippolito committed Nov 16, 2024
1 parent 153fcc2 commit 6cd773e
Showing 1 changed file with 8 additions and 20 deletions.
28 changes: 8 additions & 20 deletions test/parallel/test-runner-assert.js
Original file line number Diff line number Diff line change
@@ -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) => {
Expand Down

0 comments on commit 6cd773e

Please sign in to comment.