@@ -22,6 +22,7 @@ import (
22
22
"github.com/arduino/go-paths-helper"
23
23
"github.com/arduino/go-properties-orderedmap"
24
24
"github.com/stretchr/testify/require"
25
+ "go.bug.st/testifyjson/requirejson"
25
26
)
26
27
27
28
func TestRuntimeToolPropertiesGeneration (t * testing.T ) {
@@ -96,3 +97,22 @@ func TestCompileBuildPathInsideSketch(t *testing.T) {
96
97
_ , _ , err = cli .Run ("compile" , "-b" , "arduino:avr:mega" , "--build-path" , "build-mega" )
97
98
require .NoError (t , err )
98
99
}
100
+
101
+ func TestCompilerErrOutput (t * testing.T ) {
102
+ env , cli := integrationtest .CreateArduinoCLIWithEnvironment (t )
103
+ defer env .CleanUp ()
104
+
105
+ // Run update-index with our test index
106
+ _ ,
_ ,
err := cli .
Run (
"core" ,
"install" ,
"arduino:[email protected] " )
107
+ require .NoError (t , err )
108
+
109
+ // prepare sketch
110
+ sketch , err := paths .New ("testdata" , "blink_with_wrong_cpp" ).Abs ()
111
+ require .NoError (t , err )
112
+
113
+ // Run compile and catch err stream
114
+ out , _ , err := cli .Run ("compile" , "-b" , "arduino:avr:uno" , "--format" , "json" , sketch .String ())
115
+ require .Error (t , err )
116
+ compilerErr := requirejson .Parse (t , out ).Query (".compiler_err" )
117
+ compilerErr .MustContain (`"error"` )
118
+ }
0 commit comments