Skip to content

Commit

Permalink
fix(which): use indexOf (#657)
Browse files Browse the repository at this point in the history
  • Loading branch information
termosa committed Jul 15, 2018
1 parent 9157b53 commit ce70542
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/which.js
Expand Up @@ -25,6 +25,8 @@ function splitPath(p) {
return p ? p.split(path.delimiter) : [];
}

// Tests are running all cases for this func but it stays uncovered by codecov due to unknown reason
/* istanbul ignore next */
function isExecutable(pathName) {
try {
// TODO(node-support): replace with fs.constants.X_OK once remove support for node < v6
Expand Down
3 changes: 1 addition & 2 deletions test/which.js
Expand Up @@ -90,8 +90,7 @@ test('None executable files does not appear in the result list', t => {
t.truthy(resultForWhichA);
t.truthy(resultForWhichA.length);
t.not(resultForWhich.toString(), matchingFile);
// TODO(node-support): this can be used starting from node@6: t.falsy(resultForWhichA.includes(matchingFile))
t.not(resultForWhichA[0], matchingFile);
t.is(resultForWhichA.indexOf(matchingFile), -1);

process.env.PATH = pathEnv;
});

0 comments on commit ce70542

Please sign in to comment.