From 99104e1b586b5a34c3548a24bc6dcfd7a9331294 Mon Sep 17 00:00:00 2001 From: jkzing Date: Sun, 16 Jul 2017 16:59:34 +0800 Subject: [PATCH] test: improve fs.exists coverage MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit By adding a test case using a path with illegal protocol PR-URL: https://github.com/nodejs/node/pull/14301 Reviewed-By: James M Snell Reviewed-By: Benjamin Gruenbaum Reviewed-By: Colin Ihrig Reviewed-By: Tobias Nießen Reviewed-By: Gireesh Punathil Reviewed-By: Gibson Fahnestock --- test/parallel/test-fs-exists.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/parallel/test-fs-exists.js b/test/parallel/test-fs-exists.js index 071f85fc81e1c1..b19aa387741a70 100644 --- a/test/parallel/test-fs-exists.js +++ b/test/parallel/test-fs-exists.js @@ -23,6 +23,7 @@ const common = require('../common'); const assert = require('assert'); const fs = require('fs'); +const { URL } = require('url'); const f = __filename; fs.exists(f, common.mustCall(function(y) { @@ -33,5 +34,9 @@ fs.exists(`${f}-NO`, common.mustCall(function(y) { assert.strictEqual(y, false); })); +fs.exists(new URL('https://foo'), common.mustCall(function(y) { + assert.strictEqual(y, false); +})); + assert(fs.existsSync(f)); assert(!fs.existsSync(`${f}-NO`));