Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
16 changes: 8 additions & 8 deletions os/env/path-extender-posix/path-extender-posix.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -980,10 +980,10 @@ describe('Fish', () => {
process.env.SHELL = '/bin/fish'
})
beforeEach(() => {
configFile = path.join(homeDir, '.config/fish/config.fish')
configFile = path.join(homeDir, '.config/fish/conf.d/pnpm.fish')
})
it('should append to empty shell script', async () => {
fs.mkdirSync('.config/fish', { recursive: true })
fs.mkdirSync('.config/fish/conf.d', { recursive: true })
fs.writeFileSync(configFile, '', 'utf8')
const report = await addDirToPosixEnvPath(pnpmHomeDir, {
proxyVarName: 'PNPM_HOME',
Expand Down Expand Up @@ -1011,7 +1011,7 @@ end
`)
})
it('should append to shell script with proxyVarSubDir', async () => {
fs.mkdirSync('.config/fish', { recursive: true })
fs.mkdirSync('.config/fish/conf.d', { recursive: true })
fs.writeFileSync(configFile, '', 'utf8')
const report = await addDirToPosixEnvPath(pnpmHomeDir, {
proxyVarName: 'PNPM_HOME',
Expand Down Expand Up @@ -1040,7 +1040,7 @@ end
`)
})
it('should append to empty shell script without using a proxy varialbe', async () => {
fs.mkdirSync('.config/fish', { recursive: true })
fs.mkdirSync('.config/fish/conf.d', { recursive: true })
fs.writeFileSync(configFile, '', 'utf8')
const report = await addDirToPosixEnvPath(pnpmHomeDir, {
configSectionName: 'pnpm',
Expand All @@ -1065,7 +1065,7 @@ end
`)
})
it('should add the new dir to the end of PATH', async () => {
fs.mkdirSync('.config/fish', { recursive: true })
fs.mkdirSync('.config/fish/conf.d', { recursive: true })
fs.writeFileSync(configFile, '', 'utf8')
const report = await addDirToPosixEnvPath(pnpmHomeDir, {
proxyVarName: 'PNPM_HOME',
Expand Down Expand Up @@ -1119,7 +1119,7 @@ end
`)
})
it('should make no changes to a shell script that already has the necessary configurations', async () => {
fs.mkdirSync('.config/fish', { recursive: true })
fs.mkdirSync('.config/fish/conf.d', { recursive: true })
fs.writeFileSync(configFile, `
# pnpm
set -gx PNPM_HOME "${pnpmHomeDir}"
Expand Down Expand Up @@ -1155,7 +1155,7 @@ end
# pnpm end`)
})
it('should fail if the shell already has PNPM_HOME set to a different directory', async () => {
fs.mkdirSync('.config/fish', { recursive: true })
fs.mkdirSync('.config/fish/conf.d', { recursive: true })
fs.writeFileSync(configFile, `
# pnpm
set -gx PNPM_HOME "pnpm_home"
Expand All @@ -1169,7 +1169,7 @@ set -gx PATH "$PNPM_HOME" $PATH
).rejects.toThrowError(/The config file at/)
})
it('should not fail if setup is forced', async () => {
fs.mkdirSync('.config/fish', { recursive: true })
fs.mkdirSync('.config/fish/conf.d', { recursive: true })
fs.writeFileSync(configFile, `
# pnpm
set -gx PNPM_HOME "pnpm_home"
Expand Down
2 changes: 1 addition & 1 deletion os/env/path-extender-posix/path-extender-posix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ function createPathValue (position: AddingPosition, dir: string) {
}

async function setupFishShell (dir: string, opts: AddDirToPosixEnvPathOpts): Promise<PathExtenderPosixReport> {
const configFile = path.join(os.homedir(), '.config/fish/config.fish')
const configFile = path.join(os.homedir(), '.config/fish/conf.d/pnpm.fish')
let newSettings!: string
const _createPathValue = createFishPathValue.bind(null, opts.position ?? 'start')
if (opts.proxyVarName) {
Expand Down