Skip to content

Commit

Permalink
Merge master into feature/emr
Browse files Browse the repository at this point in the history
  • Loading branch information
aws-toolkit-automation authored Nov 12, 2024
2 parents 89fa698 + 82ee006 commit ef9453e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
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

0 comments on commit ef9453e

Please sign in to comment.