File tree Expand file tree Collapse file tree 4 files changed +37
-21
lines changed Expand file tree Collapse file tree 4 files changed +37
-21
lines changed Original file line number Diff line number Diff line change @@ -5,19 +5,23 @@ cd ../testrepo
55
66bold " Test: It should compile"
77
8- if rewatch clean & > /dev/null;
8+ error_output=$( rewatch clean 2>&1 )
9+ if [ $? -eq 0 ];
910then
1011 success " Repo Cleaned"
1112else
1213 error " Error Cleaning Repo"
14+ printf " %s\n" " $error_output " >&2
1315 exit 1
1416fi
1517
16- if rewatch & > /dev/null;
18+ error_output=$( rewatch 2>&1 )
19+ if [ $? -eq 0 ];
1720then
1821 success " Repo Built"
1922else
2023 error " Error Building Repo"
24+ printf " %s\n" " $error_output " >&2
2125 exit 1
2226fi
2327
Original file line number Diff line number Diff line change @@ -5,15 +5,17 @@ bold "Test: It should lock - when watching"
55
66sleep 1
77
8- if rewatch clean & > /dev/null;
8+ error_output=$( rewatch clean 2>&1 )
9+ if [ $? -eq 0 ];
910then
1011 success " Repo Cleaned"
11- else
12+ else
1213 error " Error Cleaning Repo"
14+ printf " %s\n" " $error_output " >&2
1315 exit 1
1416fi
1517
16- exit_watcher () {
18+ exit_watcher () {
1719 # kill watcher by removing lock file
1820 rm lib/rewatch.lock
1921}
@@ -23,11 +25,11 @@ success "Watcher Started"
2325
2426sleep 2
2527
26- if rewatch build | grep ' Could not start Rewatch:' & > /dev/null;
28+ if rewatch build | grep ' Could not start Rewatch:' & > /dev/null;
2729then
2830 success " Lock is correctly set"
2931 exit_watcher
30- else
32+ else
3133 error " Not setting lock correctly"
3234 exit_watcher
3335 exit 1
@@ -41,7 +43,7 @@ success "Watcher Started"
4143
4244sleep 2
4345
44- if cat tmp.txt | grep ' Could not start Rewatch:' & > /dev/null;
46+ if cat tmp.txt | grep ' Could not start Rewatch:' & > /dev/null;
4547then
4648 error " Lock not removed correctly"
4749 exit_watcher
Original file line number Diff line number Diff line change @@ -5,22 +5,26 @@ bold "Test: It should support custom suffixes"
55
66# Clean Repo
77sleep 1
8- if rewatch clean & > /dev/null;
8+ error_output=$( rewatch clean 2>&1 )
9+ if [ $? -eq 0 ];
910then
1011 success " Repo Cleaned"
1112else
1213 error " Error Cleaning Repo"
14+ printf " %s\n" " $error_output " >&2
1315 exit 1
1416fi
1517
1618# Replace suffix
1719replace " s/.mjs/.res.js/g" bsconfig.json
1820
19- if rewatch build & > /dev/null;
21+ error_output=$( rewatch build 2>&1 )
22+ if [ $? -eq 0 ];
2023then
2124 success " Repo Built"
2225else
23- error " Error building repo"
26+ error " Error Building Repo"
27+ printf " %s\n" " $error_output " >&2
2428 exit 1
2529fi
2630
3539 exit 1
3640fi
3741
38- if rewatch clean & > /dev/null;
42+ error_output=$( rewatch clean 2>&1 )
43+ if [ $? -eq 0 ];
3944then
4045 success " Repo Cleaned"
4146else
4247 error " Error Cleaning Repo"
48+ printf " %s\n" " $error_output " >&2
4349 exit 1
4450fi
4551
4652# Restore Suffix
4753replace " s/.res.js/.mjs/g" bsconfig.json
4854
4955# Restore original build
50- if rewatch build & > /dev/null;
56+ error_output=$( rewatch build 2>&1 )
57+ if [ $? -eq 0 ];
5158then
5259 success " Repo Built"
5360else
54- error " Error building repo"
61+ error " Error Building Repo"
62+ printf " %s\n" " $error_output " >&2
5563 exit 1
5664fi
Original file line number Diff line number Diff line change @@ -3,15 +3,17 @@ cd ../testrepo
33
44bold " Test: It should watch"
55
6- if rewatch clean & > /dev/null;
6+ error_output=$( rewatch clean 2>&1 )
7+ if [ $? -eq 0 ];
78then
89 success " Repo Cleaned"
9- else
10+ else
1011 error " Error Cleaning Repo"
12+ printf " %s\n" " $error_output " >&2
1113 exit 1
1214fi
1315
14- exit_watcher () {
16+ exit_watcher () {
1517 # kill watcher by removing lock file
1618 rm lib/rewatch.lock
1719}
@@ -23,10 +25,10 @@ echo 'Js.log("added-by-test")' >> ./packages/main/src/Main.res
2325
2426sleep 2
2527
26- if node ./packages/main/src/Main.mjs | grep ' added-by-test' & > /dev/null;
28+ if node ./packages/main/src/Main.mjs | grep ' added-by-test' & > /dev/null;
2729then
2830 success " Output is correct"
29- else
31+ else
3032 error " Output is incorrect"
3133 exit_watcher
3234 exit 1
@@ -38,10 +40,10 @@ replace '/Js.log("added-by-test")/d' ./packages/main/src/Main.res;
3840
3941sleep 1
4042
41- if git diff --exit-code ./
43+ if git diff --exit-code ./
4244then
4345 success " Adding and removing changes nothing"
44- else
46+ else
4547 error " Adding and removing changes left some artifacts"
4648 exit_watcher
4749 exit 1
You can’t perform that action at this time.
0 commit comments