Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix(which): use indexOf (#657)
  • Loading branch information
termosa committed Jul 15, 2018
commit ce705425948bae09095e1ee7eb007389dfc3ab6b
2 changes: 2 additions & 0 deletions src/which.js
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh sorry, I must have missed this. This should go in an test.afterEach.always block. Example:

shelljs/test/exec.js

Lines 14 to 17 in 6d66a1a

test.afterEach.always(() => {
process.chdir(CWD);
shell.config.execPath = ORIG_EXEC_PATH;
});

This shouldn't block this change. I added a comment to #834 to track this.

});