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 <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Chemi Atlow <[email protected]>
  • Loading branch information
RedYetiDev authored Sep 22, 2024
1 parent 1c61a83 commit 8b70e6b
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 8b70e6b

Please sign in to comment.