Skip to content
This repository has been archived by the owner on Sep 1, 2022. It is now read-only.

Commit

Permalink
fix: use correct fish_user_paths env variable (#356)
Browse files Browse the repository at this point in the history
  • Loading branch information
iamogbz authored Apr 6, 2019
1 parent 3b8a9a8 commit 033b460
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/util/path.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const getPathDelimiter = shell => {

export const getCurrentPath = shell => {
if (isFishShell(shell)) {
return process.env.FISH_USER_PATHS || ''
return process.env.fish_user_paths || ''
}
return process.env.PATH || ''
}
Expand Down
2 changes: 1 addition & 1 deletion test/commands/current.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe('yvm current command', () => {
)
})
it('fails if fish environment path is not available', async () => {
delete process.env.FISH_USER_PATHS
delete process.env.fish_user_paths
expect(await current({ shell: 'fish' })).toBe(1)
expect(log).toHaveBeenCalledWith(
expect.stringContaining(`PATH not found`),
Expand Down
12 changes: 6 additions & 6 deletions test/util/alias.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,26 +72,26 @@ describe('alias', () => {

it('gets first non yvm yarn executable in fish shell', async () => {
const yvmPath = '/Users/tophat/.yvm'
const oldPath = process.env.FISH_USER_PATHS
process.env.FISH_USER_PATHS = `${yvmPath}/versions/v1.13.0/bin /usr/local/bin:`
const oldPath = process.env.fish_user_paths
process.env.fish_user_paths = `${yvmPath}/versions/v1.13.0/bin /usr/local/bin:`
childProcess.execSync.mockReturnValueOnce('1.14.0')
expect(
await alias.resolveSystem({ shell: 'fish', yvmPath }),
).toEqual('1.14.0')
expect(childProcess.execSync).toHaveBeenCalledWith(
expect.stringContaining('usr/local/bin/yarn'),
)
process.env.FISH_USER_PATHS = oldPath
process.env.fish_user_paths = oldPath
})

it('returns nothing if yarn not found in fish user path', async () => {
const oldPath = process.env.FISH_USER_PATHS
process.env.FISH_USER_PATHS =
const oldPath = process.env.fish_user_paths
process.env.fish_user_paths =
'/Users/tophat/.nvm/versions/node/v6.11.5/bin '
expect(
await alias.resolveSystem({ shell: 'fish', yvmPath }),
).toEqual(alias.NOT_AVAILABLE)
process.env.FISH_USER_PATHS = oldPath
process.env.fish_user_paths = oldPath
})
})

Expand Down

0 comments on commit 033b460

Please sign in to comment.