Skip to content

Commit

Permalink
test: add information to assertion
Browse files Browse the repository at this point in the history
test-fs-stat-bigint.js failed once in CI but there wasn't enough
information to know what was giong on. Adding a bit of information to
the assertion that failed in case it fails again.

PR-URL: #24566
Refs: #24565
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Daniel Bevenius <[email protected]>
  • Loading branch information
Trott authored and codebytere committed Jan 29, 2019
1 parent b41ce99 commit a98470e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion test/parallel/test-fs-stat-bigint.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const promiseFs = require('fs').promises;
const path = require('path');
const tmpdir = require('../common/tmpdir');
const { isDate } = require('util').types;
const { inspect } = require('util');

tmpdir.refresh();

Expand Down Expand Up @@ -62,7 +63,11 @@ function verifyStats(bigintStats, numStats) {
assert.strictEqual(bigintStats[key], undefined);
assert.strictEqual(numStats[key], undefined);
} else if (Number.isSafeInteger(val)) {
assert.strictEqual(bigintStats[key], BigInt(val));
assert.strictEqual(
bigintStats[key], BigInt(val),
`${inspect(bigintStats[key])} !== ${inspect(BigInt(val))}\n` +
`key=${key}, val=${val}`
);
} else {
assert(
Math.abs(Number(bigintStats[key]) - val) < 1,
Expand Down

0 comments on commit a98470e

Please sign in to comment.