@@ -13,7 +13,7 @@ import {
1313 LibraryService ,
1414} from '../../common/protocol' ;
1515import { ArduinoDaemonImpl } from '../../node/arduino-daemon-impl' ;
16- import { CLI_CONFIG } from '../../node/cli-config' ;
16+ import { CLI_CONFIG , DefaultCliConfig } from '../../node/cli-config' ;
1717import { BoardListRequest } from '../../node/cli-protocol/cc/arduino/cli/commands/v1/board_pb' ;
1818import { CoreClientProvider } from '../../node/core-client-provider' ;
1919import { ConfigDirUriProvider } from '../../node/theia/env-variables/env-variables-server' ;
@@ -45,6 +45,20 @@ describe('core-client-provider', () => {
4545 } ) ;
4646 } ) ;
4747
48+ [ 'it' , 'de' ] . map ( ( [ locale ] ) =>
49+ it ( `should recover from the missing 'directories.data' independently from the CLI locale: '${ locale } '` , async function ( ) {
50+ this . timeout ( timeout ) ;
51+ const configDirPath = await prepareTestConfigDir ( { locale } ) ;
52+
53+ const container = await startCli ( configDirPath , toDispose ) ;
54+ await assertFunctionalCli ( container , ( { coreClientProvider } ) => {
55+ const { indexUpdateSummaryBeforeInit } = coreClientProvider ;
56+ expect ( indexUpdateSummaryBeforeInit ) . to . be . not . undefined ;
57+ expect ( indexUpdateSummaryBeforeInit ) . to . be . empty ;
58+ } ) ;
59+ } )
60+ ) ;
61+
4862 it ( "should recover all when the 'directories.data' folder is missing" , async function ( ) {
4963 this . timeout ( timeout ) ;
5064 const configDirPath = await prepareTestConfigDir ( ) ;
@@ -157,7 +171,7 @@ describe('core-client-provider', () => {
157171 ) . to . be . equal ( 1 ) ;
158172 } ;
159173 const configDirPath = await prepareTestConfigDir (
160- additionalUrls ,
174+ { board_manager : { additional_urls : additionalUrls } } ,
161175 ( { boardsService } ) => assertTeensyAvailable ( boardsService )
162176 ) ;
163177 const thirdPartyPackageIndexPath = join (
@@ -252,11 +266,11 @@ async function assertFunctionalCli(
252266 * the config folder.
253267 */
254268async function prepareTestConfigDir (
255- additionalUrls : string [ ] = [ ] ,
269+ configOverrides : Partial < DefaultCliConfig > = { } ,
256270 otherExpect ?: ( services : Services ) => MaybePromise < void >
257271) : Promise < string > {
258272 const toDispose = new DisposableCollection ( ) ;
259- const params = { configDirPath : newTempConfigDirPath ( ) , additionalUrls } ;
273+ const params = { configDirPath : newTempConfigDirPath ( ) , configOverrides } ;
260274 const container = await createContainer ( params ) ;
261275 try {
262276 await start ( container , toDispose ) ;
@@ -304,13 +318,13 @@ async function start(
304318
305319async function createContainer (
306320 params :
307- | { configDirPath : string ; additionalUrls : string [ ] }
321+ | { configDirPath : string ; configOverrides : Partial < DefaultCliConfig > }
308322 | string = newTempConfigDirPath ( )
309323) : Promise < Container > {
310324 if ( typeof params === 'string' ) {
311325 return createBaseContainer ( { configDirPath : params } ) ;
312326 }
313- const { configDirPath, additionalUrls } = params ;
314- const cliConfig = await createCliConfig ( configDirPath , additionalUrls ) ;
327+ const { configDirPath, configOverrides } = params ;
328+ const cliConfig = await createCliConfig ( configDirPath , configOverrides ) ;
315329 return createBaseContainer ( { configDirPath, cliConfig } ) ;
316330}
0 commit comments