diff --git a/lib/internal/fs/utils.js b/lib/internal/fs/utils.js index 703a79371d867d2..2d85ed2196529d9 100644 --- a/lib/internal/fs/utils.js +++ b/lib/internal/fs/utils.js @@ -723,7 +723,7 @@ const validatePath = hideStackFrames((path, propName = 'path', options) => { const pathIsString = typeof path === 'string'; const pathIsUint8Array = isUint8Array(path); - if (options && options.expectFile) { + if (options?.expectFile) { const lastCharacter = path[path.length - 1]; if ( lastCharacter === '/' || lastCharacter === 47 || diff --git a/test/sequential/test-fs-path-dir.js b/test/sequential/test-fs-path-dir.js index 8ba5e59fdc290ec..fd44c19ff333e45 100644 --- a/test/sequential/test-fs-path-dir.js +++ b/test/sequential/test-fs-path-dir.js @@ -77,7 +77,7 @@ function checkPromiseFn(promiseFn, p, args, fail) { console.log(failMsg, err); throw err; }); - if (r && r.close) r.close(); + r?.close?.(); } else { assert.rejects( promiseFn(p, ...args), {