1 | #!/usr/bin/env bash
|
2 | CWD=`pwd`
|
3 |
|
4 | "${CWD}/bin/whiskey" --tests "${CWD}/example/test-success.js"
|
5 |
|
6 | if [ $? -ne 0 ]; then
|
7 | echo "tests should pass"
|
8 | exit 1
|
9 | fi
|
10 |
|
11 | "${CWD}/bin/whiskey" --tests "${CWD}/example/test-failure.js"
|
12 |
|
13 | if [ $? -ne 2 ]; then
|
14 | echo "2 tests should fail"
|
15 | exit 1
|
16 | fi
|
17 |
|
18 | "${CWD}/bin/whiskey" --failfast --timeout 500 \
|
19 | --tests --concurrency 100 "${CWD}/example/test-failure.js ${CWD}/example/test-timeout.js"
|
20 |
|
21 | if [ $? -ne 1 ]; then
|
22 | echo "1 test should fail"
|
23 | exit 1
|
24 | fi
|
25 |
|
26 | "${CWD}/bin/whiskey" --failfast --timeout 500 \
|
27 | --tests "${CWD}/example/test-timeout.js ${CWD}/example/test-failure.js ${CWD}/example/test-timeout.js"
|
28 |
|
29 | if [ $? -ne 1 ]; then
|
30 | echo "1 test should fail"
|
31 | exit 1
|
32 | fi
|
33 |
|
34 | "${CWD}/bin/whiskey" --timeout 1000 --tests "${CWD}/example/test-timeout.js"
|
35 |
|
36 | if [ ! $? -eq 1 ]; then
|
37 | echo "test should time out"
|
38 | exit 1
|
39 | fi
|
40 |
|
41 | "${CWD}/bin/whiskey" --timeout 1000 --tests "${CWD}/example/test-timeout-blocking.js"
|
42 |
|
43 | if [ ! $? -eq 1 ]; then
|
44 | echo "test should time out"
|
45 | exit 1
|
46 | fi
|
47 |
|
48 | "${CWD}/bin/whiskey" --tests "${CWD}/example/test-setup-and-teardown.js"
|
49 |
|
50 | if [ $? -ne 0 ]; then
|
51 | echo "test should pass"
|
52 | exit 1
|
53 | fi
|
54 |
|
55 |
|
56 | "${CWD}/bin/whiskey" --tests "${CWD}/example/test-inexistent.js"
|
57 |
|
58 | if [ $? -ne 1 ]; then
|
59 | echo "1 test should fail"
|
60 | exit 1
|
61 | fi
|
62 |
|
63 | "${CWD}/bin/whiskey" --tests "${CWD}/example/test-setup-fail.js"
|
64 |
|
65 | if [ $? -ne 3 ]; then
|
66 | echo "3 tests should fail"
|
67 | exit 1
|
68 | fi
|
69 |
|
70 |
|
71 | "${CWD}/bin/whiskey" --tests "example/test-success.js"
|
72 |
|
73 | if [ $? -ne 0 ]; then
|
74 | echo "tests should pass."
|
75 | exit 1
|
76 | fi
|
77 |
|
78 |
|
79 | "${CWD}/bin/whiskey" --tests "${CWD}/example/test-success.js ${CWD}/example/test-failure.js"
|
80 |
|
81 | if [ ! $? -gt 0 ]; then
|
82 | echo "2 tests should fail"
|
83 | exit 1
|
84 | fi
|
85 |
|
86 |
|
87 | FOLDER_EXISTS=0
|
88 | rm -rf ${CWD}/example/test-123456
|
89 |
|
90 | "${CWD}/bin/whiskey" --test-init-file "${CWD}/example/init.js" --tests "${CWD}/example/test-success.js"
|
91 |
|
92 | if [ -d ${CWD}/example/test-123456 ]; then
|
93 | FOLDER_EXISTS=1
|
94 | fi
|
95 |
|
96 | rm -rf ${CWD}/example/test-123456
|
97 |
|
98 | if [ $? -ne 0 ] || [ ${FOLDER_EXISTS} -ne 1 ]; then
|
99 | echo ${FOLDER_EXISTS}
|
100 | echo "test should pass m"
|
101 | exit 1
|
102 | fi
|
103 |
|
104 |
|
105 | "${CWD}/bin/whiskey" --tests "${CWD}/example/test-uncaught.js"
|
106 |
|
107 | if [ $? -ne 5 ]; then
|
108 | echo "5 tests should fail"
|
109 | exit 1
|
110 | fi
|
111 |
|
112 |
|
113 | "${CWD}/bin/whiskey" --tests "${CWD}/example/test-chdir.js"
|
114 |
|
115 | if [ $? -ne 1 ]; then
|
116 | echo "1 test should fail"
|
117 | exit 1
|
118 | fi
|
119 |
|
120 | "${CWD}/bin/whiskey" --tests "${CWD}/example/test-chdir.js" --chdir "${CWD}/example/"
|
121 |
|
122 | if [ $? -ne 0 ]; then
|
123 | echo "tests should pass y"
|
124 | exit 1
|
125 | fi
|
126 |
|
127 |
|
128 | "${CWD}/bin/whiskey" --test-init-file "${CWD}/example/init-test.js" --tests "${CWD}/example/test-init-function.js"
|
129 |
|
130 | if [ $? -ne 0 ]; then
|
131 | echo "tests should pass x"
|
132 | exit 1
|
133 | fi
|
134 |
|
135 |
|
136 | "${CWD}/bin/whiskey" --timeout 2000 --test-init-file "${CWD}/example/init-timeout.js" --tests "${CWD}/example/test-failure.js"
|
137 |
|
138 | if [ $? -ne 1 ]; then
|
139 | echo "1 test should fail (callback in init function is not called)"
|
140 | exit 1
|
141 | fi
|
142 |
|
143 |
|
144 | "${CWD}/bin/whiskey" --timeout 1000 --tests "${CWD}/example/test-setup-timeout.js" --chdir "${CWD}/example/"
|
145 |
|
146 | if [ $? -ne 1 ]; then
|
147 | echo "1 test should fail (setUp timeout)"
|
148 | exit 1
|
149 | fi
|
150 |
|
151 |
|
152 | "${CWD}/bin/whiskey" --timeout 2000 --tests "${CWD}/example/test-teardown-timeout.js" --chdir "${CWD}/example/"
|
153 |
|
154 | if [ $? -ne 2 ]; then
|
155 | echo "1 test should fail (tearDown timeout)"
|
156 | exit 1
|
157 | fi
|
158 |
|
159 | "${CWD}/bin/whiskey" --timeout 2000 --tests "${CWD}/example/test-custom-assert-functions.js"
|
160 |
|
161 | if [ $? -ne 2 ]; then
|
162 | echo "2 tests should fail"
|
163 | exit 1
|
164 | fi
|
165 |
|
166 | "${CWD}/bin/whiskey" --timeout 2000 \
|
167 | --tests "${CWD}/example/test-custom-assert-functions.js" \
|
168 | --custom-assert-module "${CWD}/example/custom-assert-functions.js"
|
169 |
|
170 | if [ $? -ne 1 ]; then
|
171 | echo "1 test should fail"
|
172 | exit 1
|
173 | fi
|
174 |
|
175 | "${CWD}/example/test-stdout-and-stderr-is-captured-on-timeout.js"
|
176 |
|
177 | if [ $? -ne 0 ]; then
|
178 | echo "test file stdout and stderr was not properly captured during test timeout"
|
179 | exit 1
|
180 | fi
|
181 |
|
182 |
|
183 |
|
184 | "${CWD}/example/test-succeeded-tests-are-reported-on-timeout.js"
|
185 |
|
186 | if [ $? -ne 0 ]; then
|
187 | echo "succeeded tests were not reported properly upon a test file timeout"
|
188 | exit 1
|
189 | fi
|
190 |
|
191 |
|
192 | if [ "$(which jscoverage)" ]; then
|
193 | "${CWD}/example/test-jscoverage.js"
|
194 |
|
195 | if [ $? -ne 0 ]; then
|
196 | echo "coverage does not work properly"
|
197 | exit 1
|
198 | fi
|
199 | else
|
200 | echo 'jscoverage not installed, skipping coverage tests'
|
201 | fi
|
202 |
|
203 |
|
204 |
|
205 | "${CWD}/bin/whiskey" --timeout 1000 \
|
206 | --tests "${CWD}/example/test-timeout-after-finish.js"
|
207 |
|
208 | if [ $? -ne 1 ]; then
|
209 | echo "1 test should timeout"
|
210 | exit 1
|
211 | fi
|
212 |
|
213 |
|
214 | "${CWD}/example/test-leaks.js"
|
215 |
|
216 | if [ $? -ne 0 ]; then
|
217 | echo "scope leaks were not reported properly"
|
218 | exit 1
|
219 | fi
|
220 |
|
221 |
|
222 | "${CWD}/bin/whiskey" --timeout 1000 \
|
223 | --tests "${CWD}/example/test-no-test-functions.js"
|
224 |
|
225 | if [ $? -ne 0 ]; then
|
226 | echo "test didn't exit with zero exit code"
|
227 | exit 1
|
228 | fi
|
229 |
|
230 | "${CWD}/bin/whiskey" --timeout 1000 \
|
231 | --tests "${CWD}/example/test-skipped.js"
|
232 |
|
233 | if [ $? -ne 0 ]; then
|
234 | echo "test didn't exit with zero exit code"
|
235 | exit 1
|
236 | fi
|
237 |
|
238 | "${CWD}/bin/whiskey" --timeout 1000 \
|
239 | --tests "${CWD}/example/test-custom-assert-methods.js"
|
240 |
|
241 | if [ $? -ne 0 ]; then
|
242 | echo "test didn't exit with zero exit code"
|
243 | exit 1
|
244 | fi
|
245 |
|
246 |
|
247 | "${CWD}/bin/whiskey" --timeout 1000 \
|
248 | --tests "example.test-failure.test_one_is_not*"
|
249 |
|
250 | if [ $? -ne 1 ]; then
|
251 | echo "test didn't exit with 1 exit code"
|
252 | exit 1
|
253 | fi
|
254 |
|
255 | "${CWD}/bin/whiskey" --timeout 1000 \
|
256 | --tests "${CWD}/example/test-getFilePathAndPattern.js"
|
257 |
|
258 | if [ $? -ne 0 ]; then
|
259 | echo "test didn't exit with zero exit code"
|
260 | exit 1
|
261 | fi
|
262 |
|
263 | echo ""
|
264 | echo "* * * Whiskey test suite PASSED. * * *"
|
265 | exit 0
|