@@ -18,7 +18,6 @@ import { expect, it, describe } from '@jest/globals';
1818import * as path from 'path' ;
1919import * as manifest from '../manifest' ;
2020import { ExtensionContext } from 'vscode' ;
21- import * as vscode from 'vscode' ;
2221import { SolutionConverterImpl } from './solution-converter' ;
2322import { MockOutputChannelProvider , outputChannelProviderFactory } from '../vscode-api/output-channel-provider.factories' ;
2423import { MockConfigurationProvider , configurationProviderFactory } from '../vscode-api/configuration-provider.factories' ;
@@ -339,6 +338,7 @@ describe('SolutionConverter', () => {
339338 expect ( completedListener ) . toHaveBeenCalledTimes ( 1 ) ;
340339 expect ( completedListener ) . toHaveBeenLastCalledWith (
341340 expect . objectContaining ( {
341+ severity : 'error' ,
342342 toolsOutputMessages : expect . arrayContaining ( [
343343 'warning cbuild: missing ZEPHYR_BASE environment variable' ,
344344 'error cbuild: exec: "west": executable file not found in $PATH' ,
@@ -429,11 +429,7 @@ describe('SolutionConverter', () => {
429429 } ) ;
430430 } ) ;
431431
432- it ( 'creates diagnostic when cpackget fails to download a pack' , async ( ) => {
433- const diagnosticCollection = vscode . languages . createDiagnosticCollection ( ) ;
434- const mockDiagnosticsCollectionSet = jest . spyOn ( diagnosticCollection , 'set' ) as unknown as jest . MockedFunction <
435- ( uri : vscode . Uri , diagnostics : readonly vscode . Diagnostic [ ] | undefined ) => void
436- > ;
432+ it ( 'reports error severity when cpackget fails to download a pack' , async ( ) => {
437433 jest . spyOn ( cmsisToolboxManager , 'runCmsisTool' ) . mockImplementation ( async ( _t , _a , onOutput ) => {
438434 onOutput ( 'W: retry failed' ) ;
439435 onOutput ( 'E: network timeout' ) ;
@@ -444,10 +440,16 @@ describe('SolutionConverter', () => {
444440
445441 await fireAndWaitForConversion ( ) ;
446442
447- expect ( mockDiagnosticsCollectionSet ) . toHaveBeenCalledTimes ( 1 ) ;
448- const [ [ , diagnostics ] ] = mockDiagnosticsCollectionSet . mock . calls ;
449- expect ( diagnostics ?. [ 0 ] ?. message ) . toContain ( 'network timeout' ) ;
450- expect ( diagnostics ?. [ 0 ] ?. message ) . toContain ( 'retry failed' ) ;
443+ expect ( completedListener ) . toHaveBeenCalledWith (
444+ expect . objectContaining ( {
445+ severity : 'error' ,
446+ toolsOutputMessages : expect . arrayContaining ( [
447+ expect . stringContaining ( "error cpackget: downloading pack 'VendorA::PackA@1.0.0' failed" ) ,
448+ expect . stringContaining ( 'network timeout' ) ,
449+ expect . stringContaining ( 'retry failed' ) ,
450+ ] ) ,
451+ } )
452+ ) ;
451453 } ) ;
452454
453455} ) ;
0 commit comments