File tree 4 files changed +33
-15
lines changed
4 files changed +33
-15
lines changed Original file line number Diff line number Diff line change @@ -87,21 +87,12 @@ calculateHashes pkg modul targetTypes canonical interfaces inDebug = do
87
87
88
88
if List. length errors > 0
89
89
then
90
- let
91
- -- !x = onlyWhen inDebug $ formatHaskellValue "diffHasErrors:" typediffs :: IO ()
92
-
93
- notifyWarnings =
94
- if List. length warnings > 0 then
95
- [ D. reflow $ " Warning: also, a number of types outside Types.elm are referenced, see `lamdera check` for more info." ]
96
- else
97
- []
98
- in
99
90
Left $
100
91
Exit. BuildLamderaProblem " WIRE ISSUES"
101
- " I ran into the following problems when checking Lamdera core types: "
92
+ " I found one or more Route Modules with Data types that contain functions. "
102
93
(formattedErrors ++
103
94
[ D. reflow " See <https://dashboard.lamdera.app/docs/wire> for more info."
104
- ] ++ notifyWarnings )
95
+ ])
105
96
106
97
else do
107
98
Right (hashes, warnings)
@@ -546,13 +537,24 @@ diffableTypeErrors dtype =
546
537
case dtype of
547
538
DRecord fields ->
548
539
fields
549
- & fmap (\ (n, tipe) -> diffableTypeErrors tipe)
540
+ & fmap (\ (n, tipe) -> do
541
+ let errors = diffableTypeErrors tipe
542
+ case errors of
543
+ [] -> []
544
+ xs -> errors & fmap (\ err -> " { " <> n <> " } " <> err )
545
+ )
550
546
& List. concat
551
547
552
548
DCustom name constructors ->
553
549
constructors
554
550
& fmap (\ (n, params) ->
555
- fmap diffableTypeErrors params
551
+ params
552
+ & fmap (\ param -> do
553
+ let errors = diffableTypeErrors param
554
+ case errors of
555
+ [] -> []
556
+ xs -> errors & fmap (\ err -> n <> " " <> err)
557
+ )
556
558
& List. concat
557
559
)
558
560
& List. concat
Original file line number Diff line number Diff line change @@ -82,7 +82,8 @@ makeDev root path = do
82
82
absRoot <- Dir. makeAbsolute root
83
83
84
84
r <- async $
85
- Dir. withCurrentDirectory absRoot $
85
+ Dir. withCurrentDirectory absRoot $ do
86
+ touch path
86
87
Make. run [path] $
87
88
Make. Flags
88
89
{ _debug = True
Original file line number Diff line number Diff line change 2
2
3
3
module Test.Ext.ElmPages.Check where
4
4
5
+ import qualified Data.Text as T
6
+
5
7
import EasyTest
6
8
import Test.Helpers
7
9
@@ -14,9 +16,13 @@ all = EasyTest.run suite
14
16
suite :: Test ()
15
17
suite = tests $
16
18
[ scope " isWireCompatible" $ do
17
- actual <- catchOutput $
19
+ io $ setEnv " LDEBUG" " 1"
20
+
21
+ actual <- catchOutputStdErr $
18
22
Lamdera.Compile. makeDev " ./test/scenario-elm-pages-incompatible-wire/.elm-pages" " Main.elm"
19
23
24
+ io $ atomicPutStrLn $ T. unpack actual
25
+
20
26
expectTextContains actual
21
27
" PageData:\\ n\\ n- must not contain functions"
22
28
]
Original file line number Diff line number Diff line change @@ -3,11 +3,13 @@ module Test.Helpers where
3
3
import System.Environment (setEnv , unsetEnv , lookupEnv )
4
4
import System.FilePath ((</>) )
5
5
import Data.Text as T
6
+ import qualified Data.Text.Encoding as T
6
7
7
8
import EasyTest
8
9
9
10
import Lamdera
10
11
import Test.Main (captureProcessResult )
12
+ import qualified Test.Main
11
13
12
14
13
15
aggressiveCacheClear :: FilePath -> IO ()
@@ -59,3 +61,10 @@ catchOutput action = do
59
61
pr <- io $ captureProcessResult action
60
62
-- @TODO improve this to actually pull out values
61
63
pure $ show_ pr
64
+
65
+ catchOutputStdErr :: IO () -> Test Text
66
+ catchOutputStdErr action = do
67
+ -- https://hackage.haskell.org/package/main-tester-0.2.0.1/docs/Test-Main.html
68
+ pr <- io $ captureProcessResult action
69
+ -- @TODO improve this to actually pull out values
70
+ pure $ T. decodeUtf8 $ Test.Main. prStderr pr
You can’t perform that action at this time.
0 commit comments