Skip to content
Merged
Show file tree
Hide file tree
Changes from 13 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
6 changes: 3 additions & 3 deletions packages/core/src/shared/vscode/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ export { extensionVersion }
*
* @param throwWhen Throw if minimum vscode is equal or later than this version.
*/
export function isMinVscode(throwWhen?: string): boolean {
export function isMinVscode(options: { throwWhen: string }): boolean {
const minVscode = getMinVscodeVersion()
if (throwWhen && semver.gte(minVscode, throwWhen)) {
throw Error(`Min vscode ${minVscode} >= ${throwWhen}. Delete or update the code that called this.`)
if (options.throwWhen && semver.gte(minVscode, options.throwWhen)) {
throw Error(`Min vscode ${minVscode} >= ${options.throwWhen}. Delete or update the code that called this.`)
}
return vscode.version.startsWith(getMinVscodeVersion())
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import sinon from 'sinon'
import { createTemplate, createWebviewContext } from '../utils'
import { generateResourceHandler } from '../../../applicationcomposer/messageHandlers/generateResourceHandler'
import { Command, MessageType } from '../../../applicationcomposer/types'
import * as env from '../../../shared/vscode/env'
import { isMinVscode } from '../../../shared/vscode/env'

describe('generateResourceHandler', function () {
it('amazon q is not installed', async function () {
if (env.isMinVscode('1.89.0')) {
if (isMinVscode({ throwWhen: '1.89.0' })) {
this.skip()
}
const panel = await createTemplate()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,17 @@ import assert from 'assert'
import sinon from 'sinon'
import { initMessageHandler } from '../../../applicationcomposer/messageHandlers/initMessageHandler'
import { createTemplate, createWebviewContext } from '../utils'
import { isMinVscode } from '../../../shared/vscode/env'

describe('initMessageHandler', function () {
afterEach(() => {
afterEach(function () {
sinon.restore()
})

it('not connected to codewhisperer', async () => {
it('not connected to codewhisperer', async function () {
if (isMinVscode({ throwWhen: '1.89.0' })) {
this.skip()
}
const panel = await createTemplate()
const postMessageSpy = sinon.spy(panel.webview, 'postMessage')
const context = await createWebviewContext({
Expand Down
Loading