@@ -342,3 +342,27 @@ func TestCompileWithEsp8266BundledLibraries(t *testing.T) {
342
342
}
343
343
require .NotContains (t , string (stdout ), expectedOutput [0 ]+ "\n " + expectedOutput [1 ]+ "\n " + expectedOutput [2 ]+ "\n " )
344
344
}
345
+
346
+ func TestGenerateCompileCommandsJsonResilience (t * testing.T ) {
347
+ env , cli := integrationtest .CreateArduinoCLIWithEnvironment (t )
348
+ defer env .CleanUp ()
349
+
350
+ _ , _ , err := cli .Run ("update" )
351
+ require .NoError (t , err )
352
+
353
+ // check it didn't fail with esp32@2.0.1 that has a prebuild hook that must run:
354
+ // https://github.com/arduino/arduino-cli/issues/1547
355
+ url := "https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json"
356
+ _ , _ , err = cli .Run ("core" , "update-index" , "--additional-urls=" + url )
357
+ require .NoError (t , err )
358
+ _ , _ , err = cli .Run ("core" , "install" , "esp32:esp32@2.0.1" , "--additional-urls=" + url )
359
+ require .NoError (t , err )
360
+ sketchPath := cli .CopySketch ("sketch_simple" )
361
+ _ , _ , err = cli .Run ("compile" , "-b" , "esp32:esp32:featheresp32" , "--only-compilation-database" , sketchPath .String ())
362
+ require .NoError (t , err )
363
+
364
+ // check it didn't fail on a sketch with a missing include
365
+ sketchPath = cli .CopySketch ("sketch_with_missing_include" )
366
+ _ , _ , err = cli .Run ("compile" , "-b" , "esp32:esp32:featheresp32" , "--only-compilation-database" , sketchPath .String ())
367
+ require .NoError (t , err )
368
+ }
0 commit comments