@@ -121,6 +121,9 @@ doWriteNewExpectedTest expectedJsDir filePath =
121121 case formattedResult of
122122 Right (Compiler.Result _ _ js) ->
123123 do createDirectoryIfMissing True (dropFileName expectedFilePath)
124+ -- Force the evaluation of "js" before "writeFile"
125+ -- so that if an error is raised we do not write an empty file.
126+ assertBool "Error: no content generated" (length js > 0)
124127 writeFile expectedFilePath js
125128 assertFailure ("Wrote new expected js: " ++ expectedFilePath)
126129