Skip to content

Commit

Permalink
(bugfix): fix Vercel deployment workflow (#750)
Browse files Browse the repository at this point in the history
  • Loading branch information
christian-bromann authored Jul 31, 2023
1 parent b448e1e commit 192e85f
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/extension/executors/vercel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,5 +117,5 @@ export async function handleVercelDeployOutput(
}

export function isVercelDeployScript(script: string): boolean {
return script.trim().endsWith('vercel')
return Boolean(script.split(';').pop()?.trim() === 'vercel')
}
25 changes: 25 additions & 0 deletions tests/extension/executors/vercel.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { test, expect, vi } from 'vitest'

import { isVercelDeployScript } from '../../../src/extension/executors/vercel.js'

vi.mock('vscode')
vi.mock('vscode-telemetry')
vi.mock('../../../src/extension/executors/task.js', () => ({
bash: vi.fn(),
sh: vi.fn()
}))
vi.mock('../../../src/extension/executors/vercel/index.js', () => ({
deploy: vi.fn(),
login: vi.fn(),
logout: vi.fn()
}))
vi.mock('../../../src/extension/cell.js', () => ({
NotebookCellOutputManager: vi.fn(),
updateCellMetadata: vi.fn()
}))

test('isVercelDeployScript', () => {
expect(isVercelDeployScript('set -e -o pipefail; npm i -g vercel')).toBe(false)
expect(isVercelDeployScript('set -e -o pipefail; vercel login')).toBe(false)
expect(isVercelDeployScript('set -e -o pipefail; vercel')).toBe(true)
})

0 comments on commit 192e85f

Please sign in to comment.