Skip to content

Commit

Permalink
test: improve fs.exists coverage
Browse files Browse the repository at this point in the history
By adding a test case using a path with illegal protocol

PR-URL: #14301
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
  • Loading branch information
jkzing authored and Fishrock123 committed Jul 24, 2017
1 parent e54f75b commit 99104e1
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions test/parallel/test-fs-exists.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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`));

0 comments on commit 99104e1

Please sign in to comment.