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 <anna@addaleax.net>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
  • Loading branch information
Trott authored and codebytere committed Jan 13, 2019
1 parent e0a2a6d commit 3ff3238
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 3ff3238

Please sign in to comment.