2024-05-20 12:49:15 -04:00
|
|
|
'use strict';
|
|
|
|
require('../common');
|
2024-09-22 18:27:36 -04:00
|
|
|
const assert = require('node:assert');
|
2024-05-20 12:49:15 -04:00
|
|
|
const test = require('node:test');
|
|
|
|
|
2024-11-19 12:37:35 -05:00
|
|
|
test('expected methods are on t.assert', (t) => {
|
|
|
|
const uncopiedKeys = [
|
|
|
|
'AssertionError',
|
|
|
|
'strict',
|
|
|
|
];
|
|
|
|
const assertKeys = Object.keys(assert).filter((key) => !uncopiedKeys.includes(key));
|
2025-01-09 16:12:17 -05:00
|
|
|
const expectedKeys = ['snapshot', 'fileSnapshot'].concat(assertKeys).sort();
|
2024-09-22 18:27:36 -04:00
|
|
|
assert.deepStrictEqual(Object.keys(t.assert).sort(), expectedKeys);
|
2024-05-20 12:49:15 -04:00
|
|
|
});
|
2024-09-15 11:53:18 -04:00
|
|
|
|
|
|
|
test('t.assert.ok correctly parses the stacktrace', (t) => {
|
|
|
|
t.assert.throws(() => t.assert.ok(1 === 2), /t\.assert\.ok\(1 === 2\)/);
|
|
|
|
});
|