File tree Expand file tree Collapse file tree 3 files changed +11
-7
lines changed
test/applicationcomposer/messageHandlers Expand file tree Collapse file tree 3 files changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -67,10 +67,10 @@ export { extensionVersion }
6767 *
6868 * @param throwWhen Throw if minimum vscode is equal or later than this version.
6969 */
70- export function isMinVscode ( throwWhen ?: string ) : boolean {
70+ export function isMinVscode ( options ?: { throwWhen : string } ) : boolean {
7171 const minVscode = getMinVscodeVersion ( )
72- if ( throwWhen && semver . gte ( minVscode , throwWhen ) ) {
73- throw Error ( `Min vscode ${ minVscode } >= ${ throwWhen } . Delete or update the code that called this.` )
72+ if ( options ?. throwWhen && semver . gte ( minVscode , options . throwWhen ) ) {
73+ throw Error ( `Min vscode ${ minVscode } >= ${ options . throwWhen } . Delete or update the code that called this.` )
7474 }
7575 return vscode . version . startsWith ( getMinVscodeVersion ( ) )
7676}
Original file line number Diff line number Diff line change @@ -8,11 +8,11 @@ import sinon from 'sinon'
88import { createTemplate , createWebviewContext } from '../utils'
99import { generateResourceHandler } from '../../../applicationcomposer/messageHandlers/generateResourceHandler'
1010import { Command , MessageType } from '../../../applicationcomposer/types'
11- import * as env from '../../../shared/vscode/env'
11+ import { isMinVscode } from '../../../shared/vscode/env'
1212
1313describe ( 'generateResourceHandler' , function ( ) {
1414 it ( 'amazon q is not installed' , async function ( ) {
15- if ( env . isMinVscode ( '1.89.0' ) ) {
15+ if ( isMinVscode ( { throwWhen : '1.89.0' } ) ) {
1616 this . skip ( )
1717 }
1818 const panel = await createTemplate ( )
Original file line number Diff line number Diff line change @@ -7,13 +7,17 @@ import assert from 'assert'
77import sinon from 'sinon'
88import { initMessageHandler } from '../../../applicationcomposer/messageHandlers/initMessageHandler'
99import { createTemplate , createWebviewContext } from '../utils'
10+ import { isMinVscode } from '../../../shared/vscode/env'
1011
1112describe ( 'initMessageHandler' , function ( ) {
12- afterEach ( ( ) => {
13+ afterEach ( function ( ) {
1314 sinon . restore ( )
1415 } )
1516
16- it ( 'not connected to codewhisperer' , async ( ) => {
17+ it ( 'not connected to codewhisperer' , async function ( ) {
18+ if ( isMinVscode ( { throwWhen : '1.89.0' } ) ) {
19+ this . skip ( )
20+ }
1721 const panel = await createTemplate ( )
1822 const postMessageSpy = sinon . spy ( panel . webview , 'postMessage' )
1923 const context = await createWebviewContext ( {
You can’t perform that action at this time.
0 commit comments