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
5
5
6
6
bold " Test: It should compile"
7
7
8
- if rewatch clean & > /dev/null;
8
+ error_output=$( rewatch clean 2>&1 )
9
+ if [ $? -eq 0 ];
9
10
then
10
11
success " Repo Cleaned"
11
12
else
12
13
error " Error Cleaning Repo"
14
+ printf " %s\n" " $error_output " >&2
13
15
exit 1
14
16
fi
15
17
16
- if rewatch & > /dev/null;
18
+ error_output=$( rewatch 2>&1 )
19
+ if [ $? -eq 0 ];
17
20
then
18
21
success " Repo Built"
19
22
else
20
23
error " Error Building Repo"
24
+ printf " %s\n" " $error_output " >&2
21
25
exit 1
22
26
fi
23
27
Original file line number Diff line number Diff line change @@ -5,15 +5,17 @@ bold "Test: It should lock - when watching"
5
5
6
6
sleep 1
7
7
8
- if rewatch clean & > /dev/null;
8
+ error_output=$( rewatch clean 2>&1 )
9
+ if [ $? -eq 0 ];
9
10
then
10
11
success " Repo Cleaned"
11
- else
12
+ else
12
13
error " Error Cleaning Repo"
14
+ printf " %s\n" " $error_output " >&2
13
15
exit 1
14
16
fi
15
17
16
- exit_watcher () {
18
+ exit_watcher () {
17
19
# kill watcher by removing lock file
18
20
rm lib/rewatch.lock
19
21
}
@@ -23,11 +25,11 @@ success "Watcher Started"
23
25
24
26
sleep 2
25
27
26
- if rewatch build | grep ' Could not start Rewatch:' & > /dev/null;
28
+ if rewatch build | grep ' Could not start Rewatch:' & > /dev/null;
27
29
then
28
30
success " Lock is correctly set"
29
31
exit_watcher
30
- else
32
+ else
31
33
error " Not setting lock correctly"
32
34
exit_watcher
33
35
exit 1
@@ -41,7 +43,7 @@ success "Watcher Started"
41
43
42
44
sleep 2
43
45
44
- if cat tmp.txt | grep ' Could not start Rewatch:' & > /dev/null;
46
+ if cat tmp.txt | grep ' Could not start Rewatch:' & > /dev/null;
45
47
then
46
48
error " Lock not removed correctly"
47
49
exit_watcher
Original file line number Diff line number Diff line change @@ -5,22 +5,26 @@ bold "Test: It should support custom suffixes"
5
5
6
6
# Clean Repo
7
7
sleep 1
8
- if rewatch clean & > /dev/null;
8
+ error_output=$( rewatch clean 2>&1 )
9
+ if [ $? -eq 0 ];
9
10
then
10
11
success " Repo Cleaned"
11
12
else
12
13
error " Error Cleaning Repo"
14
+ printf " %s\n" " $error_output " >&2
13
15
exit 1
14
16
fi
15
17
16
18
# Replace suffix
17
19
replace " s/.mjs/.res.js/g" bsconfig.json
18
20
19
- if rewatch build & > /dev/null;
21
+ error_output=$( rewatch build 2>&1 )
22
+ if [ $? -eq 0 ];
20
23
then
21
24
success " Repo Built"
22
25
else
23
- error " Error building repo"
26
+ error " Error Building Repo"
27
+ printf " %s\n" " $error_output " >&2
24
28
exit 1
25
29
fi
26
30
35
39
exit 1
36
40
fi
37
41
38
- if rewatch clean & > /dev/null;
42
+ error_output=$( rewatch clean 2>&1 )
43
+ if [ $? -eq 0 ];
39
44
then
40
45
success " Repo Cleaned"
41
46
else
42
47
error " Error Cleaning Repo"
48
+ printf " %s\n" " $error_output " >&2
43
49
exit 1
44
50
fi
45
51
46
52
# Restore Suffix
47
53
replace " s/.res.js/.mjs/g" bsconfig.json
48
54
49
55
# Restore original build
50
- if rewatch build & > /dev/null;
56
+ error_output=$( rewatch build 2>&1 )
57
+ if [ $? -eq 0 ];
51
58
then
52
59
success " Repo Built"
53
60
else
54
- error " Error building repo"
61
+ error " Error Building Repo"
62
+ printf " %s\n" " $error_output " >&2
55
63
exit 1
56
64
fi
Original file line number Diff line number Diff line change @@ -3,15 +3,17 @@ cd ../testrepo
3
3
4
4
bold " Test: It should watch"
5
5
6
- if rewatch clean & > /dev/null;
6
+ error_output=$( rewatch clean 2>&1 )
7
+ if [ $? -eq 0 ];
7
8
then
8
9
success " Repo Cleaned"
9
- else
10
+ else
10
11
error " Error Cleaning Repo"
12
+ printf " %s\n" " $error_output " >&2
11
13
exit 1
12
14
fi
13
15
14
- exit_watcher () {
16
+ exit_watcher () {
15
17
# kill watcher by removing lock file
16
18
rm lib/rewatch.lock
17
19
}
@@ -23,10 +25,10 @@ echo 'Js.log("added-by-test")' >> ./packages/main/src/Main.res
23
25
24
26
sleep 2
25
27
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;
27
29
then
28
30
success " Output is correct"
29
- else
31
+ else
30
32
error " Output is incorrect"
31
33
exit_watcher
32
34
exit 1
@@ -38,10 +40,10 @@ replace '/Js.log("added-by-test")/d' ./packages/main/src/Main.res;
38
40
39
41
sleep 1
40
42
41
- if git diff --exit-code ./
43
+ if git diff --exit-code ./
42
44
then
43
45
success " Adding and removing changes nothing"
44
- else
46
+ else
45
47
error " Adding and removing changes left some artifacts"
46
48
exit_watcher
47
49
exit 1
You can’t perform that action at this time.
0 commit comments