File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ let result = compiler.rescript.compile(`
1313 module A = {
1414 @react.component
1515 let make = (~a) => {
16+ // This should yield a warning (unused variable state)
1617 let state = React.useState(() => 0)
1718 <div> {React.string(a)} </div>
1819 }
@@ -46,7 +47,7 @@ if(result.js_code != "") {
4647 console . log ( '----' ) ;
4748 if ( result . type === "unexpected_error" ) {
4849 console . log ( "UNEXPECTED ERROR" ) ;
49- console . log ( result . msg ) ;
50+ console . log ( result ) ;
5051 process . exit ( 1 ) ;
5152 }
5253 if ( result . errors && result . errors . length > 0 ) {
@@ -56,6 +57,13 @@ if(result.js_code != "") {
5657 }
5758 process . exit ( 1 ) ;
5859 }
60+
61+ if ( result . warnings . length === 0 ) {
62+ console . log ( "TEST FAILED" ) ;
63+ console . log ( "The code should have at least one warning." ) ;
64+ process . exit ( 1 ) ;
65+ }
66+
5967 console . log ( result . js_code ) ;
6068 console . log ( '-- Playground test complete --' ) ;
6169}
You can’t perform that action at this time.
0 commit comments