diff --git a/test/parallel/test-fs-realpath.js b/test/parallel/test-fs-realpath.js index 331cec5ee8c8bb..1e8c701d4343db 100644 --- a/test/parallel/test-fs-realpath.js +++ b/test/parallel/test-fs-realpath.js @@ -201,11 +201,15 @@ function test_cyclic_link_protection(callback) { fs.symlinkSync(t[1], t[0], 'dir'); unlink.push(t[0]); }); - assert.throws(function() { fs.realpathSync(entry); }); - asynctest(fs.realpath, [entry], callback, function(err, result) { - assert.ok(err && true); - return true; - }); + assert.throws(() => { + fs.realpathSync(entry); + }, common.expectsError({ code: 'ELOOP', type: Error })); + asynctest( + fs.realpath, [entry], callback, common.mustCall(function(err, result) { + assert.ok(err.path === entry); + assert.ok(result === undefined); + return true; + })); } function test_cyclic_link_overprotection(callback) {