Compare commits
707 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
516fe68759 | ||
|
|
4530f9431f | ||
|
|
d4b76a4d3b | ||
|
|
764d58a7f5 | ||
|
|
9911d37f06 | ||
|
|
32f99ef99d | ||
|
|
c142490c69 | ||
|
|
24bf3489dc | ||
|
|
5afe1222f4 | ||
|
|
274011ed03 | ||
|
|
42e00b3bc5 | ||
|
|
0eca06a33b | ||
|
|
84953ec210 | ||
|
|
e15f273f06 | ||
|
|
e908b67b19 | ||
|
|
46cc48ccfa | ||
|
|
262a2fe674 | ||
|
|
50cd6fdd68 | ||
|
|
341c6df6ea | ||
|
|
3df9cc26d4 | ||
|
|
6b156ca6d1 | ||
|
|
07996b567f | ||
|
|
9a96396f65 | ||
|
|
12a47f05bf | ||
|
|
414e03bded | ||
|
|
038ab87252 | ||
|
|
f20f78f82b | ||
|
|
70bce55721 | ||
|
|
53529bdc9a | ||
|
|
c82e5947f5 | ||
|
|
f76b452816 | ||
|
|
91aab8e1b8 | ||
|
|
486a64658f | ||
|
|
1dfdc89ba9 | ||
|
|
e2a191b116 | ||
|
|
085a1f8a16 | ||
|
|
cf2f922e30 | ||
|
|
aeeb5b7107 | ||
|
|
170a6dce76 | ||
|
|
4934e420b2 | ||
|
|
1085914a76 | ||
|
|
6f119c4e5a | ||
|
|
298b5ba127 | ||
|
|
16e07a0e99 | ||
|
|
cb6de64e58 | ||
|
|
f69949ebc0 | ||
|
|
1136fddcde | ||
|
|
b943f6b736 | ||
|
|
b439e2fb37 | ||
|
|
c79ce125c0 | ||
|
|
62b815c485 | ||
|
|
65b4499dec | ||
|
|
f38527ff15 | ||
|
|
d742ada71d | ||
|
|
b6cc34d9e9 | ||
|
|
ef9f82a17d | ||
|
|
d3a3cf1ff3 | ||
|
|
c0d0513199 | ||
|
|
86a38fceb9 | ||
|
|
c74af1d900 | ||
|
|
8ea4c6d3a1 | ||
|
|
bdbaebc045 | ||
|
|
2d33765cbf | ||
|
|
bb0992bf5f | ||
|
|
ac5d8708b9 | ||
|
|
eb93d38294 | ||
|
|
0b5dce7d84 | ||
|
|
d16aa550cb | ||
|
|
2200dd084d | ||
|
|
98ead94c51 | ||
|
|
21655a82c9 | ||
|
|
0183b1642d | ||
|
|
18ed34e9be | ||
|
|
f4caf27208 | ||
|
|
a63172f53f | ||
|
|
9619acf91f | ||
|
|
b7e4c1e779 | ||
|
|
e5ada1d010 | ||
|
|
d35b65cf79 | ||
|
|
db615e4186 | ||
|
|
5906a2c05c | ||
|
|
59ad217954 | ||
|
|
b0ec95c472 | ||
|
|
13b9e669bd | ||
|
|
2eef0747a0 | ||
|
|
7ac1244f58 | ||
|
|
6ef0e93880 | ||
|
|
2be5e0a962 | ||
|
|
a42f28c734 | ||
|
|
d58f3dac56 | ||
|
|
676689b063 | ||
|
|
aaf226b9e3 | ||
|
|
419470e9df | ||
|
|
1526d5e2a8 | ||
|
|
a3cb010971 | ||
|
|
278ef9228b | ||
|
|
82eeed3c85 | ||
|
|
ae9b95269c | ||
|
|
285f06d5c4 | ||
|
|
3aece2ac74 | ||
|
|
3a9d4ee08d | ||
|
|
26a7bc6acf | ||
|
|
7b8edcb401 | ||
|
|
395b2b2d97 | ||
|
|
bd250f27c7 | ||
|
|
b4dfdd7a48 | ||
|
|
12ed3bfacd | ||
|
|
324ad0073e | ||
|
|
9f7a6ef061 | ||
|
|
908583c49b | ||
|
|
e31db20ec7 | ||
|
|
c260c67e7e | ||
|
|
554d0efab7 | ||
|
|
ea3cf14ef8 | ||
|
|
a4bdd47a8a | ||
|
|
89306551a0 | ||
|
|
0e95b04900 | ||
|
|
da91294182 | ||
|
|
bd41a97cd5 | ||
|
|
6d3953356d | ||
|
|
62f769767a | ||
|
|
03f7f76bca | ||
|
|
4c6dadb9b1 | ||
|
|
8973e4e44f | ||
|
|
b7e9594c86 | ||
|
|
6c363f11b3 | ||
|
|
0f650e1d03 | ||
|
|
78fe42ac2d | ||
|
|
20d86b2a00 | ||
|
|
516e00d7ba | ||
|
|
c1957ecd7c | ||
|
|
1f6c91de7c | ||
|
|
f6342ad4fe | ||
|
|
8cf8736cab | ||
|
|
6d0f0ed915 | ||
|
|
7ca571a746 | ||
|
|
4240b3514b | ||
|
|
ab116fbd0f | ||
|
|
da2673e02f | ||
|
|
b2dee5cb1c | ||
|
|
1414281cff | ||
|
|
2588b442e6 | ||
|
|
af41e5ea5c | ||
|
|
8834142198 | ||
|
|
1926fc11ae | ||
|
|
e7049d3183 | ||
|
|
80dba1138a | ||
|
|
9811ff71d2 | ||
|
|
301dd4f6b5 | ||
|
|
090a6234c3 | ||
|
|
8ad9abb19a | ||
|
|
8c0a8a1b33 | ||
|
|
1db81c334d | ||
|
|
8dd0ad531c | ||
|
|
f58002f0a6 | ||
|
|
4d18e63b0f | ||
|
|
4fc177d5ae | ||
|
|
acc8c23bf4 | ||
|
|
fc6ee243e9 | ||
|
|
b256741bec | ||
|
|
1d4a2b5c22 | ||
|
|
b0aac6b852 | ||
|
|
543e056056 | ||
|
|
7dfc5f506c | ||
|
|
4cce7263c4 | ||
|
|
31164106e5 | ||
|
|
f71218a44b | ||
|
|
22e9d6df20 | ||
|
|
6ddf64568e | ||
|
|
aa72b0b7cf | ||
|
|
9f3952ff87 | ||
|
|
c604012793 | ||
|
|
6aa069d586 | ||
|
|
585287b9d6 | ||
|
|
de862f8133 | ||
|
|
4e3ae726aa | ||
|
|
9ee7b4ee0b | ||
|
|
2e737f50ca | ||
|
|
c60d669940 | ||
|
|
4c491b2dc0 | ||
|
|
f9d1e2f280 | ||
|
|
270475bc61 | ||
|
|
acb9989178 | ||
|
|
1fe1bbb6ed | ||
|
|
994878e6f6 | ||
|
|
f7c160d716 | ||
|
|
578f63b9bd | ||
|
|
b1190eefb9 | ||
|
|
271908a2c4 | ||
|
|
3372af1cf1 | ||
|
|
d355fa0806 | ||
|
|
56a79bef98 | ||
|
|
2ea4e9507c | ||
|
|
c848a66faa | ||
|
|
99fd7ddb88 | ||
|
|
5d1d19f494 | ||
|
|
4f49288f31 | ||
|
|
b9adc76dc7 | ||
|
|
9672689d40 | ||
|
|
a237ac5386 | ||
|
|
5ac3e21abb | ||
|
|
88763012e4 | ||
|
|
b1e97cfb09 | ||
|
|
8e5823c0d2 | ||
|
|
e6a7932ec1 | ||
|
|
10f1220e55 | ||
|
|
5ee03f02ed | ||
|
|
2835ca3cce | ||
|
|
120c484419 | ||
|
|
1d62504534 | ||
|
|
055d88eff8 | ||
|
|
d2b33e0c66 | ||
|
|
0c7f36a181 | ||
|
|
686d8157e5 | ||
|
|
b771c083cb | ||
|
|
fbd2ffc08b | ||
|
|
b3c8fb9797 | ||
|
|
ef3cfe7f44 | ||
|
|
0d6ecbec17 | ||
|
|
7e4b8d4531 | ||
|
|
4b696fbf26 | ||
|
|
74511f5425 | ||
|
|
3e912f7f4e | ||
|
|
19b83a7434 | ||
|
|
98569ba0f3 | ||
|
|
7f11ecb62e | ||
|
|
97f8db0616 | ||
|
|
50880fcff7 | ||
|
|
ddcae84480 | ||
|
|
9d6a95d9ba | ||
|
|
0d3b2b2f8e | ||
|
|
08f046c24c | ||
|
|
90c87140ac | ||
|
|
25d9a396aa | ||
|
|
c42b1972e2 | ||
|
|
7f8f2b5e7a | ||
|
|
9cb2f06aa6 | ||
|
|
a37b6c0d32 | ||
|
|
5533d1a920 | ||
|
|
75e652d6a7 | ||
|
|
e1f7ca51da | ||
|
|
538ae7b9ac | ||
|
|
2ea41d3e27 | ||
|
|
bd9ae3a25b | ||
|
|
1042c9a2dd | ||
|
|
92e7436db2 | ||
|
|
74fe7fb85b | ||
|
|
7e0fd79b3b | ||
|
|
8807bbb850 | ||
|
|
c93f35fbc8 | ||
|
|
4cfdd06700 | ||
|
|
19b89d437e | ||
|
|
43f96d3ecd | ||
|
|
ac42bd9b35 | ||
|
|
9fbd0ba551 | ||
|
|
52876a7bf2 | ||
|
|
2eec3427e8 | ||
|
|
ed23254865 | ||
|
|
137e7e94d3 | ||
|
|
923b8fe9c4 | ||
|
|
61cc1eec66 | ||
|
|
04be4c4583 | ||
|
|
b59ac96b51 | ||
|
|
be6ff8b24c | ||
|
|
da2005fe97 | ||
|
|
41a813521b | ||
|
|
54e7a82ef3 | ||
|
|
d5e6bf47ed | ||
|
|
5a76e59d5b | ||
|
|
f5cfa2a4c1 | ||
|
|
c21bdaf35d | ||
|
|
369e8cc08b | ||
|
|
0e9b9a11c3 | ||
|
|
9750ae59e7 | ||
|
|
2f01f64249 | ||
|
|
17c89c69d6 | ||
|
|
d85d6dd4b8 | ||
|
|
ff85714b24 | ||
|
|
0d1a9a72d9 | ||
|
|
63cc6687ff | ||
|
|
75a5681c5e | ||
|
|
9df1edbdc9 | ||
|
|
5279e7a8c4 | ||
|
|
c2e2bd7c91 | ||
|
|
bad9c63bf7 | ||
|
|
05097b3e42 | ||
|
|
1efed4c156 | ||
|
|
f4849f6401 | ||
|
|
ec2ae4d521 | ||
|
|
ac3d64cf84 | ||
|
|
2d3c8c9f26 | ||
|
|
6816bc4252 | ||
|
|
04bb56a5b5 | ||
|
|
ed31b9b844 | ||
|
|
4e47b78f1f | ||
|
|
8e23c26383 | ||
|
|
56191cfb2e | ||
|
|
8624a52ee0 | ||
|
|
a4b92b34f4 | ||
|
|
3486e8d166 | ||
|
|
8366ef9be5 | ||
|
|
ab0567c665 | ||
|
|
8676bbf11a | ||
|
|
c0a9d20a02 | ||
|
|
c7cc3b4a29 | ||
|
|
5a2e1b0082 | ||
|
|
f196faf0bb | ||
|
|
850204dfb8 | ||
|
|
7bda3bd728 | ||
|
|
b9c25e88b9 | ||
|
|
13228c304e | ||
|
|
da18479422 | ||
|
|
ba211e4913 | ||
|
|
5f9a965d7c | ||
|
|
3ff59835ea | ||
|
|
9fedf74f32 | ||
|
|
0339fc500a | ||
|
|
227b0c62a3 | ||
|
|
3de60067f0 | ||
|
|
cb1001e6c2 | ||
|
|
d9ded15c45 | ||
|
|
a0bce8031e | ||
|
|
7f7dda7a2c | ||
|
|
15f92b226c | ||
|
|
99aa2247b6 | ||
|
|
314eb63552 | ||
|
|
bd6ca98f9d | ||
|
|
eee75d8eed | ||
|
|
5e0ebadb3d | ||
|
|
738c10fd43 | ||
|
|
8c9ffe3144 | ||
|
|
ab2c916c3a | ||
|
|
290fb3fdcd | ||
|
|
de7b7c029e | ||
|
|
e13c7a55a9 | ||
|
|
7a62969a14 | ||
|
|
604cd6132f | ||
|
|
2710bdfc5e | ||
|
|
f6da084642 | ||
|
|
6c0224414c | ||
|
|
c302545ba4 | ||
|
|
954a6a0091 | ||
|
|
11cfaae42a | ||
|
|
927cc011d6 | ||
|
|
6cf2d94f73 | ||
|
|
b578e72c8f | ||
|
|
1da6c7cf85 | ||
|
|
87e808282b | ||
|
|
14067d0785 | ||
|
|
d1a94bcf50 | ||
|
|
bbf3f6825c | ||
|
|
9b653b9dcb | ||
|
|
b6798cdb06 | ||
|
|
dbd198f7d0 | ||
|
|
5583b6f954 | ||
|
|
db8e636021 | ||
|
|
90dea9ab38 | ||
|
|
ebbefafc26 | ||
|
|
b66ffc1277 | ||
|
|
5458f2f18d | ||
|
|
602f5bc08a | ||
|
|
4e4cd30965 | ||
|
|
7224c6adf2 | ||
|
|
5bdd7e8fbf | ||
|
|
1e0381a495 | ||
|
|
c454658c54 | ||
|
|
b7d8b0de71 | ||
|
|
342f0eb9a3 | ||
|
|
44b56093e7 | ||
|
|
bee8132848 | ||
|
|
e5c744f3dc | ||
|
|
4fb5aa14b8 | ||
|
|
43cd73938d | ||
|
|
f38e8e9235 | ||
|
|
fcd5a1948b | ||
|
|
6489b0f400 | ||
|
|
5e3582d8e7 | ||
|
|
33151ed9eb | ||
|
|
3f27ff1c7c | ||
|
|
b59cacf131 | ||
|
|
d6f1f8dec5 | ||
|
|
e0541eca80 | ||
|
|
8b7cb21874 | ||
|
|
ee0ff3b6c8 | ||
|
|
65241565c5 | ||
|
|
a047115eef | ||
|
|
0d4c8d13bb | ||
|
|
17c5e2b10d | ||
|
|
fa71928cad | ||
|
|
3e91ac0889 | ||
|
|
79206ccff5 | ||
|
|
a95c2cfe3f | ||
|
|
e2e2d1b343 | ||
|
|
3b53e469fd | ||
|
|
c8b212f278 | ||
|
|
b3f69852c1 | ||
|
|
1613a376b1 | ||
|
|
1e35e8ba95 | ||
|
|
a6b209bc2f | ||
|
|
2301914549 | ||
|
|
320c42b6cc | ||
|
|
df45b4fede | ||
|
|
c1ab3c9cbe | ||
|
|
d2f2e2b870 | ||
|
|
0f6a7f04b3 | ||
|
|
728af5e556 | ||
|
|
018fd53c10 | ||
|
|
25d73515f3 | ||
|
|
8e317d4026 | ||
|
|
ea4c44904d | ||
|
|
77514bbb80 | ||
|
|
a85c3a4da8 | ||
|
|
0b1e1a0401 | ||
|
|
3374415add | ||
|
|
c2ae3b6b12 | ||
|
|
110cacab19 | ||
|
|
db7879a478 | ||
|
|
e7dbc75fc2 | ||
|
|
a81466d9e7 | ||
|
|
48f42eaa7d | ||
|
|
e5c2572753 | ||
|
|
141fd910f2 | ||
|
|
a93bfd2120 | ||
|
|
4221b2d2c4 | ||
|
|
6ee7fd6ced | ||
|
|
878325e2cf | ||
|
|
80c4f87dd5 | ||
|
|
3f3fa484b2 | ||
|
|
d0ad9b98cd | ||
|
|
375a6f9fda | ||
|
|
c017f0000d | ||
|
|
4097718b66 | ||
|
|
825dab32ff | ||
|
|
f3a7396845 | ||
|
|
850bee5492 | ||
|
|
6028a5d92c | ||
|
|
93a13ab791 | ||
|
|
542f483228 | ||
|
|
459b4c29b6 | ||
|
|
750a9aac6d | ||
|
|
cd55f03912 | ||
|
|
79954311fb | ||
|
|
3f71bcdb2d | ||
|
|
06f05ac57b | ||
|
|
5ea5ec6004 | ||
|
|
f7033f6551 | ||
|
|
7e6e905814 | ||
|
|
a6a1962924 | ||
|
|
50944fea6f | ||
|
|
7bfc4c0a45 | ||
|
|
4be2079482 | ||
|
|
d6f47ea886 | ||
|
|
5061dd066c | ||
|
|
2a847a67e3 | ||
|
|
50223d97d6 | ||
|
|
302e78f1df | ||
|
|
42ad12ec52 | ||
|
|
c41fa7d156 | ||
|
|
0b1449228f | ||
|
|
65a6decd6d | ||
|
|
7cbd86357d | ||
|
|
4f278be2c2 | ||
|
|
f2bc9b5bd8 | ||
|
|
e9d79bc946 | ||
|
|
0b2097b616 | ||
|
|
f02824ae52 | ||
|
|
225c7bdda3 | ||
|
|
e855c898d1 | ||
|
|
426eebe1ce | ||
|
|
add841a1e9 | ||
|
|
023c998660 | ||
|
|
3dde7d0c29 | ||
|
|
4e3f9a4d09 | ||
|
|
b89fbc71a7 | ||
|
|
4c0e3b2aed | ||
|
|
19f812c4f6 | ||
|
|
5ea24a8448 | ||
|
|
4173a4089c | ||
|
|
f712b795d7 | ||
|
|
ff029b37b5 | ||
|
|
7cd8c41d31 | ||
|
|
d7dd85c64f | ||
|
|
2d5c071d28 | ||
|
|
76bc0a87db | ||
|
|
5cae401c98 | ||
|
|
1d366772b7 | ||
|
|
d137b83c1c | ||
|
|
692c8716f0 | ||
|
|
965229bd03 | ||
|
|
46044dd345 | ||
|
|
2af9a45fb2 | ||
|
|
abc0c4a97e | ||
|
|
eb1d98338a | ||
|
|
f0c480f456 | ||
|
|
7693a4c959 | ||
|
|
1a08d1e8c6 | ||
|
|
ce9600a3f6 | ||
|
|
c58d83bbe3 | ||
|
|
1c6f4ef0e6 | ||
|
|
c77ff30263 | ||
|
|
dc652cfb05 | ||
|
|
22f58c0049 | ||
|
|
715de7aa38 | ||
|
|
0c68cc4afc | ||
|
|
ce6ce4e2c7 | ||
|
|
10f87b3b90 | ||
|
|
0776146d3b | ||
|
|
bbac4bb23f | ||
|
|
8c59875afe | ||
|
|
cdee9c8853 | ||
|
|
69956bf8f6 | ||
|
|
e1249ac89a | ||
|
|
a84e0cd8ef | ||
|
|
6177a4aeff | ||
|
|
471a241493 | ||
|
|
d5dfbc98c3 | ||
|
|
2ab2a83a3b | ||
|
|
f22862fd80 | ||
|
|
53b0752ff0 | ||
|
|
7616e5a3fd | ||
|
|
e173cd1c9d | ||
|
|
234dc1a047 | ||
|
|
d22a030b87 | ||
|
|
4acb7448d8 | ||
|
|
a26e85ff3a | ||
|
|
39e175c05f | ||
|
|
d129a6c0ee | ||
|
|
837101c025 | ||
|
|
8e3066db42 | ||
|
|
a857f4c042 | ||
|
|
dca543accb | ||
|
|
5dbcf27f72 | ||
|
|
b54de4a180 | ||
|
|
46509f05a9 | ||
|
|
ebaa2e7f24 | ||
|
|
5eaf7152bf | ||
|
|
ebbaab4cf9 | ||
|
|
1936a36c79 | ||
|
|
1dd4af3835 | ||
|
|
6ae054c3e2 | ||
|
|
e5feba994f | ||
|
|
20faa883fb | ||
|
|
3bba1eabd4 | ||
|
|
9ad3eac469 | ||
|
|
3140d5fb95 | ||
|
|
69a61547e7 | ||
|
|
a999490de9 | ||
|
|
c1479acd17 | ||
|
|
3a93f845d6 | ||
|
|
6c58024321 | ||
|
|
aeae141fd4 | ||
|
|
a951bbbb47 | ||
|
|
895c17e5c1 | ||
|
|
a84eaf2cbe | ||
|
|
9f240c5b9e | ||
|
|
dfa8a77dc3 | ||
|
|
2472982fe9 | ||
|
|
c85500a924 | ||
|
|
482f4d62fc | ||
|
|
bfcd8b046d | ||
|
|
2ab22951a1 | ||
|
|
6c131beda7 | ||
|
|
ea88023553 | ||
|
|
6bd98cb2ab | ||
|
|
b4b3ac25a1 | ||
|
|
7570bc422b | ||
|
|
eca8d8f009 | ||
|
|
305252f5a8 | ||
|
|
0fdb28c6ff | ||
|
|
a84202a6f9 | ||
|
|
503f4b7f49 | ||
|
|
fbe38018c9 | ||
|
|
8bb2f67fb3 | ||
|
|
ba9c863de9 | ||
|
|
02161b7d48 | ||
|
|
4d5f27d359 | ||
|
|
a4faa80be4 | ||
|
|
b68ba90ad7 | ||
|
|
dc7be9c55e | ||
|
|
b56c2a69ac | ||
|
|
4b6789ccd9 | ||
|
|
9f94e8e226 | ||
|
|
55f32e2dc6 | ||
|
|
b30a85c8f1 | ||
|
|
20ce62d5f5 | ||
|
|
c3de57aaac | ||
|
|
2517ddfe17 | ||
|
|
23a492cb65 | ||
|
|
25c546a904 | ||
|
|
97ab0cb403 | ||
|
|
42b1bda919 | ||
|
|
216b40439f | ||
|
|
590a9d9d41 | ||
|
|
66c8624022 | ||
|
|
75e5a5c308 | ||
|
|
9b5c20cc19 | ||
|
|
cc720e7f56 | ||
|
|
1426416666 | ||
|
|
197cb13817 | ||
|
|
816b7d701f | ||
|
|
da6813ef0d | ||
|
|
a4d134521a | ||
|
|
d4fc787ea7 | ||
|
|
663fbd0cdb | ||
|
|
cf83ae474c | ||
|
|
325c5a2288 | ||
|
|
3ca687a9ad | ||
|
|
3b557f85c7 | ||
|
|
b67a19507f | ||
|
|
ecae3d47a7 | ||
|
|
a76d6d1cd4 | ||
|
|
916dc03d9c | ||
|
|
2151a13705 | ||
|
|
6cc09e00d3 | ||
|
|
6d6c31328b | ||
|
|
c8cd2eabe5 | ||
|
|
f77071254a | ||
|
|
8880729250 | ||
|
|
9ad15eeaba | ||
|
|
10ca5f0246 | ||
|
|
a5cd2731b4 | ||
|
|
b12974db2e | ||
|
|
f4e5573ee3 | ||
|
|
0c77c6cfb5 | ||
|
|
cfc64a6f5c | ||
|
|
6ab70923b3 | ||
|
|
d9c0b10be4 | ||
|
|
a58fd20d82 | ||
|
|
eefa716530 | ||
|
|
66c364564e | ||
|
|
68ba5b6d48 | ||
|
|
15ae0379ec | ||
|
|
1fb0d2eefa | ||
|
|
ba0982d89f | ||
|
|
f703539942 | ||
|
|
62840f72a6 | ||
|
|
6d10f97151 | ||
|
|
15f3d0e9d7 | ||
|
|
b1344d5c73 | ||
|
|
59aaac026c | ||
|
|
21f62c697a | ||
|
|
dc93c33af6 | ||
|
|
4889583d5c | ||
|
|
41df058171 | ||
|
|
fa837ae90a | ||
|
|
c82c958e0d | ||
|
|
752e831b30 | ||
|
|
bd30065d66 | ||
|
|
84dff421ea | ||
|
|
709e032d1c | ||
|
|
1290d93b6a | ||
|
|
345903220c | ||
|
|
3332f93a24 | ||
|
|
3b19d66268 | ||
|
|
137c1a39f6 | ||
|
|
9402d59859 | ||
|
|
e8178d061b | ||
|
|
dd75394ea8 | ||
|
|
6b857d11ce | ||
|
|
eb48c83649 | ||
|
|
08a35d134d | ||
|
|
14824b5f9e | ||
|
|
9afae3d978 | ||
|
|
64a67ed320 | ||
|
|
dee1066652 | ||
|
|
d7ab9083be | ||
|
|
caee1508d1 | ||
|
|
3b8326f1e6 | ||
|
|
980509cd7b | ||
|
|
b984ff2fa6 | ||
|
|
61bf9ac7d7 | ||
|
|
5b397ff33e | ||
|
|
cd4d5c2445 | ||
|
|
5b6edff3fd | ||
|
|
cc3678f033 | ||
|
|
35f52bcb24 | ||
|
|
f8bccabf03 | ||
|
|
97867b2bf5 | ||
|
|
18eb6e2f36 | ||
|
|
51462f369b | ||
|
|
ea57ad97cf | ||
|
|
3132d98f23 | ||
|
|
b799f54bc9 | ||
|
|
ac8ef2988d | ||
|
|
3c051fc291 | ||
|
|
6b937da863 | ||
|
|
ae94dd1bfa | ||
|
|
1bad048c15 | ||
|
|
f0892a55aa | ||
|
|
6066c71966 | ||
|
|
0d4b04d37c | ||
|
|
668846147c | ||
|
|
76fafa0388 | ||
|
|
bed1c15ea4 | ||
|
|
6caf4c5de2 | ||
|
|
97ae9a2d88 | ||
|
|
a3c3505086 | ||
|
|
a9e0112a9b | ||
|
|
a2ac5ef3b6 | ||
|
|
b200952195 | ||
|
|
752a36d3ff | ||
|
|
52026fb0f7 | ||
|
|
e17a2cb1e0 | ||
|
|
ec5695acc1 | ||
|
|
b1d4ab09af | ||
|
|
3b52d015ea | ||
|
|
b5b77b318a |
16
.editorconfig
Normal file
16
.editorconfig
Normal file
@@ -0,0 +1,16 @@
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
|
||||
[*.{js, json, sh, yml, gemspec}]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
[{Rakefile, .jshintrc}]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
[*.{py}]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
65
CONTRIBUTING.md → .github/CONTRIBUTING.md
vendored
65
CONTRIBUTING.md → .github/CONTRIBUTING.md
vendored
@@ -1,23 +1,29 @@
|
||||
# Developing for Jasmine Core
|
||||
|
||||
We welcome your contributions - Thanks for helping make Jasmine a better project for everyone. Please review the backlog and discussion lists (the main group - [http://groups.google.com/group/jasmine-js](http://groups.google.com/group/jasmine-js) and the developer's list - [http://groups.google.com/group/jasmine-js-dev](http://groups.google.com/group/jasmine-js-dev)) before starting work - what you're looking for may already have been done. If it hasn't, the community can help make your contribution better.
|
||||
We welcome your contributions! Thanks for helping make Jasmine a better project for everyone. Please review the backlog and discussion lists before starting work. What you're looking for may already have been done. If it hasn't, the community can help make your contribution better. If you want to contribute but don't know what to work on, [issues tagged ready for work](https://github.com/jasmine/jasmine/labels/ready%20for%20work) should have enough detail to get started.
|
||||
|
||||
## Links
|
||||
|
||||
- [Jasmine Google Group](http://groups.google.com/group/jasmine-js)
|
||||
- [Jasmine-dev Google Group](http://groups.google.com/group/jasmine-js-dev)
|
||||
- [Jasmine on PivotalTracker](https://www.pivotaltracker.com/n/projects/10606)
|
||||
|
||||
## General Workflow
|
||||
|
||||
Please submit pull requests via feature branches using the semi-standard workflow of:
|
||||
|
||||
1. Fork it
|
||||
1. Clone your fork: (`git clone git@github.com:yourUserName/jasmine.git`)
|
||||
1. Change directory: (`cd jasmine`)
|
||||
1. Asign original repository to a remote named 'upstream': (`git remote add
|
||||
upstream https://github.com/pivotal/jasmine.git`)
|
||||
1. Pull in changes not present in your local repository: (`git fetch upstream`)
|
||||
1. Create your feature branch (`git checkout -b my-new-feature`)
|
||||
1. Commit your changes (`git commit -am 'Add some feature'`)
|
||||
1. Push to the branch (`git push origin my-new-feature`)
|
||||
1. Create new Pull Request
|
||||
```bash
|
||||
git clone git@github.com:yourUserName/jasmine.git # Clone your fork
|
||||
cd jasmine # Change directory
|
||||
git remote add upstream https://github.com/jasmine/jasmine.git # Assign original repository to a remote named 'upstream'
|
||||
git fetch upstream # Fetch changes not present in your local repository
|
||||
git merge upstream/master # Sync local master with upstream repository
|
||||
git checkout -b my-new-feature # Create your feature branch
|
||||
git commit -am 'Add some feature' # Commit your changes
|
||||
git push origin my-new-feature # Push to the branch
|
||||
```
|
||||
|
||||
We favor pull requests with very small, single commits with a single purpose.
|
||||
Once you've pushed a feature branch to your forked repo, you're ready to open a pull request. We favor pull requests with very small, single commits with a single purpose.
|
||||
|
||||
## Background
|
||||
|
||||
@@ -35,9 +41,9 @@ We favor pull requests with very small, single commits with a single purpose.
|
||||
|
||||
### Self-testing
|
||||
|
||||
Note that Jasmine tests itself. The files in `lib` are loaded first, defining the reference `jasmine`. Then the files in `src` are loaded, defining the reference `j$`. So there are two copies of the code loaded under test.
|
||||
Note that Jasmine tests itself. The files in `lib` are loaded first, defining the reference `jasmine`. Then the files in `src` are loaded, defining the reference `jasmineUnderTest`. So there are two copies of the code loaded under test.
|
||||
|
||||
The tests should always use `j$` to refer to the objects and functions that are being tested. But the tests can use functions on `jasmine` as needed. _Be careful how you structure any new test code_. Copy the patterns you see in the existing code - this ensures that the code you're testing is not leaking into the `jasmine` reference and vice-versa.
|
||||
The tests should always use `jasmineUnderTest` to refer to the objects and functions that are being tested. But the tests can use functions on `jasmine` as needed. _Be careful how you structure any new test code_. Copy the patterns you see in the existing code - this ensures that the code you're testing is not leaking into the `jasmine` reference and vice-versa.
|
||||
|
||||
### `boot.js`
|
||||
|
||||
@@ -67,17 +73,21 @@ To install the Ruby dependencies, you will need Ruby, Rubygems, and Bundler avai
|
||||
|
||||
$ bundle
|
||||
|
||||
...will install all of the Ruby dependencies.
|
||||
...will install all of the Ruby dependencies. If the ffi gem fails to build its native extensions, you may need to manually install some system dependencies. On Ubuntu:
|
||||
|
||||
$ apt-get install gcc ruby ruby-dev libxml2 libxml2-dev libxslt1-dev
|
||||
|
||||
...should get you to the point that `bundle` can install everything.
|
||||
|
||||
To install the Node dependencies, you will need Node.js, Npm, and [Grunt](http://gruntjs.com/), the [grunt-cli](https://github.com/gruntjs/grunt-cli) and ensure that `grunt` is on your path.
|
||||
|
||||
$ npm install --local
|
||||
|
||||
...will install all of the node modules locally. If when you run
|
||||
...will install all of the node modules locally. Now run
|
||||
|
||||
$ grunt
|
||||
|
||||
...you see that JSHint runs your system is ready.
|
||||
...if you see that JSHint runs, your system is ready.
|
||||
|
||||
### How to write new Jasmine code
|
||||
|
||||
@@ -94,28 +104,35 @@ Follow these tips and your pull request, patch, or suggestion is much more likel
|
||||
|
||||
### Running Specs
|
||||
|
||||
Jasmine uses the [Jasmine Ruby gem](http://github.com/pivotal/jasmine-gem) to test itself in browser.
|
||||
Jasmine uses the [Jasmine Ruby gem](http://github.com/jasmine/jasmine-gem) to test itself in browser.
|
||||
|
||||
$ rake jasmine
|
||||
$ bundle exec rake jasmine
|
||||
|
||||
...and then visit `http://localhost:8888` to run specs.
|
||||
|
||||
Jasmine uses Node.js with a custom runner to test outside of a browser.
|
||||
Jasmine uses the [Jasmine NPM package](http://github.com/jasmine/jasmine-npm) to test itself in a Node.js/npm environment.
|
||||
|
||||
$ grunt execSpecsInNode
|
||||
|
||||
...and then the results will print to the console. All specs run except those that expect a browser (the specs in `spec/html` are ignored).
|
||||
|
||||
The easiest way to run the tests in **Internet Explorer** is to run a VM that has IE installed. It's easy to do this with VirtualBox.
|
||||
|
||||
1. Download and install [VirtualBox](https://www.virtualbox.org/wiki/Downloads).
|
||||
1. Download a VM image [from Microsoft](https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/). Select "VirtualBox" as the platform.
|
||||
1. Unzip the downloaded archive. There should be an OVA file inside.
|
||||
1. In VirtualBox, choose `File > Import Appliance` and select the OVA file. Accept the default settings in the dialog that appears. Now you have a Windows VM!
|
||||
1. Run the VM and start IE.
|
||||
1. With `bundle exec rake jasmine` running on your host machine, navigate to `http://10.0.2.2:8888` in IE.
|
||||
|
||||
## Before Committing or Submitting a Pull Request
|
||||
|
||||
1. Ensure all specs are green in browser *and* node
|
||||
1. Ensure JSHint is green with `grunt jshint`
|
||||
1. Build `jasmine.js` with `grunt buildDistribution` and run all specs again - this ensures that your changes self-test well
|
||||
|
||||
## Submitting a Pull Request
|
||||
1. Revert your changes to `jasmine.js` and `jasmine-html.js`
|
||||
* We do this because `jasmine.js` and `jasmine-html.js` are auto-generated (as you've seen in the previous steps) and accepting multiple pull requests when this auto-generated file changes causes lots of headaches.
|
||||
1. When we accept your pull request, we will generate these files as a separate commit and merge the entire branch into master.
|
||||
* We do this because `jasmine.js` and `jasmine-html.js` are auto-generated (as you've seen in the previous steps) and accepting multiple pull requests when this auto-generated file changes causes lots of headaches
|
||||
* When we accept your pull request, we will generate these files as a separate commit and merge the entire branch into master
|
||||
|
||||
Note that we use Travis for Continuous Integration. We only accept green pull requests.
|
||||
|
||||
44
.github/ISSUE_TEMPLATE.md
vendored
Normal file
44
.github/ISSUE_TEMPLATE.md
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
## Are you creating an issue in the correct repository?
|
||||
|
||||
- When in doubt, create an issue here.
|
||||
- If you have an issue with the Jasmine docs, file an issue in the docs repo
|
||||
here: https://github.com/jasmine/jasmine.github.io
|
||||
- This repository is for the core Jasmine framework
|
||||
- If you are using a test runner that wraps Jasmine, consider filing an issue with that library if appropriate:
|
||||
- [Jasmine npm](https://github.com/jasmine/jasmine-npm/issues)
|
||||
- [Jasmine gem](https://github.com/jasmine/jasmine-gem/issues)
|
||||
- [Jasmine py](https://github.com/jasmine/jasmine-py/issues)
|
||||
- [Gulp Jasmine Browser](https://github.com/jasmine/gulp-jasmine-browser/issues)
|
||||
- [Karma](https://github.com/karma-runner/karma/issues)
|
||||
- [Grunt Contrib Jasmine](https://github.com/gruntjs/grunt-contrib-jasmine/issues)
|
||||
|
||||
<!--- Provide a general summary of the issue in the Title above -->
|
||||
|
||||
## Expected Behavior
|
||||
<!--- If you're describing a bug, tell us what should happen -->
|
||||
<!--- If you're suggesting a change/improvement, tell us how it should work -->
|
||||
|
||||
## Current Behavior
|
||||
<!--- If describing a bug, tell us what happens instead of the expected behavior -->
|
||||
<!--- If suggesting a change/improvement, explain the difference from current behavior -->
|
||||
|
||||
## Possible Solution
|
||||
<!--- Not obligatory, but suggest a fix/reason for the bug, -->
|
||||
<!--- or ideas how to implement the addition or change -->
|
||||
|
||||
## Suite that reproduces the behavior (for bugs)
|
||||
<!--- Provide a sample suite that reproduces the bug. -->
|
||||
```javascript
|
||||
describe("sample", function() {
|
||||
});
|
||||
```
|
||||
## Context
|
||||
<!--- How has this issue affected you? What are you trying to accomplish? -->
|
||||
<!--- Providing context helps us come up with a solution that is most useful in the real world -->
|
||||
|
||||
## Your Environment
|
||||
<!--- Include as many relevant details about the environment you experienced the bug in -->
|
||||
* Version used:
|
||||
* Environment name and version (e.g. Chrome 39, node.js 5.4):
|
||||
* Operating System and version (desktop or mobile):
|
||||
* Link to your project:
|
||||
30
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
30
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
<!--- Provide a general summary of your changes in the Title above -->
|
||||
|
||||
## Description
|
||||
<!--- Describe your changes in detail -->
|
||||
|
||||
## Motivation and Context
|
||||
<!--- Why is this change required? What problem does it solve? -->
|
||||
<!--- If it fixes an open issue, please link to the issue here. -->
|
||||
|
||||
## How Has This Been Tested?
|
||||
<!--- Please describe in detail how you tested your changes. -->
|
||||
<!--- Include details of your testing environment, and the tests you ran to -->
|
||||
<!--- see how your change affects other areas of the code, etc. -->
|
||||
|
||||
## Types of changes
|
||||
<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->
|
||||
- [ ] Bug fix (non-breaking change which fixes an issue)
|
||||
- [ ] New feature (non-breaking change which adds functionality)
|
||||
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
|
||||
|
||||
## Checklist:
|
||||
<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->
|
||||
<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->
|
||||
- [ ] My code follows the code style of this project.
|
||||
- [ ] My change requires a change to the documentation.
|
||||
- [ ] I have updated the documentation accordingly.
|
||||
- [ ] I have read the **CONTRIBUTING** document.
|
||||
- [ ] I have added tests to cover my changes.
|
||||
- [ ] All new and existing tests passed.
|
||||
|
||||
4
.gitignore
vendored
4
.gitignore
vendored
@@ -11,6 +11,7 @@ site/
|
||||
.bundle
|
||||
tags
|
||||
Gemfile.lock
|
||||
package-lock.json
|
||||
pkg/*
|
||||
.sass-cache/*
|
||||
src/html/.sass-cache/*
|
||||
@@ -20,5 +21,6 @@ sauce_connect.log
|
||||
*.swp
|
||||
build/
|
||||
*.egg-info/
|
||||
dist/*.tar.gz
|
||||
dist
|
||||
nbproject/
|
||||
*.iml
|
||||
|
||||
16
.npmignore
16
.npmignore
@@ -1,7 +1,7 @@
|
||||
dist/
|
||||
grunt/
|
||||
images/
|
||||
node_modules
|
||||
pkg/
|
||||
release_notes/
|
||||
spec/
|
||||
src/
|
||||
@@ -9,12 +9,20 @@ Gemfile
|
||||
Gemfile.lock
|
||||
Rakefile
|
||||
jasmine-core.gemspec
|
||||
.rspec
|
||||
.travis.yml
|
||||
.jshintrc
|
||||
.bundle/
|
||||
.gitignore
|
||||
.gitmodules
|
||||
.idea
|
||||
.jshintrc
|
||||
.rspec
|
||||
.sass-cache/
|
||||
.travis.yml
|
||||
*.sh
|
||||
*.py
|
||||
Gruntfile.js
|
||||
lib/jasmine-core.rb
|
||||
lib/jasmine-core/boot/
|
||||
lib/jasmine-core/spec
|
||||
lib/jasmine-core/version.rb
|
||||
lib/jasmine-core/*.py
|
||||
sauce_connect.log
|
||||
|
||||
111
.travis.yml
111
.travis.yml
@@ -1,51 +1,72 @@
|
||||
---
|
||||
script: $TEST_COMMAND
|
||||
language: ruby
|
||||
cache: bundler
|
||||
rvm: 1.9.3
|
||||
sudo: false
|
||||
|
||||
rvm: 2.2.2
|
||||
|
||||
script: $TEST_COMMAND
|
||||
|
||||
env:
|
||||
global:
|
||||
- USE_SAUCE=true
|
||||
- NOKOGIRI_USE_SYSTEM_LIBRARIES=true
|
||||
- TEST_COMMAND="bash travis-core-script.sh"
|
||||
- JASMINE_BROWSER="firefox"
|
||||
- SAUCE_OS="Linux"
|
||||
- SAUCE_BROWSER_VERSION=''
|
||||
- secure: WSPWhlnC4mWSnSPquX+m1/BCu5ch5NygkaHuM2Nea7lD8oS3XLX8QncZZAsQ4lnNfqoDDuBOizG0AESiqNvE4y6x5qvLLTS6q+ce255ZEMZ71TBdZgDEEvGMEjOPPsVXiXyTQOP1lwOPlrbZvaPgWV7e11KIBab6DfFcQpnvDgo=
|
||||
- secure: SW7CJhZnwaNT749Gdnhvqb5rbXlAOsygUAzh9qhtyvbqXKkmJdBIEsO01YF6pbju1X2twE9JvWCOxeZju43NgQChJlPsGbjY2j3k/TdQeTAJesQe2K7ytwghunI30gjEovtRH0T3w1EmcKPH8yj5eBIcB2OYoJHx8KEC7e68q1g=
|
||||
matrix:
|
||||
include:
|
||||
- env:
|
||||
- USE_SAUCE=false
|
||||
- TEST_COMMAND="bash travis-node-script.sh"
|
||||
- env:
|
||||
- JASMINE_BROWSER="safari"
|
||||
- SAUCE_OS="OS X 10.8"
|
||||
- SAUCE_BROWSER_VERSION=6
|
||||
- env:
|
||||
- JASMINE_BROWSER="safari"
|
||||
- SAUCE_OS="OS X 10.6"
|
||||
- SAUCE_BROWSER_VERSION=5
|
||||
- env:
|
||||
- JASMINE_BROWSER="internet explorer"
|
||||
- SAUCE_OS="Windows 8"
|
||||
- SAUCE_BROWSER_VERSION=10
|
||||
- env:
|
||||
- JASMINE_BROWSER="internet explorer"
|
||||
- SAUCE_OS="Windows 7"
|
||||
- SAUCE_BROWSER_VERSION=9
|
||||
- env:
|
||||
- JASMINE_BROWSER="internet explorer"
|
||||
- SAUCE_OS="Windows 7"
|
||||
- SAUCE_BROWSER_VERSION=8
|
||||
- env:
|
||||
- JASMINE_BROWSER="chrome"
|
||||
- USE_SAUCE=true
|
||||
- NOKOGIRI_USE_SYSTEM_LIBRARIES=true
|
||||
- TEST_COMMAND="bash travis-core-script.sh"
|
||||
- JASMINE_BROWSER="firefox"
|
||||
- SAUCE_OS="Linux"
|
||||
- SAUCE_BROWSER_VERSION=''
|
||||
- env:
|
||||
- JASMINE_BROWSER="phantomjs"
|
||||
- USE_SAUCE=false
|
||||
- env:
|
||||
- USE_SAUCE=false
|
||||
- JASMINE_BROWSER="phantomjs"
|
||||
- TEST_COMMAND="bash travis-docs-script.sh"
|
||||
- secure: WSPWhlnC4mWSnSPquX+m1/BCu5ch5NygkaHuM2Nea7lD8oS3XLX8QncZZAsQ4lnNfqoDDuBOizG0AESiqNvE4y6x5qvLLTS6q+ce255ZEMZ71TBdZgDEEvGMEjOPPsVXiXyTQOP1lwOPlrbZvaPgWV7e11KIBab6DfFcQpnvDgo=
|
||||
- secure: SW7CJhZnwaNT749Gdnhvqb5rbXlAOsygUAzh9qhtyvbqXKkmJdBIEsO01YF6pbju1X2twE9JvWCOxeZju43NgQChJlPsGbjY2j3k/TdQeTAJesQe2K7ytwghunI30gjEovtRH0T3w1EmcKPH8yj5eBIcB2OYoJHx8KEC7e68q1g=
|
||||
|
||||
addons:
|
||||
sauce_connect: true
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- env:
|
||||
- USE_SAUCE=false
|
||||
- TEST_COMMAND="bash travis-node-script.sh v4"
|
||||
- env:
|
||||
- USE_SAUCE=false
|
||||
- TEST_COMMAND="bash travis-node-script.sh v8"
|
||||
- env:
|
||||
- USE_SAUCE=false
|
||||
- TEST_COMMAND="bash travis-node-script.sh v9"
|
||||
- env:
|
||||
- JASMINE_BROWSER="safari"
|
||||
- SAUCE_OS="OS X 10.12"
|
||||
- SAUCE_BROWSER_VERSION=10
|
||||
- env:
|
||||
- JASMINE_BROWSER="safari"
|
||||
- SAUCE_OS="OS X 10.11"
|
||||
- SAUCE_BROWSER_VERSION=9
|
||||
- env:
|
||||
- JASMINE_BROWSER="safari"
|
||||
- SAUCE_OS="OS X 10.10"
|
||||
- SAUCE_BROWSER_VERSION=8
|
||||
- env:
|
||||
- JASMINE_BROWSER="safari"
|
||||
- SAUCE_OS="OS X 10.9"
|
||||
- SAUCE_BROWSER_VERSION=7
|
||||
- env:
|
||||
- JASMINE_BROWSER="MicrosoftEdge"
|
||||
- SAUCE_OS="Windows 10"
|
||||
- SAUCE_BROWSER_VERSION="15"
|
||||
- env:
|
||||
- JASMINE_BROWSER="internet explorer"
|
||||
- SAUCE_OS="Windows 8.1"
|
||||
- SAUCE_BROWSER_VERSION=11
|
||||
- env:
|
||||
- JASMINE_BROWSER="internet explorer"
|
||||
- SAUCE_OS="Windows 8"
|
||||
- SAUCE_BROWSER_VERSION=10
|
||||
- env:
|
||||
- JASMINE_BROWSER="chrome"
|
||||
- SAUCE_OS="Linux"
|
||||
- SAUCE_BROWSER_VERSION=''
|
||||
- env:
|
||||
- JASMINE_BROWSER="phantomjs"
|
||||
- USE_SAUCE=false
|
||||
- env:
|
||||
- USE_SAUCE=false
|
||||
- JASMINE_BROWSER="phantomjs"
|
||||
- TEST_COMMAND="bash travis-docs-script.sh"
|
||||
|
||||
46
CODE_OF_CONDUCT.md
Normal file
46
CODE_OF_CONDUCT.md
Normal file
@@ -0,0 +1,46 @@
|
||||
# Contributor Covenant Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to creating a positive environment include:
|
||||
|
||||
* Using welcoming and inclusive language
|
||||
* Being respectful of differing viewpoints and experiences
|
||||
* Gracefully accepting constructive criticism
|
||||
* Focusing on what is best for the community
|
||||
* Showing empathy towards other community members
|
||||
|
||||
Examples of unacceptable behavior by participants include:
|
||||
|
||||
* The use of sexualized language or imagery and unwelcome sexual attention or advances
|
||||
* Trolling, insulting/derogatory comments, and personal or political attacks
|
||||
* Public or private harassment
|
||||
* Publishing others' private information, such as a physical or electronic address, without explicit permission
|
||||
* Other conduct which could reasonably be considered inappropriate in a professional setting
|
||||
|
||||
## Our Responsibilities
|
||||
|
||||
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
|
||||
|
||||
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at jasmine-maintainers@googlegroups.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
|
||||
|
||||
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
|
||||
|
||||
[homepage]: http://contributor-covenant.org
|
||||
[version]: http://contributor-covenant.org/version/1/4/
|
||||
64
GOALS_2.0.md
64
GOALS_2.0.md
@@ -1,64 +0,0 @@
|
||||
# (Vague) Jasmine 2.0 Goals/(Guidelines)
|
||||
|
||||
1. No globals!
|
||||
* jasmine library is entirely inside `jasmine` namespace
|
||||
* globals required for backwards compatibility should be added in `boot.js` (EG, var describe = jasmine.getCurrentEnv().describe lives in boot.js)
|
||||
1. Don't use properties as getters. Use methods.
|
||||
* Properties aren't encapsulated -- can be mutated, unsafe.
|
||||
1. Reporters get data objects (no methods).
|
||||
* easier to refactor as needed
|
||||
1. More unit tests - fewer nasty integration tests
|
||||
|
||||
## Remaining non-story-able work:
|
||||
* Make a `TODO` list
|
||||
|
||||
### Hard
|
||||
* Finish killing Globals
|
||||
* Guidelines:
|
||||
* New objects can have constructors on `jasmine`
|
||||
* Top level functions can live on `jasmine`
|
||||
* Top level (i.e., any `jasmine` property) should only be referenced inside the `Env` constructor
|
||||
* should better allow any object to get jasmine code (Node-friendly)
|
||||
* review everything in base.js
|
||||
* Remove isA functions:
|
||||
* isArray_ - used in matchers and spies
|
||||
* isString_
|
||||
* isDOMNode_
|
||||
* isA_
|
||||
* unimplementedMethod_, used by PrettyPrinter
|
||||
* jasmine.util should be util closure inside of env or something
|
||||
* argsToArray is used for Spies and matching (and can be replaced)
|
||||
* inherit is only for PrettyPrinter now
|
||||
* formatException is used only inside Env/spec
|
||||
* htmlEscape is for messages in matchers - should this be HTML at all?
|
||||
* Pretty printing
|
||||
* move away from pretty printer and to a JSON.stringify implementation?
|
||||
* jasmineToString vs. custom toString ?
|
||||
|
||||
### Easy
|
||||
|
||||
* unify params to ctors: options vs. attrs.
|
||||
* This will be a lot of the TODOs, but clean up & simplify Env.js (is this a 2.1 task?)
|
||||
|
||||
### DONE
|
||||
* Matchers improvements
|
||||
* unit testable DONE
|
||||
* better equality (from Underscore) DONE
|
||||
* addCustomMatchers doesn't explode stack DONE
|
||||
* refactor equals function so that it just loops & recurses over a list of fns (custom and built-in) - 2.1? (Tracker story)
|
||||
* Spies
|
||||
* break these out into their own tests/file DONE
|
||||
|
||||
|
||||
## Other Topics
|
||||
|
||||
* Docs
|
||||
* Docco has gone over well. Should we annotate all the sources and then have Pages be more complex, having tutorials and annotated source like Backbone? Are we small enough?
|
||||
* Need examples for:
|
||||
* How to build a Custom Matcher
|
||||
* How to add a custom equality tester
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
11
Gemfile
11
Gemfile
@@ -1,12 +1,9 @@
|
||||
source 'https://rubygems.org'
|
||||
gem "jasmine", :git => 'https://github.com/pivotal/jasmine-gem.git'
|
||||
# gem "jasmine", path: "/Users/pivotal/workspace/jasmine-gem"
|
||||
unless ENV["TRAVIS"]
|
||||
group :debug do
|
||||
gem 'debugger'
|
||||
end
|
||||
end
|
||||
gem "jasmine", :git => 'https://github.com/jasmine/jasmine-gem.git'
|
||||
# gem "jasmine", path: "../jasmine-gem"
|
||||
|
||||
gemspec
|
||||
|
||||
gem "jasmine_selenium_runner", :github => 'jasmine/jasmine_selenium_runner'
|
||||
|
||||
gem "anchorman"
|
||||
|
||||
16
Gruntfile.js
16
Gruntfile.js
@@ -17,7 +17,6 @@ module.exports = function(grunt) {
|
||||
grunt.registerTask('default', ['jshint:all']);
|
||||
|
||||
var version = require('./grunt/tasks/version.js');
|
||||
var standaloneBuilder = require('./grunt/tasks/build_standalone.js');
|
||||
|
||||
grunt.registerTask('build:copyVersionToGem',
|
||||
"Propagates the version from package.json to version.rb",
|
||||
@@ -37,10 +36,17 @@ module.exports = function(grunt) {
|
||||
grunt.registerTask("execSpecsInNode",
|
||||
"Run Jasmine core specs in Node.js",
|
||||
function() {
|
||||
var exitInfo = require("shelljs").exec("node_modules/.bin/jasmine");
|
||||
if (exitInfo.code !== 0) {
|
||||
grunt.fail.fatal("Specs Failed", exitInfo.code);
|
||||
}
|
||||
var done = this.async(),
|
||||
Jasmine = require('jasmine'),
|
||||
jasmineCore = require('./lib/jasmine-core.js'),
|
||||
jasmine = new Jasmine({jasmineCore: jasmineCore});
|
||||
|
||||
jasmine.loadConfigFile('./spec/support/jasmine.json');
|
||||
jasmine.onComplete(function(passed) {
|
||||
done(passed);
|
||||
});
|
||||
|
||||
jasmine.execute();
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
recursive-include . *.py
|
||||
prune node_modules
|
||||
include lib/jasmine-core/*.js
|
||||
include lib/jasmine-core/*.css
|
||||
include images/*.png
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Copyright (c) 2008-2014 Pivotal Labs
|
||||
Copyright (c) 2008-2017 Pivotal Labs
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
|
||||
68
README.md
68
README.md
@@ -1,47 +1,56 @@
|
||||
<a name="README">[<img src="https://rawgithub.com/pivotal/jasmine/master/images/jasmine-horizontal.svg" width="400px" />](http://jasmine.github.io)</a>
|
||||
<a name="README">[<img src="https://rawgithub.com/jasmine/jasmine/master/images/jasmine-horizontal.svg" width="400px" />](http://jasmine.github.io)</a>
|
||||
|
||||
[](https://travis-ci.org/pivotal/jasmine) [](https://codeclimate.com/github/pivotal/jasmine)
|
||||
[](https://travis-ci.org/jasmine/jasmine)
|
||||
|
||||
=======
|
||||
|
||||
**A JavaScript Testing Framework**
|
||||
# A JavaScript Testing Framework
|
||||
|
||||
Jasmine is a Behavior Driven Development testing framework for JavaScript. It does not rely on browsers, DOM, or any JavaScript framework. Thus it's suited for websites, [Node.js](http://nodejs.org) projects, or anywhere that JavaScript can run.
|
||||
|
||||
Documentation & guides live here: [http://jasmine.github.io](http://jasmine.github.io/)
|
||||
For a quick start guide of Jasmine 2.0, see the beginning of [http://jasmine.github.io/2.0/introduction.html](http://jasmine.github.io/2.0/introduction.html)
|
||||
Documentation & guides live here: [http://jasmine.github.io](http://jasmine.github.io/)
|
||||
For a quick start guide of Jasmine 2.x, see the beginning of [http://jasmine.github.io/edge/introduction.html](http://jasmine.github.io/edge/introduction.html)
|
||||
|
||||
Upgrading from Jasmine 1.x? Check out the [2.0 release notes](https://github.com/pivotal/jasmine/blob/v2.0.0/release_notes/20.md) for a list of what's new (including breaking interface changes).
|
||||
Upgrading from Jasmine 1.x? Check out the [2.0 release notes](https://github.com/jasmine/jasmine/blob/v2.0.0/release_notes/20.md) for a list of what's new (including breaking interface changes). You can also read the [upgrade guide](http://jasmine.github.io/2.0/upgrading.html).
|
||||
|
||||
## Contributing
|
||||
|
||||
Please read the [contributors' guide](https://github.com/pivotal/jasmine/blob/master/CONTRIBUTING.md)
|
||||
Please read the [contributors' guide](https://github.com/jasmine/jasmine/blob/master/.github/CONTRIBUTING.md)
|
||||
|
||||
## Installation
|
||||
|
||||
To install Jasmine on your local box:
|
||||
For the Jasmine NPM module:<br>
|
||||
[https://github.com/jasmine/jasmine-npm](https://github.com/jasmine/jasmine-npm)
|
||||
|
||||
* Clone Jasmine - `git clone https://github.com/pivotal/jasmine.git`
|
||||
For the Jasmine Ruby Gem:<br>
|
||||
[https://github.com/jasmine/jasmine-gem](https://github.com/jasmine/jasmine-gem)
|
||||
|
||||
For the Jasmine Python Egg:<br>
|
||||
[https://github.com/jasmine/jasmine-py](https://github.com/jasmine/jasmine-py)
|
||||
|
||||
For the Jasmine headless browser gulp plugin:<br>
|
||||
[https://github.com/jasmine/gulp-jasmine-browser](https://github.com/jasmine/gulp-jasmine-browser)
|
||||
|
||||
To install Jasmine standalone on your local box (where **_{#.#.#}_** below is substituted by the release number downloaded):
|
||||
|
||||
* Download the standalone distribution for your desired release from the [releases page](https://github.com/jasmine/jasmine/releases)
|
||||
* Create a Jasmine directory in your project - `mkdir my-project/jasmine`
|
||||
* Move latest dist to your project directory - `mv jasmine/dist/jasmine-standalone-2.0.0.zip my-project/jasmine`
|
||||
* Move the dist to your project directory - `mv jasmine/dist/jasmine-standalone-{#.#.#}.zip my-project/jasmine`
|
||||
* Change directory - `cd my-project/jasmine`
|
||||
* Unzip the dist - `unzip jasmine-standalone-2.0.0.zip`
|
||||
* Unzip the dist - `unzip jasmine-standalone-{#.#.#}.zip`
|
||||
|
||||
Add the following to your HTML file:
|
||||
|
||||
<link rel="shortcut icon" type="image/png" href="jasmine/lib/jasmine-2.0.0/jasmine_favicon.png">
|
||||
<link rel="stylesheet" type="text/css" href="jasmine/lib/jasmine-2.0.0/jasmine.css">
|
||||
```html
|
||||
<link rel="shortcut icon" type="image/png" href="jasmine/lib/jasmine-{#.#.#}/jasmine_favicon.png">
|
||||
<link rel="stylesheet" type="text/css" href="jasmine/lib/jasmine-{#.#.#}/jasmine.css">
|
||||
|
||||
<script type="text/javascript" src="jasmine/lib/jasmine-2.0.0/jasmine.js"></script>
|
||||
<script type="text/javascript" src="jasmine/lib/jasmine-2.0.0/jasmine-html.js"></script>
|
||||
<script type="text/javascript" src="jasmine/lib/jasmine-2.0.0/boot.js"></script>
|
||||
<script type="text/javascript" src="jasmine/lib/jasmine-{#.#.#}/jasmine.js"></script>
|
||||
<script type="text/javascript" src="jasmine/lib/jasmine-{#.#.#}/jasmine-html.js"></script>
|
||||
<script type="text/javascript" src="jasmine/lib/jasmine-{#.#.#}/boot.js"></script>
|
||||
```
|
||||
|
||||
For the Jasmine Ruby Gem:<br>
|
||||
[https://github.com/pivotal/jasmine-gem](https://github.com/pivotal/jasmine-gem)
|
||||
|
||||
For the Jasmine Python Egg:<br>
|
||||
[https://github.com/pivotal/jasmine-py](https://github.com/pivotal/jasmine-py)
|
||||
## Supported environments
|
||||
|
||||
Jasmine tests itself across many browsers (Safari, Chrome, Firefox, PhantomJS, Microsoft Edge, and new Internet Explorer) as well as nodejs. To see the exact version tests are run against look at our [.travis.yml](https://github.com/jasmine/jasmine/blob/master/.travis.yml)
|
||||
|
||||
|
||||
## Support
|
||||
@@ -53,12 +62,15 @@ For the Jasmine Python Egg:<br>
|
||||
|
||||
## Maintainers
|
||||
|
||||
* [Davis W. Frank](mailto:dwfrank@pivotallabs.com), Pivotal Labs
|
||||
* [Rajan Agaskar](mailto:rajan@pivotallabs.com), Pivotal Labs
|
||||
* [Sheel Choksi](mailto:schoksi@pivotallabs.com), Pivotal Labs
|
||||
* [Gregg Van Hove](mailto:gvanhove@pivotal.io), Pivotal Labs
|
||||
|
||||
### Maintainers Emeritus
|
||||
|
||||
* [Christian Williams](mailto:antixian666@gmail.com), Square
|
||||
* [Davis W. Frank](mailto:dwfrank@pivotal.io), Pivotal Labs
|
||||
* [Rajan Agaskar](mailto:rajan@pivotal.io), Pivotal Labs
|
||||
* [Greg Cobb](mailto:gcobb@pivotal.io), Pivotal Labs
|
||||
* [Chris Amavisca](mailto:camavisca@pivotal.io), Pivotal Labs
|
||||
* [Christian Williams](mailto:antixian666@gmail.com), Cloud Foundry
|
||||
* Sheel Choksi
|
||||
|
||||
Copyright (c) 2008-2014 Pivotal Labs. This software is licensed under the MIT License.
|
||||
Copyright (c) 2008-2017 Pivotal Labs. This software is licensed under the MIT License.
|
||||
|
||||
29
RELEASE.md
29
RELEASE.md
@@ -7,19 +7,22 @@ Follow the instructions in `CONTRIBUTING.md` during development.
|
||||
|
||||
### Git Rules
|
||||
|
||||
Please work on feature branches.
|
||||
|
||||
Please attempt to keep commits to `master` small, but cohesive. If a feature is contained in a bunch of small commits (e.g., it has several wip commits or small work), please squash them when merging back to `master`.
|
||||
Please attempt to keep commits to `master` small, but cohesive. If a feature is contained in a bunch of small commits (e.g., it has several wip commits or small work), please squash them when pushing to `master`.
|
||||
|
||||
### Version
|
||||
|
||||
We attempt to stick to [Semantic Versioning](http://semver.org/). Most of the time, development should be against a new minor version - fixing bugs and adding new features that are backwards compatible.
|
||||
|
||||
The current version lives in the file `/package.json`. This file should be set to the version that is _currently_ under development. That is, if version 1.0.0 is the current release then version should be incremented say, to 1.1.0.
|
||||
The current version lives in the file `/package.json`. This version will be the version number that is currently released. When releasing a new version, update `package.json` with the new version and `grunt build:copyVersionToGem` to update the gem version number.
|
||||
|
||||
This version is used by both `jasmine.js` and the `jasmine-core` Ruby gem.
|
||||
|
||||
Note that Jasmine should *not* use the "patch" version number. Let downstream projects rev their patch versions as needed, keeping their major and minor version numbers in sync with Jasmine core.
|
||||
Note that Jasmine should only use the "patch" version number in the following cases:
|
||||
|
||||
* Changes related to packaging for a specific platform (npm, gem, or pip).
|
||||
* Fixes for regressions.
|
||||
|
||||
When jasmine-core revs its major or minor version, the binding libraries should also rev to that version.
|
||||
|
||||
## Release
|
||||
|
||||
@@ -32,12 +35,13 @@ When ready to release - specs are all green and the stories are done:
|
||||
### Build standalone distribution
|
||||
|
||||
1. Build the standalone distribution with `grunt buildStandaloneDist`
|
||||
1. Make sure you add the new ZIP file to git
|
||||
1. Should we still do this? Given we want to use guthub releases...
|
||||
|
||||
### Release the Python egg
|
||||
|
||||
1. `python setup.py register sdist upload` You will need pypi credentials to upload the egg.
|
||||
Install [twine](https://github.com/pypa/twine)
|
||||
|
||||
1. `python setup.py sdist`
|
||||
1. `twine upload dist/jasmine-core-<version>.tar.gz` You will need pypi credentials to upload the egg.
|
||||
|
||||
### Release the Ruby gem
|
||||
|
||||
@@ -52,9 +56,16 @@ When ready to release - specs are all green and the stories are done:
|
||||
1. `npm adduser` to save your credentials locally
|
||||
1. `npm publish .` to publish what's in `package.json`
|
||||
|
||||
### Release the docs
|
||||
|
||||
Probably only need to do this when releasing a minor version, and not a patch version.
|
||||
|
||||
1. `cp -R edge ${version}` to copy the current edge docs to the new version
|
||||
1. Add a link to the new version in `index.html`
|
||||
|
||||
### Finally
|
||||
|
||||
1. Visit the [Releases page for Jasmine](https://github.com/pivotal/jasmine/releases), find the tag just pushed.
|
||||
1. Visit the [Releases page for Jasmine](https://github.com/jasmine/jasmine/releases), find the tag just pushed.
|
||||
1. Paste in a link to the correct release notes for this release. The link should reference the blob and tag correctly, and the markdown file for the notes.
|
||||
1. If it is a pre-release, mark it as such.
|
||||
1. Attach the standalone zipfile
|
||||
|
||||
40
bower.json
Normal file
40
bower.json
Normal file
@@ -0,0 +1,40 @@
|
||||
{
|
||||
"name": "jasmine-core",
|
||||
"homepage": "https://jasmine.github.io",
|
||||
"authors": [
|
||||
"slackersoft <gregg@slackersoft.net>"
|
||||
],
|
||||
"description": "Official packaging of Jasmine's core files",
|
||||
"keywords": [
|
||||
"test",
|
||||
"jasmine",
|
||||
"tdd",
|
||||
"bdd"
|
||||
],
|
||||
"license": "MIT",
|
||||
"moduleType": "globals",
|
||||
"main": "lib/jasmine-core/jasmine.js",
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"dist",
|
||||
"grunt",
|
||||
"node_modules",
|
||||
"pkg",
|
||||
"release_notes",
|
||||
"spec",
|
||||
"src",
|
||||
"Gemfile",
|
||||
"Gemfile.lock",
|
||||
"Rakefile",
|
||||
"jasmine-core.gemspec",
|
||||
"*.sh",
|
||||
"*.py",
|
||||
"Gruntfile.js",
|
||||
"lib/jasmine-core.rb",
|
||||
"lib/jasmine-core/boot/",
|
||||
"lib/jasmine-core/spec",
|
||||
"lib/jasmine-core/version.rb",
|
||||
"lib/jasmine-core/*.py",
|
||||
"sauce_connect.log"
|
||||
]
|
||||
}
|
||||
BIN
dist/jasmine-standalone-1.0.0.zip
vendored
BIN
dist/jasmine-standalone-1.0.0.zip
vendored
Binary file not shown.
BIN
dist/jasmine-standalone-1.1.0.zip
vendored
BIN
dist/jasmine-standalone-1.1.0.zip
vendored
Binary file not shown.
BIN
dist/jasmine-standalone-1.2.0.zip
vendored
BIN
dist/jasmine-standalone-1.2.0.zip
vendored
Binary file not shown.
BIN
dist/jasmine-standalone-1.3.0.zip
vendored
BIN
dist/jasmine-standalone-1.3.0.zip
vendored
Binary file not shown.
BIN
dist/jasmine-standalone-1.3.1.zip
vendored
BIN
dist/jasmine-standalone-1.3.1.zip
vendored
Binary file not shown.
BIN
dist/jasmine-standalone-2.0.0.zip
vendored
BIN
dist/jasmine-standalone-2.0.0.zip
vendored
Binary file not shown.
BIN
dist/jasmine-standalone-2.0.1.zip
vendored
BIN
dist/jasmine-standalone-2.0.1.zip
vendored
Binary file not shown.
BIN
dist/jasmine-standalone-2.0.2.zip
vendored
BIN
dist/jasmine-standalone-2.0.2.zip
vendored
Binary file not shown.
@@ -5,6 +5,7 @@ module.exports = {
|
||||
sassDir: 'src/html',
|
||||
outputStyle: 'compact',
|
||||
noLineComments: true,
|
||||
bundleExec: true
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -2,7 +2,6 @@ var standaloneLibDir = "lib/jasmine-" + jasmineVersion;
|
||||
|
||||
function root(path) { return "./" + path; }
|
||||
function libJasmineCore(path) { return root("lib/jasmine-core/" + path); }
|
||||
function libConsole() { return "lib/console/" }
|
||||
function dist(path) { return root("dist/" + path); }
|
||||
|
||||
module.exports = {
|
||||
@@ -29,14 +28,6 @@ module.exports = {
|
||||
expand: true,
|
||||
cwd: libJasmineCore("")
|
||||
},
|
||||
{
|
||||
src: [
|
||||
"console.js"
|
||||
],
|
||||
dest: standaloneLibDir,
|
||||
expand: true,
|
||||
cwd: libConsole()
|
||||
},
|
||||
{
|
||||
src: [ "boot.js" ],
|
||||
dest: standaloneLibDir,
|
||||
|
||||
@@ -15,7 +15,8 @@ module.exports = {
|
||||
'src/html/HtmlReporter.js',
|
||||
'src/html/HtmlSpecFilter.js',
|
||||
'src/html/ResultsNode.js',
|
||||
'src/html/QueryString.js'
|
||||
'src/html/QueryString.js',
|
||||
'src/html/**/*.js'
|
||||
],
|
||||
dest: 'lib/jasmine-core/jasmine-html.js'
|
||||
},
|
||||
@@ -26,6 +27,7 @@ module.exports = {
|
||||
'src/core/base.js',
|
||||
'src/core/util.js',
|
||||
'src/core/Spec.js',
|
||||
'src/core/Order.js',
|
||||
'src/core/Env.js',
|
||||
'src/core/JsApiReporter.js',
|
||||
'src/core/PrettyPrinter',
|
||||
@@ -43,13 +45,6 @@ module.exports = {
|
||||
src: ['lib/jasmine-core/boot/node_boot.js'],
|
||||
dest: 'lib/jasmine-core/node_boot.js'
|
||||
},
|
||||
console: {
|
||||
src: [
|
||||
'src/console/requireConsole.js',
|
||||
'src/console/ConsoleReporter.js'
|
||||
],
|
||||
dest: 'lib/console/console.js'
|
||||
},
|
||||
options: {
|
||||
banner: license(),
|
||||
process: {
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
<!DOCTYPE HTML>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<meta charset="utf-8">
|
||||
<title>Jasmine Spec Runner v<%= jasmineVersion %></title>
|
||||
|
||||
<link rel="shortcut icon" type="image/png" href="lib/jasmine-<%= jasmineVersion %>/jasmine_favicon.png">
|
||||
<link rel="stylesheet" type="text/css" href="lib/jasmine-<%= jasmineVersion %>/jasmine.css">
|
||||
<link rel="stylesheet" href="lib/jasmine-<%= jasmineVersion %>/jasmine.css">
|
||||
|
||||
<script type="text/javascript" src="lib/jasmine-<%= jasmineVersion %>/jasmine.js"></script>
|
||||
<script type="text/javascript" src="lib/jasmine-<%= jasmineVersion %>/jasmine-html.js"></script>
|
||||
<script type="text/javascript" src="lib/jasmine-<%= jasmineVersion %>/boot.js"></script>
|
||||
<script src="lib/jasmine-<%= jasmineVersion %>/jasmine.js"></script>
|
||||
<script src="lib/jasmine-<%= jasmineVersion %>/jasmine-html.js"></script>
|
||||
<script src="lib/jasmine-<%= jasmineVersion %>/boot.js"></script>
|
||||
|
||||
<!-- include source files here... -->
|
||||
<script type="text/javascript" src="src/Player.js"></script>
|
||||
<script type="text/javascript" src="src/Song.js"></script>
|
||||
<script src="src/Player.js"></script>
|
||||
<script src="src/Song.js"></script>
|
||||
|
||||
<!-- include spec files here... -->
|
||||
<script type="text/javascript" src="spec/SpecHelper.js"></script>
|
||||
<script type="text/javascript" src="spec/PlayerSpec.js"></script>
|
||||
<script src="spec/SpecHelper.js"></script>
|
||||
<script src="spec/PlayerSpec.js"></script>
|
||||
|
||||
</head>
|
||||
|
||||
|
||||
@@ -6,11 +6,11 @@ Gem::Specification.new do |s|
|
||||
s.name = "jasmine-core"
|
||||
s.version = Jasmine::Core::VERSION
|
||||
s.platform = Gem::Platform::RUBY
|
||||
s.authors = ["Rajan Agaskar", "Davis W. Frank", "Christian Williams"]
|
||||
s.authors = ["Gregg Van Hove"]
|
||||
s.summary = %q{JavaScript BDD framework}
|
||||
s.description = %q{Test your JavaScript without any framework dependencies, in any environment, and with a nice descriptive syntax.}
|
||||
s.email = %q{jasmine-js@googlegroups.com}
|
||||
s.homepage = "http://pivotal.github.com/jasmine"
|
||||
s.homepage = "http://jasmine.github.io"
|
||||
s.rubyforge_project = "jasmine-core"
|
||||
s.license = "MIT"
|
||||
|
||||
|
||||
@@ -1,166 +0,0 @@
|
||||
/*
|
||||
Copyright (c) 2008-2014 Pivotal Labs
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
function getJasmineRequireObj() {
|
||||
if (typeof module !== 'undefined' && module.exports) {
|
||||
return exports;
|
||||
} else {
|
||||
window.jasmineRequire = window.jasmineRequire || {};
|
||||
return window.jasmineRequire;
|
||||
}
|
||||
}
|
||||
|
||||
getJasmineRequireObj().console = function(jRequire, j$) {
|
||||
j$.ConsoleReporter = jRequire.ConsoleReporter();
|
||||
};
|
||||
|
||||
getJasmineRequireObj().ConsoleReporter = function() {
|
||||
|
||||
var noopTimer = {
|
||||
start: function(){},
|
||||
elapsed: function(){ return 0; }
|
||||
};
|
||||
|
||||
function ConsoleReporter(options) {
|
||||
var print = options.print,
|
||||
showColors = options.showColors || false,
|
||||
onComplete = options.onComplete || function() {},
|
||||
timer = options.timer || noopTimer,
|
||||
specCount,
|
||||
failureCount,
|
||||
failedSpecs = [],
|
||||
pendingCount,
|
||||
ansi = {
|
||||
green: '\x1B[32m',
|
||||
red: '\x1B[31m',
|
||||
yellow: '\x1B[33m',
|
||||
none: '\x1B[0m'
|
||||
};
|
||||
|
||||
this.jasmineStarted = function() {
|
||||
specCount = 0;
|
||||
failureCount = 0;
|
||||
pendingCount = 0;
|
||||
print('Started');
|
||||
printNewline();
|
||||
timer.start();
|
||||
};
|
||||
|
||||
this.jasmineDone = function() {
|
||||
printNewline();
|
||||
for (var i = 0; i < failedSpecs.length; i++) {
|
||||
specFailureDetails(failedSpecs[i]);
|
||||
}
|
||||
|
||||
if(specCount > 0) {
|
||||
printNewline();
|
||||
|
||||
var specCounts = specCount + ' ' + plural('spec', specCount) + ', ' +
|
||||
failureCount + ' ' + plural('failure', failureCount);
|
||||
|
||||
if (pendingCount) {
|
||||
specCounts += ', ' + pendingCount + ' pending ' + plural('spec', pendingCount);
|
||||
}
|
||||
|
||||
print(specCounts);
|
||||
} else {
|
||||
print('No specs found');
|
||||
}
|
||||
|
||||
printNewline();
|
||||
var seconds = timer.elapsed() / 1000;
|
||||
print('Finished in ' + seconds + ' ' + plural('second', seconds));
|
||||
|
||||
printNewline();
|
||||
|
||||
onComplete(failureCount === 0);
|
||||
};
|
||||
|
||||
this.specDone = function(result) {
|
||||
specCount++;
|
||||
|
||||
if (result.status == 'pending') {
|
||||
pendingCount++;
|
||||
print(colored('yellow', '*'));
|
||||
return;
|
||||
}
|
||||
|
||||
if (result.status == 'passed') {
|
||||
print(colored('green', '.'));
|
||||
return;
|
||||
}
|
||||
|
||||
if (result.status == 'failed') {
|
||||
failureCount++;
|
||||
failedSpecs.push(result);
|
||||
print(colored('red', 'F'));
|
||||
}
|
||||
};
|
||||
|
||||
return this;
|
||||
|
||||
function printNewline() {
|
||||
print('\n');
|
||||
}
|
||||
|
||||
function colored(color, str) {
|
||||
return showColors ? (ansi[color] + str + ansi.none) : str;
|
||||
}
|
||||
|
||||
function plural(str, count) {
|
||||
return count == 1 ? str : str + 's';
|
||||
}
|
||||
|
||||
function repeat(thing, times) {
|
||||
var arr = [];
|
||||
for (var i = 0; i < times; i++) {
|
||||
arr.push(thing);
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
function indent(str, spaces) {
|
||||
var lines = (str || '').split('\n');
|
||||
var newArr = [];
|
||||
for (var i = 0; i < lines.length; i++) {
|
||||
newArr.push(repeat(' ', spaces).join('') + lines[i]);
|
||||
}
|
||||
return newArr.join('\n');
|
||||
}
|
||||
|
||||
function specFailureDetails(result) {
|
||||
printNewline();
|
||||
print(result.fullName);
|
||||
|
||||
for (var i = 0; i < result.failedExpectations.length; i++) {
|
||||
var failedExpectation = result.failedExpectations[i];
|
||||
printNewline();
|
||||
print(indent(failedExpectation.message, 2));
|
||||
print(indent(failedExpectation.stack, 2));
|
||||
}
|
||||
|
||||
printNewline();
|
||||
}
|
||||
}
|
||||
|
||||
return ConsoleReporter;
|
||||
};
|
||||
@@ -1,29 +1,37 @@
|
||||
module.exports = require("./jasmine-core/jasmine.js");
|
||||
module.exports.boot = require('./jasmine-core/node_boot.js');
|
||||
|
||||
module.exports.files = (function() {
|
||||
var path = require('path'),
|
||||
fs = require('fs'),
|
||||
glob = require('glob');
|
||||
var path = require('path'),
|
||||
fs = require('fs');
|
||||
|
||||
var rootPath = path.join(__dirname, "jasmine-core"),
|
||||
bootFiles = ['boot.js'],
|
||||
nodeBootFiles = ['node_boot.js'];
|
||||
var rootPath = path.join(__dirname, "jasmine-core"),
|
||||
bootFiles = ['boot.js'],
|
||||
nodeBootFiles = ['node_boot.js'],
|
||||
cssFiles = [],
|
||||
jsFiles = [],
|
||||
jsFilesToSkip = ['jasmine.js'].concat(bootFiles, nodeBootFiles);
|
||||
|
||||
var cssFiles = glob.sync(path.join(rootPath, '*.css')).map(path.basename);
|
||||
var jsFiles = glob.sync(path.join(rootPath, '*.js')).map(path.basename);
|
||||
fs.readdirSync(rootPath).forEach(function(file) {
|
||||
if(fs.statSync(path.join(rootPath, file)).isFile()) {
|
||||
switch(path.extname(file)) {
|
||||
case '.css':
|
||||
cssFiles.push(file);
|
||||
break;
|
||||
case '.js':
|
||||
if (jsFilesToSkip.indexOf(file) < 0) {
|
||||
jsFiles.push(file);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
['jasmine.js'].concat(bootFiles, nodeBootFiles).forEach(function(file) {
|
||||
jsFiles.splice(jsFiles.indexOf(file), 1);
|
||||
});
|
||||
|
||||
return {
|
||||
path: rootPath,
|
||||
bootDir: rootPath,
|
||||
bootFiles: bootFiles,
|
||||
nodeBootFiles: nodeBootFiles,
|
||||
cssFiles: cssFiles,
|
||||
jsFiles: ['jasmine.js'].concat(jsFiles),
|
||||
imagesDir: path.join(__dirname, '../images')
|
||||
};
|
||||
}());
|
||||
module.exports.files = {
|
||||
path: rootPath,
|
||||
bootDir: rootPath,
|
||||
bootFiles: bootFiles,
|
||||
nodeBootFiles: nodeBootFiles,
|
||||
cssFiles: cssFiles,
|
||||
jsFiles: ['jasmine.js'].concat(jsFiles),
|
||||
imagesDir: path.join(__dirname, '../images')
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2008-2014 Pivotal Labs
|
||||
Copyright (c) 2008-2018 Pivotal Labs
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
@@ -21,7 +21,7 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
/**
|
||||
Starting with version 2.0, this file "boots" Jasmine, performing all of the necessary initialization before executing the loaded environment and all of a project's specs. This file should be loaded after `jasmine.js`, but before any project source files or spec files are loaded. Thus this file can also be used to customize Jasmine for a project.
|
||||
Starting with version 2.0, this file "boots" Jasmine, performing all of the necessary initialization before executing the loaded environment and all of a project's specs. This file should be loaded after `jasmine.js` and `jasmine_html.js`, but before any project source files or spec files are loaded. Thus this file can also be used to customize Jasmine for a project.
|
||||
|
||||
If a project is using Jasmine via the standalone distribution, this file can be customized directly. If a project is using Jasmine via the [Ruby gem][jasmine-gem], this file can be copied into the support directory via `jasmine copy_boot_js`. Other environments (e.g., Python) will have different mechanisms.
|
||||
|
||||
@@ -57,13 +57,9 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
var jasmineInterface = jasmineRequire.interface(jasmine, env);
|
||||
|
||||
/**
|
||||
* Add all of the Jasmine global/public interface to the proper global, so a project can use the public interface directly. For example, calling `describe` in specs instead of `jasmine.getEnv().describe`.
|
||||
* Add all of the Jasmine global/public interface to the global scope, so a project can use the public interface directly. For example, calling `describe` in specs instead of `jasmine.getEnv().describe`.
|
||||
*/
|
||||
if (typeof window == "undefined" && typeof exports == "object") {
|
||||
extend(exports, jasmineInterface);
|
||||
} else {
|
||||
extend(window, jasmineInterface);
|
||||
}
|
||||
extend(window, jasmineInterface);
|
||||
|
||||
/**
|
||||
* ## Runner Parameters
|
||||
@@ -75,8 +71,24 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
getWindowLocation: function() { return window.location; }
|
||||
});
|
||||
|
||||
var catchingExceptions = queryString.getParam("catch");
|
||||
env.catchExceptions(typeof catchingExceptions === "undefined" ? true : catchingExceptions);
|
||||
var filterSpecs = !!queryString.getParam("spec");
|
||||
|
||||
var stoppingOnSpecFailure = queryString.getParam("failFast");
|
||||
env.stopOnSpecFailure(stoppingOnSpecFailure);
|
||||
|
||||
var throwingExpectationFailures = queryString.getParam("throwFailures");
|
||||
env.throwOnExpectationFailure(throwingExpectationFailures);
|
||||
|
||||
var random = queryString.getParam("random");
|
||||
|
||||
if (random !== undefined && random !== "") {
|
||||
env.randomizeTests(random);
|
||||
}
|
||||
|
||||
var seed = queryString.getParam("seed");
|
||||
if (seed) {
|
||||
env.seed(seed);
|
||||
}
|
||||
|
||||
/**
|
||||
* ## Reporters
|
||||
@@ -84,11 +96,13 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
var htmlReporter = new jasmine.HtmlReporter({
|
||||
env: env,
|
||||
onRaiseExceptionsClick: function() { queryString.setParam("catch", !env.catchingExceptions()); },
|
||||
navigateWithNewParam: function(key, value) { return queryString.navigateWithNewParam(key, value); },
|
||||
addToExistingQueryString: function(key, value) { return queryString.fullStringWithNewParam(key, value); },
|
||||
getContainer: function() { return document.body; },
|
||||
createElement: function() { return document.createElement.apply(document, arguments); },
|
||||
createTextNode: function() { return document.createTextNode.apply(document, arguments); },
|
||||
timer: new jasmine.Timer()
|
||||
timer: new jasmine.Timer(),
|
||||
filterSpecs: filterSpecs
|
||||
});
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
Starting with version 2.0, this file "boots" Jasmine, performing all of the necessary initialization before executing the loaded environment and all of a project's specs. This file should be loaded after `jasmine.js`, but before any project source files or spec files are loaded. Thus this file can also be used to customize Jasmine for a project.
|
||||
Starting with version 2.0, this file "boots" Jasmine, performing all of the necessary initialization before executing the loaded environment and all of a project's specs. This file should be loaded after `jasmine.js` and `jasmine_html.js`, but before any project source files or spec files are loaded. Thus this file can also be used to customize Jasmine for a project.
|
||||
|
||||
If a project is using Jasmine via the standalone distribution, this file can be customized directly. If a project is using Jasmine via the [Ruby gem][jasmine-gem], this file can be copied into the support directory via `jasmine copy_boot_js`. Other environments (e.g., Python) will have different mechanisms.
|
||||
|
||||
@@ -35,13 +35,9 @@
|
||||
var jasmineInterface = jasmineRequire.interface(jasmine, env);
|
||||
|
||||
/**
|
||||
* Add all of the Jasmine global/public interface to the proper global, so a project can use the public interface directly. For example, calling `describe` in specs instead of `jasmine.getEnv().describe`.
|
||||
* Add all of the Jasmine global/public interface to the global scope, so a project can use the public interface directly. For example, calling `describe` in specs instead of `jasmine.getEnv().describe`.
|
||||
*/
|
||||
if (typeof window == "undefined" && typeof exports == "object") {
|
||||
extend(exports, jasmineInterface);
|
||||
} else {
|
||||
extend(window, jasmineInterface);
|
||||
}
|
||||
extend(window, jasmineInterface);
|
||||
|
||||
/**
|
||||
* ## Runner Parameters
|
||||
@@ -53,8 +49,24 @@
|
||||
getWindowLocation: function() { return window.location; }
|
||||
});
|
||||
|
||||
var catchingExceptions = queryString.getParam("catch");
|
||||
env.catchExceptions(typeof catchingExceptions === "undefined" ? true : catchingExceptions);
|
||||
var filterSpecs = !!queryString.getParam("spec");
|
||||
|
||||
var stoppingOnSpecFailure = queryString.getParam("failFast");
|
||||
env.stopOnSpecFailure(stoppingOnSpecFailure);
|
||||
|
||||
var throwingExpectationFailures = queryString.getParam("throwFailures");
|
||||
env.throwOnExpectationFailure(throwingExpectationFailures);
|
||||
|
||||
var random = queryString.getParam("random");
|
||||
|
||||
if (random !== undefined && random !== "") {
|
||||
env.randomizeTests(random);
|
||||
}
|
||||
|
||||
var seed = queryString.getParam("seed");
|
||||
if (seed) {
|
||||
env.seed(seed);
|
||||
}
|
||||
|
||||
/**
|
||||
* ## Reporters
|
||||
@@ -62,11 +74,13 @@
|
||||
*/
|
||||
var htmlReporter = new jasmine.HtmlReporter({
|
||||
env: env,
|
||||
onRaiseExceptionsClick: function() { queryString.setParam("catch", !env.catchingExceptions()); },
|
||||
navigateWithNewParam: function(key, value) { return queryString.navigateWithNewParam(key, value); },
|
||||
addToExistingQueryString: function(key, value) { return queryString.fullStringWithNewParam(key, value); },
|
||||
getContainer: function() { return document.body; },
|
||||
createElement: function() { return document.createElement.apply(document, arguments); },
|
||||
createTextNode: function() { return document.createTextNode.apply(document, arguments); },
|
||||
timer: new jasmine.Timer()
|
||||
timer: new jasmine.Timer(),
|
||||
filterSpecs: filterSpecs
|
||||
});
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
module.exports = function(jasmineRequire) {
|
||||
var jasmine = jasmineRequire.core(jasmineRequire);
|
||||
|
||||
var consoleFns = require('../console/console.js');
|
||||
consoleFns.console(consoleFns, jasmine);
|
||||
|
||||
var env = jasmine.getEnv();
|
||||
|
||||
var jasmineInterface = jasmineRequire.interface(jasmine, env);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
describe("Player", function() {
|
||||
var Player = require('../../jasmine_examples/Player.js');
|
||||
var Song = require('../../jasmine_examples/Song.js');
|
||||
var Player = require('../../lib/jasmine_examples/Player');
|
||||
var Song = require('../../lib/jasmine_examples/Song');
|
||||
var player;
|
||||
var song;
|
||||
|
||||
@@ -7,7 +7,7 @@ beforeEach(function () {
|
||||
|
||||
return {
|
||||
pass: player.currentlyPlayingSong === expected && player.isPlaying
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2008-2014 Pivotal Labs
|
||||
Copyright (c) 2008-2018 Pivotal Labs
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
@@ -25,6 +25,7 @@ jasmineRequire.html = function(j$) {
|
||||
j$.HtmlReporter = jasmineRequire.HtmlReporter(j$);
|
||||
j$.QueryString = jasmineRequire.QueryString();
|
||||
j$.HtmlSpecFilter = jasmineRequire.HtmlSpecFilter();
|
||||
j$.matchers.toHaveClass = jasmineRequire.toHaveClass(j$);
|
||||
};
|
||||
|
||||
jasmineRequire.HtmlReporter = function(j$) {
|
||||
@@ -34,36 +35,78 @@ jasmineRequire.HtmlReporter = function(j$) {
|
||||
elapsed: function() { return 0; }
|
||||
};
|
||||
|
||||
function ResultsStateBuilder() {
|
||||
this.topResults = new j$.ResultsNode({}, '', null);
|
||||
this.currentParent = this.topResults;
|
||||
this.specsExecuted = 0;
|
||||
this.failureCount = 0;
|
||||
this.pendingSpecCount = 0;
|
||||
}
|
||||
|
||||
ResultsStateBuilder.prototype.suiteStarted = function(result) {
|
||||
this.currentParent.addChild(result, 'suite');
|
||||
this.currentParent = this.currentParent.last();
|
||||
};
|
||||
|
||||
ResultsStateBuilder.prototype.suiteDone = function(result) {
|
||||
this.currentParent.updateResult(result);
|
||||
if (this.currentParent !== this.topResults) {
|
||||
this.currentParent = this.currentParent.parent;
|
||||
}
|
||||
|
||||
if (result.status === 'failed') {
|
||||
this.failureCount++;
|
||||
}
|
||||
};
|
||||
|
||||
ResultsStateBuilder.prototype.specStarted = function(result) {
|
||||
};
|
||||
|
||||
ResultsStateBuilder.prototype.specDone = function(result) {
|
||||
this.currentParent.addChild(result, 'spec');
|
||||
|
||||
if (result.status !== 'excluded') {
|
||||
this.specsExecuted++;
|
||||
}
|
||||
|
||||
if (result.status === 'failed') {
|
||||
this.failureCount++;
|
||||
}
|
||||
|
||||
if (result.status == 'pending') {
|
||||
this.pendingSpecCount++;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
function HtmlReporter(options) {
|
||||
var env = options.env || {},
|
||||
getContainer = options.getContainer,
|
||||
createElement = options.createElement,
|
||||
createTextNode = options.createTextNode,
|
||||
onRaiseExceptionsClick = options.onRaiseExceptionsClick || function() {},
|
||||
navigateWithNewParam = options.navigateWithNewParam || function() {},
|
||||
addToExistingQueryString = options.addToExistingQueryString || defaultQueryString,
|
||||
filterSpecs = options.filterSpecs,
|
||||
timer = options.timer || noopTimer,
|
||||
results = [],
|
||||
specsExecuted = 0,
|
||||
failureCount = 0,
|
||||
pendingSpecCount = 0,
|
||||
htmlReporterMain,
|
||||
symbols;
|
||||
symbols,
|
||||
deprecationWarnings = [];
|
||||
|
||||
this.initialize = function() {
|
||||
clearPrior();
|
||||
htmlReporterMain = createDom('div', {className: 'jasmine_html-reporter'},
|
||||
createDom('div', {className: 'banner'},
|
||||
createDom('a', {className: 'title', href: 'http://jasmine.github.io/', target: '_blank'}),
|
||||
createDom('span', {className: 'version'}, j$.version)
|
||||
createDom('div', {className: 'jasmine-banner'},
|
||||
createDom('a', {className: 'jasmine-title', href: 'http://jasmine.github.io/', target: '_blank'}),
|
||||
createDom('span', {className: 'jasmine-version'}, j$.version)
|
||||
),
|
||||
createDom('ul', {className: 'symbol-summary'}),
|
||||
createDom('div', {className: 'alert'}),
|
||||
createDom('div', {className: 'results'},
|
||||
createDom('div', {className: 'failures'})
|
||||
createDom('ul', {className: 'jasmine-symbol-summary'}),
|
||||
createDom('div', {className: 'jasmine-alert'}),
|
||||
createDom('div', {className: 'jasmine-results'},
|
||||
createDom('div', {className: 'jasmine-failures'})
|
||||
)
|
||||
);
|
||||
getContainer().appendChild(htmlReporterMain);
|
||||
|
||||
symbols = find('.symbol-summary');
|
||||
};
|
||||
|
||||
var totalSpecsDefined;
|
||||
@@ -72,173 +115,154 @@ jasmineRequire.HtmlReporter = function(j$) {
|
||||
timer.start();
|
||||
};
|
||||
|
||||
var summary = createDom('div', {className: 'summary'});
|
||||
var summary = createDom('div', {className: 'jasmine-summary'});
|
||||
|
||||
var topResults = new j$.ResultsNode({}, '', null),
|
||||
currentParent = topResults;
|
||||
var stateBuilder = new ResultsStateBuilder();
|
||||
|
||||
this.suiteStarted = function(result) {
|
||||
currentParent.addChild(result, 'suite');
|
||||
currentParent = currentParent.last();
|
||||
stateBuilder.suiteStarted(result);
|
||||
};
|
||||
|
||||
this.suiteDone = function(result) {
|
||||
if (currentParent == topResults) {
|
||||
return;
|
||||
}
|
||||
stateBuilder.suiteDone(result);
|
||||
|
||||
currentParent = currentParent.parent;
|
||||
if (result.status === 'failed') {
|
||||
failures.push(failureDom(result));
|
||||
}
|
||||
addDeprecationWarnings(result);
|
||||
};
|
||||
|
||||
this.specStarted = function(result) {
|
||||
currentParent.addChild(result, 'spec');
|
||||
stateBuilder.specStarted(result);
|
||||
};
|
||||
|
||||
var failures = [];
|
||||
this.specDone = function(result) {
|
||||
if(noExpectations(result) && console && console.error) {
|
||||
stateBuilder.specDone(result);
|
||||
|
||||
if(noExpectations(result) && typeof console !== 'undefined' && typeof console.error !== 'undefined') {
|
||||
console.error('Spec \'' + result.fullName + '\' has no expectations.');
|
||||
}
|
||||
|
||||
if (result.status != 'disabled') {
|
||||
specsExecuted++;
|
||||
if (!symbols){
|
||||
symbols = find('.jasmine-symbol-summary');
|
||||
}
|
||||
|
||||
symbols.appendChild(createDom('li', {
|
||||
className: noExpectations(result) ? 'empty' : result.status,
|
||||
className: noExpectations(result) ? 'jasmine-empty' : 'jasmine-' + result.status,
|
||||
id: 'spec_' + result.id,
|
||||
title: result.fullName
|
||||
}
|
||||
));
|
||||
|
||||
if (result.status == 'failed') {
|
||||
failureCount++;
|
||||
|
||||
var failure =
|
||||
createDom('div', {className: 'spec-detail failed'},
|
||||
createDom('div', {className: 'description'},
|
||||
createDom('a', {title: result.fullName, href: specHref(result)}, result.fullName)
|
||||
),
|
||||
createDom('div', {className: 'messages'})
|
||||
);
|
||||
var messages = failure.childNodes[1];
|
||||
|
||||
for (var i = 0; i < result.failedExpectations.length; i++) {
|
||||
var expectation = result.failedExpectations[i];
|
||||
messages.appendChild(createDom('div', {className: 'result-message'}, expectation.message));
|
||||
messages.appendChild(createDom('div', {className: 'stack-trace'}, expectation.stack));
|
||||
}
|
||||
|
||||
failures.push(failure);
|
||||
if (result.status === 'failed') {
|
||||
failures.push(failureDom(result));
|
||||
}
|
||||
|
||||
if (result.status == 'pending') {
|
||||
pendingSpecCount++;
|
||||
}
|
||||
addDeprecationWarnings(result);
|
||||
};
|
||||
|
||||
this.jasmineDone = function() {
|
||||
var banner = find('.banner');
|
||||
banner.appendChild(createDom('span', {className: 'duration'}, 'finished in ' + timer.elapsed() / 1000 + 's'));
|
||||
this.jasmineDone = function(doneResult) {
|
||||
var banner = find('.jasmine-banner');
|
||||
var alert = find('.jasmine-alert');
|
||||
var order = doneResult && doneResult.order;
|
||||
alert.appendChild(createDom('span', {className: 'jasmine-duration'}, 'finished in ' + timer.elapsed() / 1000 + 's'));
|
||||
|
||||
var alert = find('.alert');
|
||||
banner.appendChild(optionsMenu(env));
|
||||
|
||||
alert.appendChild(createDom('span', { className: 'exceptions' },
|
||||
createDom('label', { className: 'label', 'for': 'raise-exceptions' }, 'raise exceptions'),
|
||||
createDom('input', {
|
||||
className: 'raise',
|
||||
id: 'raise-exceptions',
|
||||
type: 'checkbox'
|
||||
})
|
||||
));
|
||||
var checkbox = find('#raise-exceptions');
|
||||
|
||||
checkbox.checked = !env.catchingExceptions();
|
||||
checkbox.onclick = onRaiseExceptionsClick;
|
||||
|
||||
if (specsExecuted < totalSpecsDefined) {
|
||||
var skippedMessage = 'Ran ' + specsExecuted + ' of ' + totalSpecsDefined + ' specs - run all';
|
||||
if (stateBuilder.specsExecuted < totalSpecsDefined) {
|
||||
var skippedMessage = 'Ran ' + stateBuilder.specsExecuted + ' of ' + totalSpecsDefined + ' specs - run all';
|
||||
var skippedLink = addToExistingQueryString('spec', '');
|
||||
alert.appendChild(
|
||||
createDom('span', {className: 'bar skipped'},
|
||||
createDom('a', {href: '?', title: 'Run all specs'}, skippedMessage)
|
||||
createDom('span', {className: 'jasmine-bar jasmine-skipped'},
|
||||
createDom('a', {href: skippedLink, title: 'Run all specs'}, skippedMessage)
|
||||
)
|
||||
);
|
||||
}
|
||||
var statusBarMessage = '';
|
||||
var statusBarClassName = 'bar ';
|
||||
var statusBarClassName = 'jasmine-overall-result jasmine-bar ';
|
||||
var globalFailures = (doneResult && doneResult.failedExpectations) || [];
|
||||
var failed = stateBuilder.failureCount + globalFailures.length > 0;
|
||||
|
||||
if (totalSpecsDefined > 0) {
|
||||
statusBarMessage += pluralize('spec', specsExecuted) + ', ' + pluralize('failure', failureCount);
|
||||
if (pendingSpecCount) { statusBarMessage += ', ' + pluralize('pending spec', pendingSpecCount); }
|
||||
statusBarClassName += (failureCount > 0) ? 'failed' : 'passed';
|
||||
} else {
|
||||
statusBarClassName += 'skipped';
|
||||
statusBarMessage += 'No specs found';
|
||||
if (totalSpecsDefined > 0 || failed) {
|
||||
statusBarMessage += pluralize('spec', stateBuilder.specsExecuted) + ', ' + pluralize('failure', stateBuilder.failureCount);
|
||||
if (stateBuilder.pendingSpecCount) { statusBarMessage += ', ' + pluralize('pending spec', stateBuilder.pendingSpecCount); }
|
||||
}
|
||||
|
||||
alert.appendChild(createDom('span', {className: statusBarClassName}, statusBarMessage));
|
||||
if (doneResult.overallStatus === 'passed') {
|
||||
statusBarClassName += ' jasmine-passed ';
|
||||
} else if (doneResult.overallStatus === 'incomplete') {
|
||||
statusBarClassName += ' jasmine-incomplete ';
|
||||
statusBarMessage = 'Incomplete: ' + doneResult.incompleteReason + ', ' + statusBarMessage;
|
||||
} else {
|
||||
statusBarClassName += ' jasmine-failed ';
|
||||
}
|
||||
|
||||
var results = find('.results');
|
||||
results.appendChild(summary);
|
||||
var seedBar;
|
||||
if (order && order.random) {
|
||||
seedBar = createDom('span', {className: 'jasmine-seed-bar'},
|
||||
', randomized with seed ',
|
||||
createDom('a', {title: 'randomized with seed ' + order.seed, href: seedHref(order.seed)}, order.seed)
|
||||
);
|
||||
}
|
||||
|
||||
summaryList(topResults, summary);
|
||||
alert.appendChild(createDom('span', {className: statusBarClassName}, statusBarMessage, seedBar));
|
||||
|
||||
function summaryList(resultsTree, domParent) {
|
||||
var specListNode;
|
||||
for (var i = 0; i < resultsTree.children.length; i++) {
|
||||
var resultNode = resultsTree.children[i];
|
||||
if (resultNode.type == 'suite') {
|
||||
var suiteListNode = createDom('ul', {className: 'suite', id: 'suite-' + resultNode.result.id},
|
||||
createDom('li', {className: 'suite-detail'},
|
||||
createDom('a', {href: specHref(resultNode.result)}, resultNode.result.description)
|
||||
)
|
||||
);
|
||||
var errorBarClassName = 'jasmine-bar jasmine-errored';
|
||||
var afterAllMessagePrefix = 'AfterAll ';
|
||||
|
||||
summaryList(resultNode, suiteListNode);
|
||||
domParent.appendChild(suiteListNode);
|
||||
}
|
||||
if (resultNode.type == 'spec') {
|
||||
if (domParent.getAttribute('class') != 'specs') {
|
||||
specListNode = createDom('ul', {className: 'specs'});
|
||||
domParent.appendChild(specListNode);
|
||||
}
|
||||
var specDescription = resultNode.result.description;
|
||||
if(noExpectations(resultNode.result)) {
|
||||
specDescription = 'SPEC HAS NO EXPECTATIONS ' + specDescription;
|
||||
}
|
||||
specListNode.appendChild(
|
||||
createDom('li', {
|
||||
className: resultNode.result.status,
|
||||
id: 'spec-' + resultNode.result.id
|
||||
},
|
||||
createDom('a', {href: specHref(resultNode.result)}, specDescription)
|
||||
)
|
||||
);
|
||||
for(i = 0; i < globalFailures.length; i++) {
|
||||
alert.appendChild(createDom('span', {className: errorBarClassName}, globalFailureMessage(globalFailures[i])));
|
||||
}
|
||||
|
||||
function globalFailureMessage(failure) {
|
||||
if (failure.globalErrorType === 'load') {
|
||||
var prefix = 'Error during loading: ' + failure.message;
|
||||
|
||||
if (failure.filename) {
|
||||
return prefix + ' in ' + failure.filename + ' line ' + failure.lineno;
|
||||
} else {
|
||||
return prefix;
|
||||
}
|
||||
} else {
|
||||
return afterAllMessagePrefix + failure.message;
|
||||
}
|
||||
}
|
||||
|
||||
addDeprecationWarnings(doneResult);
|
||||
|
||||
var warningBarClassName = 'jasmine-bar jasmine-warning';
|
||||
for(i = 0; i < deprecationWarnings.length; i++) {
|
||||
var warning = deprecationWarnings[i];
|
||||
alert.appendChild(createDom('span', {className: warningBarClassName}, 'DEPRECATION: ' + warning));
|
||||
}
|
||||
|
||||
var results = find('.jasmine-results');
|
||||
results.appendChild(summary);
|
||||
|
||||
summaryList(stateBuilder.topResults, summary);
|
||||
|
||||
if (failures.length) {
|
||||
alert.appendChild(
|
||||
createDom('span', {className: 'menu bar spec-list'},
|
||||
createDom('span', {className: 'jasmine-menu jasmine-bar jasmine-spec-list'},
|
||||
createDom('span', {}, 'Spec List | '),
|
||||
createDom('a', {className: 'failures-menu', href: '#'}, 'Failures')));
|
||||
createDom('a', {className: 'jasmine-failures-menu', href: '#'}, 'Failures')));
|
||||
alert.appendChild(
|
||||
createDom('span', {className: 'menu bar failure-list'},
|
||||
createDom('a', {className: 'spec-list-menu', href: '#'}, 'Spec List'),
|
||||
createDom('span', {className: 'jasmine-menu jasmine-bar jasmine-failure-list'},
|
||||
createDom('a', {className: 'jasmine-spec-list-menu', href: '#'}, 'Spec List'),
|
||||
createDom('span', {}, ' | Failures ')));
|
||||
|
||||
find('.failures-menu').onclick = function() {
|
||||
setMenuModeTo('failure-list');
|
||||
find('.jasmine-failures-menu').onclick = function() {
|
||||
setMenuModeTo('jasmine-failure-list');
|
||||
};
|
||||
find('.spec-list-menu').onclick = function() {
|
||||
setMenuModeTo('spec-list');
|
||||
find('.jasmine-spec-list-menu').onclick = function() {
|
||||
setMenuModeTo('jasmine-spec-list');
|
||||
};
|
||||
|
||||
setMenuModeTo('failure-list');
|
||||
setMenuModeTo('jasmine-failure-list');
|
||||
|
||||
var failureNode = find('.failures');
|
||||
for (var i = 0; i < failures.length; i++) {
|
||||
var failureNode = find('.jasmine-failures');
|
||||
for (i = 0; i < failures.length; i++) {
|
||||
failureNode.appendChild(failures[i]);
|
||||
}
|
||||
}
|
||||
@@ -246,6 +270,164 @@ jasmineRequire.HtmlReporter = function(j$) {
|
||||
|
||||
return this;
|
||||
|
||||
function failureDom(result) {
|
||||
var failure =
|
||||
createDom('div', {className: 'jasmine-spec-detail jasmine-failed'},
|
||||
failureDescription(result, stateBuilder.currentParent),
|
||||
createDom('div', {className: 'jasmine-messages'})
|
||||
);
|
||||
var messages = failure.childNodes[1];
|
||||
|
||||
for (var i = 0; i < result.failedExpectations.length; i++) {
|
||||
var expectation = result.failedExpectations[i];
|
||||
messages.appendChild(createDom('div', {className: 'jasmine-result-message'}, expectation.message));
|
||||
messages.appendChild(createDom('div', {className: 'jasmine-stack-trace'}, expectation.stack));
|
||||
}
|
||||
|
||||
return failure;
|
||||
}
|
||||
|
||||
function summaryList(resultsTree, domParent) {
|
||||
var specListNode;
|
||||
for (var i = 0; i < resultsTree.children.length; i++) {
|
||||
var resultNode = resultsTree.children[i];
|
||||
if (filterSpecs && !hasActiveSpec(resultNode)) {
|
||||
continue;
|
||||
}
|
||||
if (resultNode.type === 'suite') {
|
||||
var suiteListNode = createDom('ul', {className: 'jasmine-suite', id: 'suite-' + resultNode.result.id},
|
||||
createDom('li', {className: 'jasmine-suite-detail jasmine-' + resultNode.result.status},
|
||||
createDom('a', {href: specHref(resultNode.result)}, resultNode.result.description)
|
||||
)
|
||||
);
|
||||
|
||||
summaryList(resultNode, suiteListNode);
|
||||
domParent.appendChild(suiteListNode);
|
||||
}
|
||||
if (resultNode.type === 'spec') {
|
||||
if (domParent.getAttribute('class') !== 'jasmine-specs') {
|
||||
specListNode = createDom('ul', {className: 'jasmine-specs'});
|
||||
domParent.appendChild(specListNode);
|
||||
}
|
||||
var specDescription = resultNode.result.description;
|
||||
if(noExpectations(resultNode.result)) {
|
||||
specDescription = 'SPEC HAS NO EXPECTATIONS ' + specDescription;
|
||||
}
|
||||
if(resultNode.result.status === 'pending' && resultNode.result.pendingReason !== '') {
|
||||
specDescription = specDescription + ' PENDING WITH MESSAGE: ' + resultNode.result.pendingReason;
|
||||
}
|
||||
specListNode.appendChild(
|
||||
createDom('li', {
|
||||
className: 'jasmine-' + resultNode.result.status,
|
||||
id: 'spec-' + resultNode.result.id
|
||||
},
|
||||
createDom('a', {href: specHref(resultNode.result)}, specDescription)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function optionsMenu(env) {
|
||||
var optionsMenuDom = createDom('div', { className: 'jasmine-run-options' },
|
||||
createDom('span', { className: 'jasmine-trigger' }, 'Options'),
|
||||
createDom('div', { className: 'jasmine-payload' },
|
||||
createDom('div', { className: 'jasmine-stop-on-failure' },
|
||||
createDom('input', {
|
||||
className: 'jasmine-fail-fast',
|
||||
id: 'jasmine-fail-fast',
|
||||
type: 'checkbox'
|
||||
}),
|
||||
createDom('label', { className: 'jasmine-label', 'for': 'jasmine-fail-fast' }, 'stop execution on spec failure')),
|
||||
createDom('div', { className: 'jasmine-throw-failures' },
|
||||
createDom('input', {
|
||||
className: 'jasmine-throw',
|
||||
id: 'jasmine-throw-failures',
|
||||
type: 'checkbox'
|
||||
}),
|
||||
createDom('label', { className: 'jasmine-label', 'for': 'jasmine-throw-failures' }, 'stop spec on expectation failure')),
|
||||
createDom('div', { className: 'jasmine-random-order' },
|
||||
createDom('input', {
|
||||
className: 'jasmine-random',
|
||||
id: 'jasmine-random-order',
|
||||
type: 'checkbox'
|
||||
}),
|
||||
createDom('label', { className: 'jasmine-label', 'for': 'jasmine-random-order' }, 'run tests in random order'))
|
||||
)
|
||||
);
|
||||
|
||||
var failFastCheckbox = optionsMenuDom.querySelector('#jasmine-fail-fast');
|
||||
failFastCheckbox.checked = env.stoppingOnSpecFailure();
|
||||
failFastCheckbox.onclick = function() {
|
||||
navigateWithNewParam('failFast', !env.stoppingOnSpecFailure());
|
||||
};
|
||||
|
||||
var throwCheckbox = optionsMenuDom.querySelector('#jasmine-throw-failures');
|
||||
throwCheckbox.checked = env.throwingExpectationFailures();
|
||||
throwCheckbox.onclick = function() {
|
||||
navigateWithNewParam('throwFailures', !env.throwingExpectationFailures());
|
||||
};
|
||||
|
||||
var randomCheckbox = optionsMenuDom.querySelector('#jasmine-random-order');
|
||||
randomCheckbox.checked = env.randomTests();
|
||||
randomCheckbox.onclick = function() {
|
||||
navigateWithNewParam('random', !env.randomTests());
|
||||
};
|
||||
|
||||
var optionsTrigger = optionsMenuDom.querySelector('.jasmine-trigger'),
|
||||
optionsPayload = optionsMenuDom.querySelector('.jasmine-payload'),
|
||||
isOpen = /\bjasmine-open\b/;
|
||||
|
||||
optionsTrigger.onclick = function() {
|
||||
if (isOpen.test(optionsPayload.className)) {
|
||||
optionsPayload.className = optionsPayload.className.replace(isOpen, '');
|
||||
} else {
|
||||
optionsPayload.className += ' jasmine-open';
|
||||
}
|
||||
};
|
||||
|
||||
return optionsMenuDom;
|
||||
}
|
||||
|
||||
function failureDescription(result, suite) {
|
||||
var wrapper = createDom('div', {className: 'jasmine-description'},
|
||||
createDom('a', {title: result.description, href: specHref(result)}, result.description)
|
||||
);
|
||||
var suiteLink;
|
||||
|
||||
while (suite && suite.parent) {
|
||||
wrapper.insertBefore(createTextNode(' > '), wrapper.firstChild);
|
||||
suiteLink = createDom('a', {href: suiteHref(suite)}, suite.result.description);
|
||||
wrapper.insertBefore(suiteLink, wrapper.firstChild);
|
||||
|
||||
suite = suite.parent;
|
||||
}
|
||||
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
function suiteHref(suite) {
|
||||
var els = [];
|
||||
|
||||
while (suite && suite.parent) {
|
||||
els.unshift(suite.result.description);
|
||||
suite = suite.parent;
|
||||
}
|
||||
|
||||
return addToExistingQueryString('spec', els.join(' '));
|
||||
}
|
||||
|
||||
function addDeprecationWarnings(result) {
|
||||
if (result && result.deprecationWarnings) {
|
||||
for(var i = 0; i < result.deprecationWarnings.length; i++) {
|
||||
var warning = result.deprecationWarnings[i].message;
|
||||
if (!j$.util.arrayContains(warning)) {
|
||||
deprecationWarnings.push(warning);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function find(selector) {
|
||||
return getContainer().querySelector('.jasmine_html-reporter ' + selector);
|
||||
}
|
||||
@@ -253,7 +435,7 @@ jasmineRequire.HtmlReporter = function(j$) {
|
||||
function clearPrior() {
|
||||
// return the reporter
|
||||
var oldReporter = find('');
|
||||
|
||||
|
||||
if(oldReporter) {
|
||||
getContainer().removeChild(oldReporter);
|
||||
}
|
||||
@@ -292,7 +474,15 @@ jasmineRequire.HtmlReporter = function(j$) {
|
||||
}
|
||||
|
||||
function specHref(result) {
|
||||
return '?spec=' + encodeURIComponent(result.fullName);
|
||||
return addToExistingQueryString('spec', result.fullName);
|
||||
}
|
||||
|
||||
function seedHref(seed) {
|
||||
return addToExistingQueryString('seed', seed);
|
||||
}
|
||||
|
||||
function defaultQueryString(key, value) {
|
||||
return '?' + key + '=' + value;
|
||||
}
|
||||
|
||||
function setMenuModeTo(mode) {
|
||||
@@ -303,6 +493,20 @@ jasmineRequire.HtmlReporter = function(j$) {
|
||||
return (result.failedExpectations.length + result.passedExpectations.length) === 0 &&
|
||||
result.status === 'passed';
|
||||
}
|
||||
|
||||
function hasActiveSpec(resultNode) {
|
||||
if (resultNode.type == 'spec' && resultNode.result.status != 'excluded') {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (resultNode.type == 'suite') {
|
||||
for (var i = 0, j = resultNode.children.length; i < j; i++) {
|
||||
if (hasActiveSpec(resultNode.children[i])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return HtmlReporter;
|
||||
@@ -336,6 +540,10 @@ jasmineRequire.ResultsNode = function() {
|
||||
this.last = function() {
|
||||
return this.children[this.children.length - 1];
|
||||
};
|
||||
|
||||
this.updateResult = function(result) {
|
||||
this.result = result;
|
||||
};
|
||||
}
|
||||
|
||||
return ResultsNode;
|
||||
@@ -344,10 +552,14 @@ jasmineRequire.ResultsNode = function() {
|
||||
jasmineRequire.QueryString = function() {
|
||||
function QueryString(options) {
|
||||
|
||||
this.setParam = function(key, value) {
|
||||
this.navigateWithNewParam = function(key, value) {
|
||||
options.getWindowLocation().search = this.fullStringWithNewParam(key, value);
|
||||
};
|
||||
|
||||
this.fullStringWithNewParam = function(key, value) {
|
||||
var paramMap = queryStringToParamMap();
|
||||
paramMap[key] = value;
|
||||
options.getWindowLocation().search = toQueryString(paramMap);
|
||||
return toQueryString(paramMap);
|
||||
};
|
||||
|
||||
this.getParam = function(key) {
|
||||
@@ -388,3 +600,37 @@ jasmineRequire.QueryString = function() {
|
||||
|
||||
return QueryString;
|
||||
};
|
||||
|
||||
jasmineRequire.toHaveClass = function(j$) {
|
||||
/**
|
||||
* {@link expect} the actual value to be a DOM element that has the expected class
|
||||
* @function
|
||||
* @name matchers#toHaveClass
|
||||
* @param {Object} expected - The class name to test for
|
||||
* @example
|
||||
* var el = document.createElement('div');
|
||||
* el.className = 'foo bar baz';
|
||||
* expect(el).toHaveClass('bar');
|
||||
*/
|
||||
function toHaveClass(util, customEqualityTesters) {
|
||||
return {
|
||||
compare: function(actual, expected) {
|
||||
if (!isElement(actual)) {
|
||||
throw new Error(j$.pp(actual) + ' is not a DOM element');
|
||||
}
|
||||
|
||||
return {
|
||||
pass: actual.classList.contains(expected)
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function isElement(maybeEl) {
|
||||
return maybeEl &&
|
||||
maybeEl.classList &&
|
||||
j$.isFunction_(maybeEl.classList.contains);
|
||||
}
|
||||
|
||||
return toHaveClass;
|
||||
};
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
http://www.JSON.org/json2.js
|
||||
2009-08-17
|
||||
json2.js
|
||||
2014-02-04
|
||||
|
||||
Public Domain.
|
||||
|
||||
@@ -8,6 +8,14 @@
|
||||
|
||||
See http://www.JSON.org/js.html
|
||||
|
||||
|
||||
This code should be minified before deployment.
|
||||
See http://javascript.crockford.com/jsmin.html
|
||||
|
||||
USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO
|
||||
NOT CONTROL.
|
||||
|
||||
|
||||
This file creates a global JSON object containing two methods: stringify
|
||||
and parse.
|
||||
|
||||
@@ -136,15 +144,9 @@
|
||||
|
||||
This is a reference implementation. You are free to copy, modify, or
|
||||
redistribute.
|
||||
|
||||
This code should be minified before deployment.
|
||||
See http://javascript.crockford.com/jsmin.html
|
||||
|
||||
USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO
|
||||
NOT CONTROL.
|
||||
*/
|
||||
|
||||
/*jslint evil: true */
|
||||
/*jslint evil: true, regexp: true */
|
||||
|
||||
/*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply,
|
||||
call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours,
|
||||
@@ -153,16 +155,16 @@
|
||||
test, toJSON, toString, valueOf
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
// Create a JSON object only if one does not already exist. We create the
|
||||
// methods in a closure to avoid creating global variables.
|
||||
|
||||
if (!this.JSON) {
|
||||
this.JSON = {};
|
||||
if (typeof JSON !== 'object') {
|
||||
JSON = {};
|
||||
}
|
||||
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
function f(n) {
|
||||
// Format integers to have at least two digits.
|
||||
@@ -171,37 +173,30 @@ if (!this.JSON) {
|
||||
|
||||
if (typeof Date.prototype.toJSON !== 'function') {
|
||||
|
||||
Date.prototype.toJSON = function (key) {
|
||||
Date.prototype.toJSON = function () {
|
||||
|
||||
return isFinite(this.valueOf()) ?
|
||||
this.getUTCFullYear() + '-' +
|
||||
f(this.getUTCMonth() + 1) + '-' +
|
||||
f(this.getUTCDate()) + 'T' +
|
||||
f(this.getUTCHours()) + ':' +
|
||||
f(this.getUTCMinutes()) + ':' +
|
||||
f(this.getUTCSeconds()) + 'Z' : null;
|
||||
return isFinite(this.valueOf())
|
||||
? this.getUTCFullYear() + '-' +
|
||||
f(this.getUTCMonth() + 1) + '-' +
|
||||
f(this.getUTCDate()) + 'T' +
|
||||
f(this.getUTCHours()) + ':' +
|
||||
f(this.getUTCMinutes()) + ':' +
|
||||
f(this.getUTCSeconds()) + 'Z'
|
||||
: null;
|
||||
};
|
||||
|
||||
String.prototype.toJSON =
|
||||
Number.prototype.toJSON =
|
||||
Boolean.prototype.toJSON = function (key) {
|
||||
return this.valueOf();
|
||||
};
|
||||
String.prototype.toJSON =
|
||||
Number.prototype.toJSON =
|
||||
Boolean.prototype.toJSON = function () {
|
||||
return this.valueOf();
|
||||
};
|
||||
}
|
||||
|
||||
var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
|
||||
escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
|
||||
var cx,
|
||||
escapable,
|
||||
gap,
|
||||
indent,
|
||||
meta = { // table of character substitutions
|
||||
'\b': '\\b',
|
||||
'\t': '\\t',
|
||||
'\n': '\\n',
|
||||
'\f': '\\f',
|
||||
'\r': '\\r',
|
||||
'"' : '\\"',
|
||||
'\\': '\\\\'
|
||||
},
|
||||
meta,
|
||||
rep;
|
||||
|
||||
|
||||
@@ -213,17 +208,17 @@ if (!this.JSON) {
|
||||
// sequences.
|
||||
|
||||
escapable.lastIndex = 0;
|
||||
return escapable.test(string) ?
|
||||
'"' + string.replace(escapable, function (a) {
|
||||
var c = meta[a];
|
||||
return typeof c === 'string' ? c :
|
||||
'\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
|
||||
}) + '"' :
|
||||
'"' + string + '"';
|
||||
return escapable.test(string) ? '"' + string.replace(escapable, function (a) {
|
||||
var c = meta[a];
|
||||
return typeof c === 'string'
|
||||
? c
|
||||
: '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
|
||||
}) + '"' : '"' + string + '"';
|
||||
}
|
||||
|
||||
|
||||
function str(key, holder) {
|
||||
|
||||
// Produce a string from holder[key].
|
||||
|
||||
var i, // The loop counter.
|
||||
@@ -301,11 +296,11 @@ if (!this.JSON) {
|
||||
// Join all of the elements together, separated with commas, and wrap them in
|
||||
// brackets.
|
||||
|
||||
v = partial.length === 0 ? '[]' :
|
||||
gap ? '[\n' + gap +
|
||||
partial.join(',\n' + gap) + '\n' +
|
||||
mind + ']' :
|
||||
'[' + partial.join(',') + ']';
|
||||
v = partial.length === 0
|
||||
? '[]'
|
||||
: gap
|
||||
? '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']'
|
||||
: '[' + partial.join(',') + ']';
|
||||
gap = mind;
|
||||
return v;
|
||||
}
|
||||
@@ -315,8 +310,8 @@ if (!this.JSON) {
|
||||
if (rep && typeof rep === 'object') {
|
||||
length = rep.length;
|
||||
for (i = 0; i < length; i += 1) {
|
||||
k = rep[i];
|
||||
if (typeof k === 'string') {
|
||||
if (typeof rep[i] === 'string') {
|
||||
k = rep[i];
|
||||
v = str(k, value);
|
||||
if (v) {
|
||||
partial.push(quote(k) + (gap ? ': ' : ':') + v);
|
||||
@@ -328,7 +323,7 @@ if (!this.JSON) {
|
||||
// Otherwise, iterate through all of the keys in the object.
|
||||
|
||||
for (k in value) {
|
||||
if (Object.hasOwnProperty.call(value, k)) {
|
||||
if (Object.prototype.hasOwnProperty.call(value, k)) {
|
||||
v = str(k, value);
|
||||
if (v) {
|
||||
partial.push(quote(k) + (gap ? ': ' : ':') + v);
|
||||
@@ -340,9 +335,11 @@ if (!this.JSON) {
|
||||
// Join all of the member texts together, separated with commas,
|
||||
// and wrap them in braces.
|
||||
|
||||
v = partial.length === 0 ? '{}' :
|
||||
gap ? '{\n' + gap + partial.join(',\n' + gap) + '\n' +
|
||||
mind + '}' : '{' + partial.join(',') + '}';
|
||||
v = partial.length === 0
|
||||
? '{}'
|
||||
: gap
|
||||
? '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}'
|
||||
: '{' + partial.join(',') + '}';
|
||||
gap = mind;
|
||||
return v;
|
||||
}
|
||||
@@ -351,7 +348,18 @@ if (!this.JSON) {
|
||||
// If the JSON object does not yet have a stringify method, give it one.
|
||||
|
||||
if (typeof JSON.stringify !== 'function') {
|
||||
escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;
|
||||
meta = { // table of character substitutions
|
||||
'\b': '\\b',
|
||||
'\t': '\\t',
|
||||
'\n': '\\n',
|
||||
'\f': '\\f',
|
||||
'\r': '\\r',
|
||||
'"' : '\\"',
|
||||
'\\': '\\\\'
|
||||
};
|
||||
JSON.stringify = function (value, replacer, space) {
|
||||
|
||||
// The stringify method takes a value and an optional replacer, and an optional
|
||||
// space parameter, and returns a JSON text. The replacer can be a function
|
||||
// that can replace values, or an array of strings that will select the keys.
|
||||
@@ -382,7 +390,7 @@ if (!this.JSON) {
|
||||
rep = replacer;
|
||||
if (replacer && typeof replacer !== 'function' &&
|
||||
(typeof replacer !== 'object' ||
|
||||
typeof replacer.length !== 'number')) {
|
||||
typeof replacer.length !== 'number')) {
|
||||
throw new Error('JSON.stringify');
|
||||
}
|
||||
|
||||
@@ -397,6 +405,7 @@ if (!this.JSON) {
|
||||
// If the JSON object does not yet have a parse method, give it one.
|
||||
|
||||
if (typeof JSON.parse !== 'function') {
|
||||
cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;
|
||||
JSON.parse = function (text, reviver) {
|
||||
|
||||
// The parse method takes a text and an optional reviver function, and returns
|
||||
@@ -412,7 +421,7 @@ if (!this.JSON) {
|
||||
var k, v, value = holder[key];
|
||||
if (value && typeof value === 'object') {
|
||||
for (k in value) {
|
||||
if (Object.hasOwnProperty.call(value, k)) {
|
||||
if (Object.prototype.hasOwnProperty.call(value, k)) {
|
||||
v = walk(value, k);
|
||||
if (v !== undefined) {
|
||||
value[k] = v;
|
||||
@@ -430,6 +439,7 @@ if (!this.JSON) {
|
||||
// Unicode characters with escape sequences. JavaScript handles many characters
|
||||
// incorrectly, either silently deleting them, or treating them as line endings.
|
||||
|
||||
text = String(text);
|
||||
cx.lastIndex = 0;
|
||||
if (cx.test(text)) {
|
||||
text = text.replace(cx, function (a) {
|
||||
@@ -451,10 +461,10 @@ if (!this.JSON) {
|
||||
// we look to see that the remaining characters are only whitespace or ']' or
|
||||
// ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval.
|
||||
|
||||
if (/^[\],:{}\s]*$/.
|
||||
test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@').
|
||||
replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']').
|
||||
replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
|
||||
if (/^[\],:{}\s]*$/
|
||||
.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@')
|
||||
.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']')
|
||||
.replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
|
||||
|
||||
// In the third stage we use the eval function to compile the text into a
|
||||
// JavaScript structure. The '{' operator is subject to a syntactic ambiguity
|
||||
@@ -466,8 +476,9 @@ replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
|
||||
// In the optional fourth stage, we recursively walk the new structure, passing
|
||||
// each name/value pair to a reviver function for possible transformation.
|
||||
|
||||
return typeof reviver === 'function' ?
|
||||
walk({'': j}, '') : j;
|
||||
return typeof reviver === 'function'
|
||||
? walk({'': j}, '')
|
||||
: j;
|
||||
}
|
||||
|
||||
// If the text is not JSON parseable, then a SyntaxError is thrown.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2008-2014 Pivotal Labs
|
||||
Copyright (c) 2008-2018 Pivotal Labs
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
@@ -23,9 +23,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
module.exports = function(jasmineRequire) {
|
||||
var jasmine = jasmineRequire.core(jasmineRequire);
|
||||
|
||||
var consoleFns = require('../console/console.js');
|
||||
consoleFns.console(consoleFns, jasmine);
|
||||
|
||||
var env = jasmine.getEnv();
|
||||
|
||||
var jasmineInterface = jasmineRequire.interface(jasmine, env);
|
||||
|
||||
@@ -4,6 +4,6 @@
|
||||
#
|
||||
module Jasmine
|
||||
module Core
|
||||
VERSION = "2.0.2"
|
||||
VERSION = "3.0.0"
|
||||
end
|
||||
end
|
||||
|
||||
33
package.json
33
package.json
@@ -1,23 +1,34 @@
|
||||
{
|
||||
"name": "jasmine-core",
|
||||
"license": "MIT",
|
||||
"version": "2.0.2",
|
||||
"version": "3.0.0",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/pivotal/jasmine.git"
|
||||
"url": "https://github.com/jasmine/jasmine.git"
|
||||
},
|
||||
"keywords": [
|
||||
"test",
|
||||
"jasmine",
|
||||
"tdd",
|
||||
"bdd"
|
||||
],
|
||||
"scripts": {
|
||||
"test": "grunt jshint execSpecsInNode"
|
||||
},
|
||||
"description": "Official packaging of Jasmine's core files for use by Node.js projects.",
|
||||
"homepage": "http://jasmine.github.io",
|
||||
"main": "./lib/jasmine-core.js",
|
||||
"devDependencies": {
|
||||
"grunt": "~0.4.1",
|
||||
"grunt-contrib-jshint": "~0.7.0",
|
||||
"grunt-contrib-concat": "~0.3.0",
|
||||
"grunt-contrib-compass": "~0.6.0",
|
||||
"grunt-contrib-compress": "~0.5.2",
|
||||
"shelljs": "~0.1.4",
|
||||
"glob": "~3.2.9",
|
||||
"jasmine": "https://github.com/pivotal/jasmine-npm/archive/master.tar.gz",
|
||||
"load-grunt-tasks": "^0.4.0"
|
||||
"glob": "~7.1.2",
|
||||
"grunt": "^1.0.1",
|
||||
"grunt-cli": "^1.2.0",
|
||||
"grunt-contrib-compass": "^1.1.1",
|
||||
"grunt-contrib-compress": "^1.3.0",
|
||||
"grunt-contrib-concat": "^1.0.1",
|
||||
"grunt-contrib-jshint": "^1.0.0",
|
||||
"jasmine": "^2.5.0",
|
||||
"load-grunt-tasks": "^0.4.0",
|
||||
"shelljs": "^0.7.0",
|
||||
"temp": "~0.8.1"
|
||||
}
|
||||
}
|
||||
|
||||
22
release_notes/1.3.0.md
Normal file
22
release_notes/1.3.0.md
Normal file
@@ -0,0 +1,22 @@
|
||||
# Jasmine Core 1.3.0 Release Notes
|
||||
|
||||
## Summary
|
||||
This version was a very incremental release that merged in some pull requests for bug fixes.
|
||||
|
||||
## Features
|
||||
|
||||
* HTML Runner exposes UI to not swallow Exceptions, instead raising as soon as thrown
|
||||
* Migrated homepage content to Wiki
|
||||
* Made a far more useful [tutorial page](http://pivotal.github.com/jasmine)
|
||||
* Added a `toBeNaN` matcher
|
||||
|
||||
## Fixes
|
||||
|
||||
* Better detection of in-browser vs. not
|
||||
* `afterEach` functions will run now even when there is a timeout
|
||||
* `toBeCloseTo` matcher is more accurate
|
||||
* More explicit matcher messages for spies
|
||||
* Better equality comparisons for regular expressions
|
||||
* Improvements to the Pretty Printer: controllable recursion depth, don't include inherited properties
|
||||
* Fix where `for` was being used as a property on an object (failed on IE)
|
||||
|
||||
12
release_notes/1.3.1.md
Normal file
12
release_notes/1.3.1.md
Normal file
@@ -0,0 +1,12 @@
|
||||
# Jasmine Core 1.3.1 Release Notes
|
||||
|
||||
## Summary
|
||||
|
||||
This release is for browser compatibility fixes
|
||||
|
||||
## Changes
|
||||
|
||||
### Features
|
||||
|
||||
Fixing test runner failures in IE 6/7/8
|
||||
|
||||
83
release_notes/2.1.0.md
Normal file
83
release_notes/2.1.0.md
Normal file
@@ -0,0 +1,83 @@
|
||||
# Jasmine Core 2.1.0 Release Notes
|
||||
|
||||
## Summary
|
||||
|
||||
This is the release of Jasmine 2.1.
|
||||
|
||||
## Features
|
||||
|
||||
- Support for focused specs via `fit` and `fdescribe`
|
||||
- Support for `beforeAll` and `afterAll`
|
||||
- Support for an explicit `fail` function, both in synchronous and asynchronous specs
|
||||
- Allow custom timeout for `beforeEach`, `afterEach`, `beforeAll`, `afterAll` and `it`
|
||||
- Spies now track return values
|
||||
- Specs can now specify their own timeouts
|
||||
- Testing in Node.js via the official Jasmine Node Module
|
||||
- Spec results now have `suiteResults` method that behaves similarly to to `specResults`
|
||||
- HtmlReporter shows error alerts for afterAllExceptions
|
||||
|
||||
## Bugs
|
||||
|
||||
- CI now works for IE8 (this was releated to `ConsoleReporter` below)
|
||||
- Detect global object properly when getting the jasmine require obj
|
||||
- Fixes Issue #[569][issue_569] - [Tracker Story #73684570](http://www.pivotaltracker.com/story/73684570)
|
||||
|
||||
## Deprecations
|
||||
|
||||
### `ConsoleReporter` as part of Jasmine core
|
||||
|
||||
The Console Reporter exists nearly entirely for the old manner of running Jasmine's own specs in node.js. As we are now supporting node.js officially, this reporter code no longer needs to be in this repo and instead will be in the Jasmine npm.
|
||||
|
||||
For now you will see a deprecation message. It will be removed entirely in Jasmine 3.0.
|
||||
|
||||
## Documentation
|
||||
|
||||
- Release Notes from previous releases now live at [Jasmine's GitHub release page][releases]. See Tracker Story #[54582902][tracker_1]
|
||||
- Better instructions for releasing new documentation
|
||||
|
||||
[releases]: https://github.com/pivotal/jasmine/releases
|
||||
[tracker_1]: http://www.pivotaltracker.com/story/54582902
|
||||
|
||||
|
||||
## Pull Requests and Issues
|
||||
|
||||
- Simplification of HTMLtags in SpecRunner.html
|
||||
- Merges #[700][issue_700] from @tkrotoff
|
||||
- `toContain` works with array-like objects (Arguments, HTMLCollections, etc)
|
||||
- Merges #[699][issue_699] from @charleshansen
|
||||
- Fixed isPendingSpecException test title
|
||||
- Merges #[691][issue_691] from @ertrzyiks
|
||||
- Fixed an issue with example code in the npm
|
||||
- Merges #[686][issue_686] from @akoptsov
|
||||
- When the Jasmine clock is installed and date is mocked, `new Date() instanceof Date` should equal `true` Issue #[678][issue_678] & Issue #[679][issue_679] from @chernetsov
|
||||
- Support for an explicit `fail` function, both in synchronous and asynchronous specs
|
||||
- Fixes Issue #[567][issue_567], Issue #[568][issue_568], and Issue #[563][issue_563]
|
||||
- Allow custom timeout for `beforeEach`, `afterEach`, `beforeAll`, `afterAll` and `it`
|
||||
- Fixes Issue #[483][issue_483] - specs can now specify their own timeouts
|
||||
- Spies can track return values
|
||||
- Fixes Issue #[660][issue_660], Merged Issue #[669][issue_669] from @mkhanal
|
||||
- Interval handlers can now clear their interval
|
||||
- Fixes Issue #[655][issue_655] Merged Issue #[658][issue_658] from @tgirardi
|
||||
- Updated to the latest `json2.js`
|
||||
- Merges #[616][issue_616] from @apaladox2015
|
||||
|
||||
------
|
||||
|
||||
_Release Notes generated with [Anchorman](http://github.com/infews/anchorman)_
|
||||
|
||||
[issue_569]: http://github.com/pivotal/jasmine/issues/569
|
||||
[issue_700]: http://github.com/pivotal/jasmine/issues/700
|
||||
[issue_699]: http://github.com/pivotal/jasmine/issues/699
|
||||
[issue_691]: http://github.com/pivotal/jasmine/issues/691
|
||||
[issue_678]: http://github.com/pivotal/jasmine/issues/678
|
||||
[issue_679]: http://github.com/pivotal/jasmine/issues/679
|
||||
[issue_567]: http://github.com/pivotal/jasmine/issues/567
|
||||
[issue_568]: http://github.com/pivotal/jasmine/issues/568
|
||||
[issue_563]: http://github.com/pivotal/jasmine/issues/563
|
||||
[issue_483]: http://github.com/pivotal/jasmine/issues/483
|
||||
[issue_660]: http://github.com/pivotal/jasmine/issues/660
|
||||
[issue_669]: http://github.com/pivotal/jasmine/issues/669
|
||||
[issue_655]: http://github.com/pivotal/jasmine/issues/655
|
||||
[issue_658]: http://github.com/pivotal/jasmine/issues/658
|
||||
[issue_616]: http://github.com/pivotal/jasmine/issues/616
|
||||
[issue_686]: http://github.com/pivotal/jasmine/issues/686
|
||||
14
release_notes/2.1.1.md
Normal file
14
release_notes/2.1.1.md
Normal file
@@ -0,0 +1,14 @@
|
||||
# Jasmine Core 2.1.1 Release Notes
|
||||
|
||||
## Summary
|
||||
|
||||
This is a hotfix release of jasmine core to fix a breaking change with events emitted by the top-level suite
|
||||
|
||||
## Issues
|
||||
|
||||
- Top-level suite triggers suiteStarted and suiteEnd to be consistent
|
||||
- Fixes [#706](http://github.com/pivotal/jasmine/issues/706)
|
||||
|
||||
------
|
||||
|
||||
_Release Notes generated with _[Anchorman](http://github.com/infews/anchorman)_
|
||||
14
release_notes/2.1.2.md
Normal file
14
release_notes/2.1.2.md
Normal file
@@ -0,0 +1,14 @@
|
||||
# Jasmine Core 2.1.2 Release Notes
|
||||
|
||||
## Summary
|
||||
|
||||
This is a hotfix release of jasmine core to fix a breaking change with reporting when all of the specs in a suite are pending.
|
||||
|
||||
## Changes
|
||||
|
||||
- Suites still run their children even if none are executable
|
||||
- Fixes [#707](http://github.com/pivotal/jasmine/issues/707)
|
||||
|
||||
------
|
||||
|
||||
_Release Notes generated with _[Anchorman](http://github.com/infews/anchorman)_
|
||||
21
release_notes/2.1.3.md
Normal file
21
release_notes/2.1.3.md
Normal file
@@ -0,0 +1,21 @@
|
||||
# Jasmine Core 2.1.3 Release Notes
|
||||
|
||||
## Summary
|
||||
|
||||
This release is primarily a bug-fix release to clean up some recent regressions.
|
||||
|
||||
## Pull Requests & Issues
|
||||
|
||||
* Top level suite no longer reports suiteStart and suiteDone
|
||||
- Fixes [#716](https://github.com/jasmine/jasmine/issues/716)
|
||||
|
||||
* Don't keep the expected and actual for a passed expectation
|
||||
- Fixes [#640](https://github.com/jasmine/jasmine/issues/640)
|
||||
- Fixes [#690](https://github.com/jasmine/jasmine/issues/690)
|
||||
|
||||
* Use the new build env on Travis
|
||||
- Merges [#712](https://github.com/jasmine/jasmine/issues/712) from @joshk
|
||||
|
||||
------
|
||||
|
||||
_Release Notes generated with _[Anchorman](http://github.com/infews/anchorman)_
|
||||
98
release_notes/2.2.0.md
Normal file
98
release_notes/2.2.0.md
Normal file
@@ -0,0 +1,98 @@
|
||||
# Jasmine Core 2.2.0 Release Notes
|
||||
|
||||
## Changes
|
||||
|
||||
* `ObjectContaining` no longer tries to track exact mismatches
|
||||
* HTML reporter keeps extra query params when focusing on a spec or suite
|
||||
* Check custom properties on Arrays when computing equality
|
||||
* Better error message if `spyOn` is called without a method name
|
||||
* Rename `jasmineMatches` to `asymmetricMatch`
|
||||
* Don't double escape focus spec links
|
||||
* Jasmine equality checks if either side implements `asymmetricMatch`
|
||||
* Add asymmetric equality tester to match a string with a RegExp
|
||||
* Add jshint to node build on Travis for pull request builds
|
||||
* Restructure node examples directory to look more realistic
|
||||
|
||||
## Pull Requests & Issues
|
||||
|
||||
* Add a basic bower config
|
||||
- Fixes [#719](https://github.com/jasmine/jasmine/issues/719)
|
||||
|
||||
* Allow `pending` to take a reason and show it in the HtmlReporter
|
||||
- Fixes [#671](https://github.com/jasmine/jasmine/issues/671)
|
||||
|
||||
* Set jasmineGlobal correctly in GJS
|
||||
- Merges [#757](https://github.com/jasmine/jasmine/issues/757) from @ptomato
|
||||
- Fixes [#751](https://github.com/jasmine/jasmine/issues/751)
|
||||
|
||||
* Fix some SpiderMonkey lint warnings
|
||||
- Merges [#752](https://github.com/jasmine/jasmine/issues/752) from @ptomato
|
||||
- Fixes [#751](https://github.com/jasmine/jasmine/issues/751)
|
||||
|
||||
* Prevents *Alls from running when runnables are explicitly set
|
||||
- Fixes [#732](https://github.com/jasmine/jasmine/issues/732)
|
||||
|
||||
* Update contribution guide to mention possible ffi dependencies for Ubuntu
|
||||
- Fixes [#755](https://github.com/jasmine/jasmine/issues/755)
|
||||
|
||||
* Fix spelling mistake in contributors guide
|
||||
- Merges [#746](https://github.com/jasmine/jasmine/issues/746) from @swirlycheetah
|
||||
|
||||
* Use new jasmine github repo url
|
||||
- Merges [#745](https://github.com/jasmine/jasmine/issues/745) rohit
|
||||
|
||||
* Allow `createSpyObj` to be called with just an array of method names
|
||||
- Fixes [#321](https://github.com/jasmine/jasmine/issues/321)
|
||||
|
||||
* Add `arrayContaining` matcher
|
||||
- Merges [#440](https://github.com/jasmine/jasmine/issues/440) from @slackersoft
|
||||
|
||||
* Use the stack trace from the Error object if supplied
|
||||
- Fixes [#734](https://github.com/jasmine/jasmine/issues/734)
|
||||
|
||||
* Update readme with link to upgrading doc and mention browser support.
|
||||
- Fixes [#739](https://github.com/jasmine/jasmine/issues/739)
|
||||
|
||||
* Link to the Jasmine NPM module
|
||||
- Merges [#736](https://github.com/jasmine/jasmine/issues/736) from @moonmaster9000
|
||||
|
||||
* Allow null prototype objects to be compared for equality
|
||||
- Merges [#731](https://github.com/jasmine/jasmine/issues/731) from @rohit
|
||||
- Fixes [#729](https://github.com/jasmine/jasmine/issues/729)
|
||||
|
||||
* Fix URL's of Jasmine repositories on Github
|
||||
- Merges [#730](https://github.com/jasmine/jasmine/issues/730) from @rohit
|
||||
|
||||
* Add `anything` matcher to match any value that is neither null or undefined
|
||||
- Fixes [#186](https://github.com/jasmine/jasmine/issues/186)
|
||||
|
||||
* Allow asymmetric equality testers to preempt their symmetric brethren
|
||||
- Fixes [#540](https://github.com/jasmine/jasmine/issues/540)
|
||||
|
||||
* Check for `ObjectContaining` on either side of equality
|
||||
- Fixes [#682](https://github.com/jasmine/jasmine/issues/682)
|
||||
|
||||
* Display the name of the constructor when pretty printing objects
|
||||
- Fixes [#598](https://github.com/jasmine/jasmine/issues/598)
|
||||
|
||||
* `toMatch` requires the `expected` to be a String or RegExp
|
||||
- Fixes [#723](https://github.com/jasmine/jasmine/issues/723)
|
||||
|
||||
* Better equality comparison of Dom nodes
|
||||
- Merges [#657](https://github.com/jasmine/jasmine/issues/657) from @alexeibs
|
||||
|
||||
* Hide unnecessary files from the npm package
|
||||
- Fixes [#726](https://github.com/jasmine/jasmine/issues/726)
|
||||
|
||||
* Properly record finishing an `xdescribe` so further cleanup works
|
||||
- Fixes [#724](https://github.com/jasmine/jasmine/issues/724)
|
||||
|
||||
* Reschedule all functions for a tick before executing any. This allows any function run during a tick to cancel any other in the same tick.
|
||||
- Fixes [#708](https://github.com/jasmine/jasmine/issues/708)
|
||||
|
||||
* Pass through all args from external interface for befores, afters, its
|
||||
- Fixes [#483](https://github.com/jasmine/jasmine/issues/483)
|
||||
|
||||
------
|
||||
|
||||
_Release Notes generated with _[Anchorman](http://github.com/infews/anchorman)_
|
||||
15
release_notes/2.2.1.md
Normal file
15
release_notes/2.2.1.md
Normal file
@@ -0,0 +1,15 @@
|
||||
# Jasmine Core 2.2.1 Release Notes
|
||||
|
||||
## Summary
|
||||
|
||||
This is a hotfix release to fix the packaging for bower
|
||||
|
||||
## Changes
|
||||
|
||||
* Fix missing comma on bower.json
|
||||
- Merges [#763](https://github.com/jasmine/jasmine/issues/763) from @gabrielhpugliese
|
||||
- Merges [#764](https://github.com/jasmine/jasmine/issues/764) from @joshuacc
|
||||
|
||||
------
|
||||
|
||||
_Release Notes generated with _[Anchorman](http://github.com/infews/anchorman)_
|
||||
81
release_notes/2.3.0.md
Normal file
81
release_notes/2.3.0.md
Normal file
@@ -0,0 +1,81 @@
|
||||
# Jasmine Core 2.3.0 Release Notes
|
||||
|
||||
## Changes
|
||||
|
||||
* Style disabled specs in the results list
|
||||
* Use `onclick` directly to better support older webkit
|
||||
* Don't use deprecated `onComplete` syntax for jasmine-npm
|
||||
* Allow the clock to be installed for the duration of a single closure
|
||||
* Add safari 7 & 8 to browser matrix
|
||||
* Remove unused standaloneBuilder var from Gruntfile
|
||||
* Add test script to package.json
|
||||
* Update bower.json keywords to match package.json keywords
|
||||
* Add keywords to package.json
|
||||
* refuse to execute an order if it would cause a suite with a beforeAll or afterAll to be re-entered after leaving once
|
||||
|
||||
## Pull Requests & Issues
|
||||
|
||||
* Specify a main entry point for bower so it can be loaded easier
|
||||
- Merges [#827](https://github.com/jasmine/jasmine/issues/827) from @davetron5000
|
||||
|
||||
* Use `instanceof` when checking Error types in toThrowError
|
||||
- Fixes [#819](https://github.com/jasmine/jasmine/issues/819)
|
||||
|
||||
* Remove periods from bullet points for consistency with rest of document
|
||||
- Merge [#818](https://github.com/jasmine/jasmine/issues/818) from @lpww
|
||||
|
||||
* Subjective readability improvements to CONTRIBUTING.md
|
||||
- Merge [#815](https://github.com/jasmine/jasmine/issues/815) from @jhamon
|
||||
|
||||
* Don't install the clock if the current timing functions aren't the originals
|
||||
- Fixes [#782](https://github.com/jasmine/jasmine/issues/782)
|
||||
|
||||
* Properly pass `j$` to `Any` so it can use other jasmine stuff
|
||||
- Fixes [#806](https://github.com/jasmine/jasmine/issues/806)
|
||||
|
||||
* Correctly handle functions that are scheduled after the clock is uninstalled and reinstalled from within Clock#tick.
|
||||
- Merges [#804](https://github.com/jasmine/jasmine/issues/804) from @sgravrock
|
||||
- Fixes [#790](https://github.com/jasmine/jasmine/issues/790).
|
||||
|
||||
* Allow user to stop a specs execution when an expectation fails
|
||||
- Fixes [#577](https://github.com/jasmine/jasmine/issues/577)
|
||||
|
||||
* Remove unnecessary conditional
|
||||
- Merges [#788](https://github.com/jasmine/jasmine/issues/788) from @toddbranch
|
||||
|
||||
* Show the name of the constructor function when printing an `any` instead of a `toString` of the entire constructor
|
||||
- Fixes [#796](https://github.com/jasmine/jasmine/issues/796)
|
||||
|
||||
* Don't use hardcoded temporary directory paths
|
||||
- Merges [#789](https://github.com/jasmine/jasmine/issues/789) from sgravrock
|
||||
|
||||
* Execute beforeAll/afterAll once per suite instead of once per child when running focused specs/suites
|
||||
- Fixes [#773](https://github.com/jasmine/jasmine/issues/773)
|
||||
|
||||
* Report children of an xdescribe similarly to how they would be reported if they were themselves x'd out
|
||||
- Fixes [#774](https://github.com/jasmine/jasmine/issues/774)
|
||||
- Fixes [#776](https://github.com/jasmine/jasmine/issues/776)
|
||||
|
||||
* Fixes issue where mock clock was being used by QueueRunner
|
||||
- Fixes [#783](https://github.com/jasmine/jasmine/issues/783)
|
||||
- Fixes [#792](https://github.com/jasmine/jasmine/issues/792)
|
||||
|
||||
* add missing semicolon
|
||||
- Merges [#775](https://github.com/jasmine/jasmine/issues/775) from @joscha
|
||||
|
||||
* ObjectContaining matches prototype properties
|
||||
- Fixes [#769](https://github.com/jasmine/jasmine/issues/769)
|
||||
|
||||
* Updates pretty printer to include array properties
|
||||
- Fixes [#766](https://github.com/jasmine/jasmine/issues/766)
|
||||
|
||||
* Update year copyright
|
||||
- Merges [#768](https://github.com/jasmine/jasmine/issues/768) from @danilovaz
|
||||
|
||||
* Allow arrays from different frames or contexts to be equal
|
||||
- Merges [#767](https://github.com/jasmine/jasmine/issues/767) from @juliemr
|
||||
- Fixes [#765](https://github.com/jasmine/jasmine/issues/765)
|
||||
|
||||
------
|
||||
|
||||
_Release Notes generated with _[Anchorman](http://github.com/infews/anchorman)_
|
||||
14
release_notes/2.3.1.md
Normal file
14
release_notes/2.3.1.md
Normal file
@@ -0,0 +1,14 @@
|
||||
# Jasmine 2.3.1 Release Notes
|
||||
|
||||
## Summary
|
||||
|
||||
This release is a packaging update for bower only.
|
||||
|
||||
## Pull Requests & Issues
|
||||
|
||||
* Point Bower's main field to jasmine.js, which is browser-friendly.
|
||||
- Merge [#843](https://github.com/jasmine/jasmine/issues/843) from @evoL
|
||||
|
||||
------
|
||||
|
||||
_Release Notes generated with _[Anchorman](http://github.com/infews/anchorman)_
|
||||
14
release_notes/2.3.2.md
Normal file
14
release_notes/2.3.2.md
Normal file
@@ -0,0 +1,14 @@
|
||||
# Jasmine 2.3.2 Release Notes
|
||||
|
||||
## Summary
|
||||
|
||||
This is a hotfix release to fix a regression with specs declared without a function body
|
||||
|
||||
## Pull Requests & Issues
|
||||
|
||||
* A spec without a function provided should be `pending` not `disabled`
|
||||
- Fixes [#840](https://github.com/jasmine/jasmine/issues/840)
|
||||
|
||||
------
|
||||
|
||||
_Release Notes generated with _[Anchorman](http://github.com/infews/anchorman)_
|
||||
14
release_notes/2.3.3.md
Normal file
14
release_notes/2.3.3.md
Normal file
@@ -0,0 +1,14 @@
|
||||
# Jasmine 2.3.3 Release Notes
|
||||
|
||||
## Summary
|
||||
|
||||
This is a hotfix release to fix a regression with the execution context for `beforeAll`
|
||||
|
||||
## Pull Requests & Issues
|
||||
|
||||
* Set the shared user context correctly when executing the top level suite
|
||||
- Fixes [#846](https://github.com/jasmine/jasmine/issues/846)
|
||||
|
||||
------
|
||||
|
||||
_Release Notes generated with _[Anchorman](http://github.com/infews/anchorman)_
|
||||
22
release_notes/2.3.4.md
Normal file
22
release_notes/2.3.4.md
Normal file
@@ -0,0 +1,22 @@
|
||||
# Jasmine 2.3.4 Release Notes
|
||||
|
||||
## Summary
|
||||
|
||||
This is a hotfix release to fix a regression with execution ordering
|
||||
|
||||
## Pull Requests & Issues
|
||||
|
||||
* Fix ordering for suites with more than 11 direct children.
|
||||
- Fixes [#850](https://github.com/jasmine/jasmine/issues/850)
|
||||
|
||||
* Update standalone installation instructions to reference the releases page
|
||||
- Fixes [#603](https://github.com/jasmine/jasmine/issues/603)
|
||||
|
||||
* Remove dead CSS class styles
|
||||
- Merges [#849](https://github.com/jasmine/jasmine/issues/849) from @prather-mcs
|
||||
- Merges [#848](https://github.com/jasmine/jasmine/issues/848) from @prather-mcs
|
||||
- Fixes [#847](https://github.com/jasmine/jasmine/issues/847)
|
||||
|
||||
------
|
||||
|
||||
_Release Notes generated with _[Anchorman](http://github.com/infews/anchorman)_
|
||||
91
release_notes/2.4.0.md
Normal file
91
release_notes/2.4.0.md
Normal file
@@ -0,0 +1,91 @@
|
||||
# Jasmine Core 2.4.0 Release Notes
|
||||
|
||||
## Summary
|
||||
|
||||
This release contains a number of fixes and pull requests.
|
||||
The most notable is probably that Jasmine now supports randomization of spec order
|
||||
|
||||
## Changes
|
||||
|
||||
* Run jasmine's specs in random order
|
||||
* Add support for returning run details for reporting randomness
|
||||
* Use className instead of class when creating DOM elements
|
||||
|
||||
|
||||
## Pull Requests & Issues
|
||||
|
||||
* Syntax highlighting in README.md
|
||||
- Merges [#973](https://github.com/jasmine/jasmine/issues/973) from @brunoqc
|
||||
|
||||
* Added a throw error block in describe incase a function with arguments is passed in describe
|
||||
- Fixes [#896](https://github.com/jasmine/jasmine/issues/896)
|
||||
- Merges [#955](https://github.com/jasmine/jasmine/issues/955) from @himajasuman
|
||||
|
||||
* Remove unused `queueableFn` arg from `onException`
|
||||
- Fixes [#958](https://github.com/jasmine/jasmine/issues/958)
|
||||
|
||||
* Remove unused parameter from toThrowError
|
||||
- Merges [#957](https://github.com/jasmine/jasmine/issues/957) from @FuzzySockets
|
||||
|
||||
* Abort spying when the target cannot be spied upon
|
||||
- Fixes [#948](https://github.com/jasmine/jasmine/issues/948)
|
||||
- Merges [#949](https://github.com/jasmine/jasmine/issues/949) from @StephanBijzitter
|
||||
|
||||
* Removed GOALS_2.0.md, doesn't seem to be needed anymore
|
||||
- Merges [#954](https://github.com/jasmine/jasmine/issues/954) from @matthewhuff89
|
||||
|
||||
* Change #xit so that it will output a more BDD-style pending message
|
||||
- Merges [#942](https://github.com/jasmine/jasmine/issues/942) from @lalunamel
|
||||
- Fixes [#930](https://github.com/jasmine/jasmine/issues/930)
|
||||
- Fixes [#912](https://github.com/jasmine/jasmine/issues/912)
|
||||
|
||||
* Allow tests to run in random order
|
||||
- Merges [#927](https://github.com/jasmine/jasmine/issues/927) from @marcioj
|
||||
|
||||
* Use toString for objects if it has been overriden
|
||||
- Merges [#929](https://github.com/jasmine/jasmine/issues/929) from @myitcv
|
||||
- Fixes [#928](https://github.com/jasmine/jasmine/issues/928)
|
||||
|
||||
* Fix circles/x from getting cut off on Mac/chrome
|
||||
- Merges [#932](https://github.com/jasmine/jasmine/issues/932) from @James-Dunn
|
||||
|
||||
* Postpone find() until it is needed
|
||||
- Merges [#924](https://github.com/jasmine/jasmine/issues/924) from @danielalexiuc
|
||||
- Fixes [#917](https://github.com/jasmine/jasmine/issues/917)
|
||||
|
||||
* check for global before assigning
|
||||
* Reverse suite afterEach behavior to match semantics?
|
||||
- Merges [#908](https://github.com/jasmine/jasmine/issues/908) from @mcamac
|
||||
|
||||
* Use badges from shields.io
|
||||
- Merges [#902](https://github.com/jasmine/jasmine/issues/902) from @SimenB
|
||||
|
||||
* xdescribe marks pending, plus associated tests.
|
||||
- Merges [#869](https://github.com/jasmine/jasmine/issues/869) from @ljwall
|
||||
- Fixes [#855](https://github.com/jasmine/jasmine/issues/855)
|
||||
|
||||
* Update glob to latest
|
||||
- Merge [#892](https://github.com/jasmine/jasmine/issues/892) from @obastemur
|
||||
- Fixes [#891](https://github.com/jasmine/jasmine/issues/891)
|
||||
|
||||
* Remove moot `version` property from bower.json
|
||||
- Merges [#874](https://github.com/jasmine/jasmine/issues/874) from @kkirsche
|
||||
|
||||
* add toHaveBeenCalledTimes matcher
|
||||
- Merges [#871](https://github.com/jasmine/jasmine/issues/871) from @logankd
|
||||
- Fixes [#853](https://github.com/jasmine/jasmine/issues/853)
|
||||
|
||||
* Update CONTRIBUTING.md
|
||||
- Merges [#856](https://github.com/jasmine/jasmine/issues/856) from @lpww
|
||||
|
||||
* Make the HtmlReport CSS classes "unique enough"
|
||||
- Merges [#851](https://github.com/jasmine/jasmine/issues/851) from @prather-mcs
|
||||
- Fixes [#844](https://github.com/jasmine/jasmine/issues/844)
|
||||
|
||||
* Raise an error when jasmine.any() isn't passed a constructor
|
||||
- Merges [#854](https://github.com/jasmine/jasmine/issues/854) from @danfinnie
|
||||
- Fixes [#852](https://github.com/jasmine/jasmine/issues/852)
|
||||
|
||||
------
|
||||
|
||||
_Release Notes generated with _[Anchorman](http://github.com/infews/anchorman)_
|
||||
11
release_notes/2.4.1.md
Normal file
11
release_notes/2.4.1.md
Normal file
@@ -0,0 +1,11 @@
|
||||
# Jasmine Core 2.4.1 Release Notes
|
||||
|
||||
## Changes
|
||||
|
||||
* Run `afterEach` in reverse order declared as before
|
||||
- Reverts [#908](https://github.com/jasmine/jasmine/issues/908)
|
||||
|
||||
|
||||
------
|
||||
|
||||
_Release Notes generated with _[Anchorman](http://github.com/infews/anchorman)_
|
||||
116
release_notes/2.5.0.md
Normal file
116
release_notes/2.5.0.md
Normal file
@@ -0,0 +1,116 @@
|
||||
# Jasmine 2.5.0 Release Notes
|
||||
|
||||
## Summary
|
||||
|
||||
This release contains a number of fixes and pull requests.
|
||||
|
||||
## Changes
|
||||
|
||||
* Rename `j$` to `jasmineUnderTest` for specs
|
||||
- Please update any pull requests to simplify merging, thanks.
|
||||
|
||||
## Pull Requests & Issues
|
||||
|
||||
* Prettyprint objects whose constructors have custom toString method
|
||||
- Fixes [#1019](https://github.com/jasmine/jasmine/issues/1019)
|
||||
- Merges [#1099](https://github.com/jasmine/jasmine/issues/1099) from @mbildner
|
||||
|
||||
* Add gulp-jasmine-browser link to readme
|
||||
- Fixes [#1089](https://github.com/jasmine/jasmine/issues/1089)
|
||||
|
||||
* Exclude lib directory from codeclimate
|
||||
- Fixes [#1171](https://github.com/jasmine/jasmine/issues/1171)
|
||||
|
||||
* Add instructions for testing in IE
|
||||
- Merges [#1170](https://github.com/jasmine/jasmine/issues/1170) from @benchristel
|
||||
|
||||
* Update devDependencies and fix issues from this
|
||||
- Merges [#1162](https://github.com/jasmine/jasmine/issues/1162) from @amavisca
|
||||
|
||||
* Remove runnableLookupTable which is no longer used
|
||||
- Merges [#1129](https://github.com/jasmine/jasmine/issues/1129) from @gregeninfrank
|
||||
|
||||
* Make `toEqual` pass for arrays with equivalent properties
|
||||
- Merges [#1155](https://github.com/jasmine/jasmine/issues/1155) from @benchristel
|
||||
|
||||
* Update ruby version on travis to let rack install
|
||||
- Merges [#1152](https://github.com/jasmine/jasmine/issues/1152) from @amavisca
|
||||
|
||||
* Fix jasmine setup in Electron environment
|
||||
- Merges [#1079](https://github.com/jasmine/jasmine/issues/1079) from @skupr
|
||||
- Fixes [#964](https://github.com/jasmine/jasmine/issues/964)
|
||||
|
||||
* Improve errors with the domain and how to use the API
|
||||
- Merges [#1026](https://github.com/jasmine/jasmine/issues/1026) from @dhoko
|
||||
- Fixes [#1025](https://github.com/jasmine/jasmine/issues/1025)
|
||||
|
||||
* The done function now returns null
|
||||
- Merges [#1062](https://github.com/jasmine/jasmine/issues/1062) from @marneborn
|
||||
- Fixes [#992](https://github.com/jasmine/jasmine/issues/992)
|
||||
|
||||
* Add .editorconfig file
|
||||
- Merges [#1058](https://github.com/jasmine/jasmine/issues/1058) from @kapke
|
||||
- Fixes [#1057](https://github.com/jasmine/jasmine/issues/1057)
|
||||
|
||||
* Improve error message when passing a non-function to callFake
|
||||
- Merges [#1059](https://github.com/jasmine/jasmine/issues/1059) from @kapke
|
||||
- Fixes [#1016](https://github.com/jasmine/jasmine/issues/1016)
|
||||
|
||||
* Allow expectations in a global beforeAll or afterAll
|
||||
- Fixes [#811](https://github.com/jasmine/jasmine/issues/811)
|
||||
|
||||
* Correctly tear down spies on inherited methods
|
||||
- Merges [#1036](https://github.com/jasmine/jasmine/issues/1036) from @benchristel
|
||||
- Fixes [#737](https://github.com/jasmine/jasmine/issues/737)
|
||||
|
||||
* Array equality treats undefined elements as equal however they got in there
|
||||
- Fixes [#786](https://github.com/jasmine/jasmine/issues/786)
|
||||
|
||||
* Add support for a fallback reporter
|
||||
- Merges [#1009](https://github.com/jasmine/jasmine/issues/1009) from @mauricioborges
|
||||
|
||||
* Grunt task for compass should prefix command with 'bundle exec'
|
||||
- Merges [#1047](https://github.com/jasmine/jasmine/issues/1047) from @d-reinhold
|
||||
|
||||
* Fix `toEqual` for Microsoft Edge
|
||||
- Merges [#1041](https://github.com/jasmine/jasmine/issues/1041) from @everedifice
|
||||
|
||||
* Update describe error message to no longer assume errant args are `done`
|
||||
- Fixes [#896](https://github.com/jasmine/jasmine/issues/896)
|
||||
|
||||
* Add toBeGreatThanOrEqual and toBeLessThanOrEqual matchers
|
||||
- Merges [#1049](https://github.com/jasmine/jasmine/issues/1049) from @rullopat
|
||||
- Fixes [#1013](https://github.com/jasmine/jasmine/issues/1013)
|
||||
|
||||
* Support call count of 0 with toHaveBeenCalledTimes matcher
|
||||
- Merges [#1048](https://github.com/jasmine/jasmine/issues/1048) from @logankd
|
||||
- Fixes [#994](https://github.com/jasmine/jasmine/issues/994)
|
||||
|
||||
* Correctly clean up spies after a spy is replaced and re-spied upon
|
||||
- Merges [#1011](https://github.com/jasmine/jasmine/issues/1011) from @bodawei
|
||||
- Fixes [#1010](https://github.com/jasmine/jasmine/issues/1010)
|
||||
|
||||
* remove extra topSuite `queueRunner` construction parameter
|
||||
- Merges [#1006](https://github.com/jasmine/jasmine/issues/1006) from @jurko-gospodnetic
|
||||
|
||||
* add option to shallow clone args in call tracker
|
||||
- Merges [#1000](https://github.com/jasmine/jasmine/issues/1000) from @a-r-d
|
||||
- Fixes [#872](https://github.com/jasmine/jasmine/issues/872)
|
||||
|
||||
* Update license year range to 2016
|
||||
- Merges [#1021](https://github.com/jasmine/jasmine/issues/1021) from pra85
|
||||
|
||||
* Persist randomize param in 'run all' links
|
||||
- Merges [#990](https://github.com/jasmine/jasmine/issues/990) from @basawyer
|
||||
|
||||
* make DelayedFunctionScheduler update the mockDate
|
||||
- Fixes [#915](https://github.com/jasmine/jasmine/issues/915)
|
||||
- Merges [#980](https://github.com/jasmine/jasmine/issues/980) from @andrewiggings
|
||||
|
||||
* Allow `spyOn` to allow a respy for functions that have already been spied upon
|
||||
- Merges [#953](https://github.com/jasmine/jasmine/issues/953) from @guy-mograbi-at-gigaspaces
|
||||
- Fixes [#931](https://github.com/jasmine/jasmine/issues/931)
|
||||
|
||||
------
|
||||
|
||||
_Release Notes generated with _[Anchorman](http://github.com/infews/anchorman)_
|
||||
19
release_notes/2.5.1.md
Normal file
19
release_notes/2.5.1.md
Normal file
@@ -0,0 +1,19 @@
|
||||
# Jasmine 2.5.1 Release Notes
|
||||
|
||||
## Pull Requests & Issues
|
||||
|
||||
* fallback on assignment when a spy cannot be deleted
|
||||
- Merges [#1193](https://github.com/jasmine/jasmine/issues/1193) from @seanparmlee
|
||||
- Fixes [#1189](https://github.com/jasmine/jasmine/issues/1189)
|
||||
|
||||
* Fix issue with equality of Arrays in PhantomJS
|
||||
- Merges [#1192](https://github.com/jasmine/jasmine/issues/1192) from @logankd
|
||||
- Fixes [#1188](https://github.com/jasmine/jasmine/issues/1188)
|
||||
|
||||
* Properly tick date along with clock
|
||||
- Fixes [#1190](https://github.com/jasmine/jasmine/issues/1190)
|
||||
|
||||
|
||||
------
|
||||
|
||||
_Release Notes generated with _[Anchorman](http://github.com/infews/anchorman)_
|
||||
14
release_notes/2.5.2.md
Normal file
14
release_notes/2.5.2.md
Normal file
@@ -0,0 +1,14 @@
|
||||
# Jasmine 2.5.2 Release Notes
|
||||
|
||||
## Pull Requests & Issues
|
||||
|
||||
* Allow currently registered reporters to be cleared
|
||||
- [jasmine/jasmine-npm#88](https://github.com/jasmine/jasmine-npm/issues/88)
|
||||
|
||||
|
||||
* Use `isFunction` to check for functionness in `callFake`
|
||||
- Fixes [#1191](https://github.com/jasmine/jasmine/issues/1191)
|
||||
|
||||
------
|
||||
|
||||
_Release Notes generated with _[Anchorman](http://github.com/infews/anchorman)_
|
||||
108
release_notes/2.6.0.md
Normal file
108
release_notes/2.6.0.md
Normal file
@@ -0,0 +1,108 @@
|
||||
# Jasmine 2.6.0 Release Notes
|
||||
|
||||
## Summary
|
||||
|
||||
This release contains a number of fixes and pull requests.
|
||||
|
||||
## Pull Requests & Issues
|
||||
|
||||
Updating introduction url to last version
|
||||
- Merges [#1316](https://github.com/jasmine/jasmine/issues/1316) from @rachelcarmena
|
||||
|
||||
* Throw a recognizable Error message when `fail` outside of a spec.
|
||||
- Fixes [#1017](https://github.com/jasmine/jasmine/issues/1017)
|
||||
|
||||
* Allow the matcher provide a custom error message
|
||||
- Merges [#1298](https://github.com/jasmine/jasmine/issues/1298) from @deckar01
|
||||
- Fixes [#1123](https://github.com/jasmine/jasmine/issues/1123)
|
||||
|
||||
* Fix the order in which afterAll hooks are run to match afterEach
|
||||
- Merges [#1312](https://github.com/jasmine/jasmine/issues/1312) from @gdborton
|
||||
- Fixes [#1311](https://github.com/jasmine/jasmine/issues/1311)
|
||||
|
||||
* Add matchers for positive and negative infinity
|
||||
- Merges [#1300](https://github.com/jasmine/jasmine/issues/1300) from @toubou91
|
||||
- Fixes [#1294](https://github.com/jasmine/jasmine/issues/1294)
|
||||
|
||||
* Add a first pass at JSDocs for the intended public API
|
||||
- Fixes [#596](https://github.com/jasmine/jasmine/issues/596)
|
||||
|
||||
* Pretty print objects passed to fail method
|
||||
- Merges [#1283](https://github.com/jasmine/jasmine/issues/1283) from @mmmichl
|
||||
- Fixes [#1090](https://github.com/jasmine/jasmine/issues/1090)
|
||||
|
||||
* Properly check for Error constructor from a different frame
|
||||
- Merges [#1275](https://github.com/jasmine/jasmine/issues/1275) from @anseki
|
||||
- Fixes [#1252](https://github.com/jasmine/jasmine/issues/1252)
|
||||
|
||||
* Add toHaveBeenCalledBefore matcher
|
||||
- Merges [#1242](https://github.com/jasmine/jasmine/issues/1242) from @DamienCassou
|
||||
|
||||
* Collect unhandled exceptions and pass them to the current runnable
|
||||
- Fixes [#529](https://github.com/jasmine/jasmine/issues/529)
|
||||
- Fixes [#937](https://github.com/jasmine/jasmine/issues/937)
|
||||
|
||||
* Nicer error messages for `spyOn` when `null` is provided
|
||||
- Fixes [#1258](https://github.com/jasmine/jasmine/issues/1258)
|
||||
|
||||
* Require arguments to beforeEach, it, etc, to be actual functions
|
||||
- Merges [#1222](https://github.com/jasmine/jasmine/issues/1222) from @voithos
|
||||
- Fixes [#1004](https://github.com/jasmine/jasmine/issues/1004)
|
||||
|
||||
* Update MIT.LICENSE for new year
|
||||
- Merges [#1249](https://github.com/jasmine/jasmine/issues/1249) from @Scottkao85
|
||||
|
||||
* Update README.md for new year
|
||||
- Merges [#1248](https://github.com/jasmine/jasmine/issues/1248) from @Nebojsaa
|
||||
|
||||
* Remove unused `message` param from Suite#pend
|
||||
- See [#1132](https://github.com/jasmine/jasmine/issues/1132)
|
||||
|
||||
* Fix bug where before/afterAll were being executed in disabled suites.
|
||||
- Merges [#1225](https://github.com/jasmine/jasmine/issues/1225) from @voithos
|
||||
- Fixes [#1175](https://github.com/jasmine/jasmine/issues/1175)
|
||||
|
||||
* Make toEqual matcher report the difference between objects
|
||||
- Merges [#1163](https://github.com/jasmine/jasmine/issues/1163) from @benchristel
|
||||
- Fixes [#675](https://github.com/jasmine/jasmine/issues/675)
|
||||
- Merges [#1236](https://github.com/jasmine/jasmine/issues/1236) from @benchristel
|
||||
|
||||
|
||||
* Implement spies for get/set functions on accessor properties
|
||||
- Merges [#1203](https://github.com/jasmine/jasmine/issues/1203) from @celluj34
|
||||
- Merges [#1008](https://github.com/jasmine/jasmine/issues/1008) from @smacker
|
||||
- Fixes [#943](https://github.com/jasmine/jasmine/issues/943)
|
||||
|
||||
* When the HtmlReporter has a 'spec' query param, the spec list only shows matching specs/suites
|
||||
- Merges [#1046](https://github.com/jasmine/jasmine/issues/1046) from @d-reinhold
|
||||
- Fixes [#510](https://github.com/jasmine/jasmine/issues/510)
|
||||
|
||||
* createSpyObj may use object for method/response shorthand
|
||||
- Merges [#1101](https://github.com/jasmine/jasmine/issues/1101) from @mbildner
|
||||
|
||||
* Separate clear stack and run it after each spec
|
||||
- Fixes [#985](https://github.com/jasmine/jasmine/issues/985)
|
||||
- Fixes [#945](https://github.com/jasmine/jasmine/issues/945)
|
||||
- Fixes [#366](https://github.com/jasmine/jasmine/issues/366)
|
||||
|
||||
* Now spies preserve original function arity
|
||||
- Merges [#1055](https://github.com/jasmine/jasmine/issues/1055) from @kapke
|
||||
- Fixes [#991](https://github.com/jasmine/jasmine/issues/991)
|
||||
|
||||
* Added support for ES6 sets to toContain and toEqual.
|
||||
- Merges [#1067](https://github.com/jasmine/jasmine/issues/1067) from @alur
|
||||
|
||||
* Correctly pretty print objects from other contexts (e.g. iframes) and which do not override toString
|
||||
- Merges [#1091](https://github.com/jasmine/jasmine/issues/1091) from @thatfulvioguy
|
||||
- Fixes [#1087](https://github.com/jasmine/jasmine/issues/1087)
|
||||
|
||||
* Pass custom testers to asymmetric testers
|
||||
- Merges [#1139](https://github.com/jasmine/jasmine/issues/1139) from @joeyparrish
|
||||
- Fixes [#1138](https://github.com/jasmine/jasmine/issues/1138)
|
||||
|
||||
* Fix bad url in README
|
||||
- Merges [#1215](https://github.com/jasmine/jasmine/issues/1215) from @mattc41190
|
||||
|
||||
------
|
||||
|
||||
_Release Notes generated with _[Anchorman](http://github.com/infews/anchorman)_
|
||||
31
release_notes/2.6.1.md
Normal file
31
release_notes/2.6.1.md
Normal file
@@ -0,0 +1,31 @@
|
||||
# Jasmine 2.6.1 Release Notes
|
||||
|
||||
## Summary
|
||||
|
||||
This is a patch release to fix some regressions in the 2.6.0 release
|
||||
|
||||
## Pull Requests & Issues
|
||||
|
||||
* Update README.md to make installation instructions more version-agnostic
|
||||
- Merges #1319 from @reinrl
|
||||
|
||||
* Check for `process.listeners` as well, for GlobalErrors
|
||||
- Fixes #1333
|
||||
|
||||
* allow explicit undefined as function for `it` and `xit`
|
||||
- Merges #1329 from @UziTech
|
||||
- Fixes #1328
|
||||
|
||||
* remove eval to create spy wrapper
|
||||
- Merges #1330 from @UziTech
|
||||
- Fixes #1325
|
||||
|
||||
* iterate through keys with a regular for loop
|
||||
- Merges #1326 from @seanparmelee
|
||||
- Fixes #1321
|
||||
- Fixes #1324
|
||||
|
||||
|
||||
------
|
||||
|
||||
_Release Notes generated with _[Anchorman](http://github.com/infews/anchorman)_
|
||||
23
release_notes/2.6.2.md
Normal file
23
release_notes/2.6.2.md
Normal file
@@ -0,0 +1,23 @@
|
||||
# Jasmine 2.6.2 Release Notes
|
||||
|
||||
## Summary
|
||||
|
||||
This is a patch release to fix some regressions and performance problems in the 2.6.0 release
|
||||
|
||||
## Changes
|
||||
|
||||
* Clear the stack if onmessage is called before the previous invocation finishes
|
||||
- Fixes #1327
|
||||
- Fixes jasmine/gulp-jasmine-browser#48
|
||||
|
||||
* Correctly route errors that occur while a QueueRunner is clearing stack
|
||||
- Merges #1352 from @sgravrock
|
||||
- Fixes #1344
|
||||
- Fixes #1349
|
||||
|
||||
* Don't mask errors that occur when no handlers are installed
|
||||
- Merges #1347 from @sgravrock
|
||||
|
||||
------
|
||||
|
||||
_Release Notes generated with _[Anchorman](http://github.com/infews/anchorman)_
|
||||
17
release_notes/2.6.3.md
Normal file
17
release_notes/2.6.3.md
Normal file
@@ -0,0 +1,17 @@
|
||||
# Jasmine 2.6.3 Release Notes
|
||||
|
||||
## Summary
|
||||
|
||||
This is a patch release to fix some regressions and performance problems in the 2.6.0 release
|
||||
|
||||
## Changes
|
||||
|
||||
* Make sure the queue runner goes async for async specs
|
||||
- Fixes [#1327](https://github.com/jasmine/jasmine/issues/1327)
|
||||
- Fixes [#1334](https://github.com/jasmine/jasmine/issues/1334)
|
||||
- Fixes [jasmine/gulp-jasmine-browser#48](https://github.com/jasmine/gulp-jasmine-browser/issues/48)
|
||||
|
||||
|
||||
------
|
||||
|
||||
_Release Notes generated with _[Anchorman](http://github.com/infews/anchorman)_
|
||||
17
release_notes/2.6.4.md
Normal file
17
release_notes/2.6.4.md
Normal file
@@ -0,0 +1,17 @@
|
||||
# Jasmine 2.6.4 Release Notes
|
||||
|
||||
## Summary
|
||||
|
||||
This is a patch release to fix some regressions and performance problems in the 2.6.0 release
|
||||
|
||||
## Changes
|
||||
|
||||
* Break into a `setTimeout` every once in a while allowing the CPU to run other things that used the real `setTimeout`
|
||||
- Fixes [#1327](https://github.com/jasmine/jasmine/issues/1327)
|
||||
- See [#1334](https://github.com/jasmine/jasmine/issues/1334)
|
||||
- Fixes [jasmine/gulp-jasmine-browser#48](https://github.com/jasmine/gulp-jasmine-browser/issues/48)
|
||||
|
||||
|
||||
------
|
||||
|
||||
_Release Notes generated with _[Anchorman](http://github.com/infews/anchorman)_
|
||||
61
release_notes/2.7.0.md
Normal file
61
release_notes/2.7.0.md
Normal file
@@ -0,0 +1,61 @@
|
||||
# Jasmine 2.7.0 Release Notes
|
||||
|
||||
## Summary
|
||||
|
||||
This release contains a number of fixes and pull requests.
|
||||
|
||||
## Pull Requests & Issues
|
||||
|
||||
|
||||
* Add class UserContext
|
||||
- Merges [#1400](https://github.com/jasmine/jasmine/issues/1400) from @darthjee
|
||||
|
||||
* Send unfocused tests through the same queue as focused tests
|
||||
- Merges [#1399](https://github.com/jasmine/jasmine/issues/1399) from @jberney
|
||||
|
||||
* PrettyPrinter allows an object to have a `toString` that isn't a function
|
||||
- Fixes [#1389](https://github.com/jasmine/jasmine/issues/1389)
|
||||
|
||||
* Fix rounding in toBeCloseTo
|
||||
- Fixes [#1382](https://github.com/jasmine/jasmine/issues/1382)
|
||||
|
||||
* When stop on failure is enabled, skip subsequent it() and beforeEach(). Note: afterEach() functions are still run, because skipping them is highly likely to pollute specs that run after the failure.
|
||||
- Fixes [#577](https://github.com/jasmine/jasmine/issues/577)
|
||||
- Fixes [#807](https://github.com/jasmine/jasmine/issues/807)
|
||||
|
||||
* Only clear out the `spec` param for Run all link
|
||||
- Fixes [#1369](https://github.com/jasmine/jasmine/issues/1369)
|
||||
|
||||
* Pretty printer will now use MAX_PRETTY_PRINT_ARRAY_LENGTH for objects
|
||||
- Fixes [#1291](https://github.com/jasmine/jasmine/issues/1291)
|
||||
- Fixes [#1360](https://github.com/jasmine/jasmine/issues/1360)
|
||||
|
||||
* updated package glob from 7.0.5 to 7.1.2
|
||||
- Merges [#1368](https://github.com/jasmine/jasmine/issues/1368) from @EsrefDurna
|
||||
|
||||
* Fix bower.json url to be https instead of http
|
||||
- Merges [#1365](https://github.com/jasmine/jasmine/issues/1365) from @kant
|
||||
|
||||
* Fail when one of the arguments passed into toBeCloseTo matcher is null
|
||||
- Merges [#1362](https://github.com/jasmine/jasmine/issues/1362) from @beatrichartz
|
||||
|
||||
* Fixed HTML snippet in README
|
||||
- Closes [#1366](https://github.com/jasmine/jasmine/issues/1366).
|
||||
|
||||
* Report the random seed at the beginning and end of execution. This allows reporters to provide the seed to the user even in cases where Jasmine crashes before completing.
|
||||
- Merges [#1348](https://github.com/jasmine/jasmine/issues/1348) from @sgravrock
|
||||
|
||||
* Add ES6 map support to Jasmine
|
||||
- Merges [#1340](https://github.com/jasmine/jasmine/issues/1340) from @rmehlinger
|
||||
- Fixes [#1257](https://github.com/jasmine/jasmine/issues/1257)
|
||||
|
||||
* Added support for async before/it/after functions that return promises and added support for ES2017 async functions
|
||||
- Merges [#1356](https://github.com/jasmine/jasmine/issues/1356) from @sgravrock
|
||||
- Fixes [#1336](https://github.com/jasmine/jasmine/issues/1336)
|
||||
- Fixes [#1270](https://github.com/jasmine/jasmine/issues/1270)
|
||||
- Fixes [#1350](https://github.com/jasmine/jasmine/issues/1350)
|
||||
- Fixes [#1320](https://github.com/jasmine/jasmine/issues/1320)
|
||||
|
||||
------
|
||||
|
||||
_Release Notes generated with _[Anchorman](http://github.com/infews/anchorman)_
|
||||
52
release_notes/2.8.0.md
Normal file
52
release_notes/2.8.0.md
Normal file
@@ -0,0 +1,52 @@
|
||||
# Jasmine 2.8.0 Release Notes
|
||||
|
||||
## Summary
|
||||
|
||||
This release contains a number of fixes and pull requests.
|
||||
2.8 should be the last 2.x release of Jasmine, as we aim for 3.0.
|
||||
|
||||
## Changes
|
||||
|
||||
* Create CODE_OF_CONDUCT.md
|
||||
* Add jsdocs for reporter events
|
||||
* Update jsApiReporter docs to link to new suite and spec results
|
||||
* Add explicit docs for the callback function passed to `it` etc.
|
||||
* Update afterAll documentation
|
||||
|
||||
## Pull Requests & Issues
|
||||
|
||||
* Add 'nothing' matcher and tests
|
||||
- Merges [#1412](https://github.com/jasmine/jasmine/issues/1412) from @ksvitkovsky
|
||||
- Fixes [#1221](https://github.com/jasmine/jasmine/issues/1221)
|
||||
|
||||
|
||||
* Make toEqual matcher report the difference between array elements when arrays have different length
|
||||
- Closes [#1375](https://github.com/jasmine/jasmine/issues/1375) from @kiewic
|
||||
|
||||
|
||||
* Add arrayWithExactContents asymmetric matcher
|
||||
- Fixes [#817](https://github.com/jasmine/jasmine/issues/817)
|
||||
|
||||
|
||||
* Ensure no message added on asym. match success
|
||||
- Closes [#1408](https://github.com/jasmine/jasmine/issues/1408) from @ksvitkovsky
|
||||
- Fixes [#1388](https://github.com/jasmine/jasmine/issues/1388)
|
||||
|
||||
|
||||
* Better primitives detection for saveArgsByValue
|
||||
- Closes [#1407](https://github.com/jasmine/jasmine/issues/1407) from @ksvitkovsky
|
||||
- Fixes [#1403](https://github.com/jasmine/jasmine/issues/1403)
|
||||
|
||||
|
||||
* Better pretty printing for typed arrays
|
||||
- Closes [#1404](https://github.com/jasmine/jasmine/issues/1404) from @ksvitkovsky
|
||||
- Fixes [#1180](https://github.com/jasmine/jasmine/issues/1180)
|
||||
|
||||
|
||||
* Rewrite ES6 Set and Map comparison to ignore insertion order
|
||||
- Merges [#1406](https://github.com/jasmine/jasmine/issues/1406) from @theefer
|
||||
- Fixes [#1402](https://github.com/jasmine/jasmine/issues/1402)
|
||||
|
||||
------
|
||||
|
||||
_Release Notes generated with _[Anchorman](http://github.com/infews/anchorman)_
|
||||
99
release_notes/2.9.0.md
Normal file
99
release_notes/2.9.0.md
Normal file
@@ -0,0 +1,99 @@
|
||||
# Jasmine 2.9 Release Notes
|
||||
|
||||
## Summary
|
||||
|
||||
This release contains a number of fixes and pull requests.
|
||||
|
||||
## Changes
|
||||
|
||||
* Fixed DelayedFunctionScheduler IE 8 compatibility issue
|
||||
* Fixed SPEC HAS NO EXPECTATIONS warning in HTML reporter
|
||||
* Correctly remove spies of window.onerror on IE
|
||||
* Truncate pretty printer output that is more than j$.MAX_PRETTY_PRINT_CHARS long
|
||||
* Reduced pretty printer limits to much smaller values
|
||||
* Update contributing for new naming of `jasmineUnderTest`
|
||||
* Allowed async functions to be passed into spy#callFake
|
||||
|
||||
## Pull Requests & Issues
|
||||
|
||||
* Added complete support for Set also for IE11.
|
||||
- Merges [#1478](https://github.com/jasmine/jasmine/issues/1478) from @Volox
|
||||
- Fixes [#1355](https://github.com/jasmine/jasmine/issues/1355)
|
||||
|
||||
|
||||
* Added complete support for Map also for IE11.
|
||||
- Merges [#1477](https://github.com/jasmine/jasmine/issues/1477) from @Volox
|
||||
- Fixes [#1472](https://github.com/jasmine/jasmine/issues/1472)
|
||||
|
||||
|
||||
* Use timeout objects when in node
|
||||
- Merges [#1470](https://github.com/jasmine/jasmine/issues/1470) from @chris--young
|
||||
- Fixes [#1469](https://github.com/jasmine/jasmine/issues/1469)
|
||||
|
||||
|
||||
* Fixed `pending()` for `async`/promise-returning specs
|
||||
- Fixes [#1449](https://github.com/jasmine/jasmine/issues/1449)
|
||||
- Fixes [#1450](https://github.com/jasmine/jasmine/issues/1450)
|
||||
|
||||
|
||||
* Added test steps for other major node versions
|
||||
- Merges [#1448](https://github.com/jasmine/jasmine/issues/1448) from @mrlannigan
|
||||
|
||||
|
||||
* Fix equality computation for ES6 Sets.
|
||||
- Merges [#1445](https://github.com/jasmine/jasmine/issues/1445) from @b-3-n
|
||||
- Fixes [#1444](https://github.com/jasmine/jasmine/issues/1444)
|
||||
|
||||
|
||||
* Add instruction to sync local master with upstream
|
||||
- Merges [#1440](https://github.com/jasmine/jasmine/issues/1440) from aaronang
|
||||
|
||||
|
||||
* Add some unit tests that exercise jasmine.anything() and Map matching.
|
||||
- Merges [#1437](https://github.com/jasmine/jasmine/issues/1437) from @voithos
|
||||
|
||||
|
||||
* Add special handling of asymmetric matcher objects as keys in Maps.
|
||||
- Merges [#1436](https://github.com/jasmine/jasmine/issues/1436) from @voithos
|
||||
- Fixes [#1432](https://github.com/jasmine/jasmine/issues/1432)
|
||||
|
||||
|
||||
* Add support for jasmine.any(Symbol).
|
||||
- Merge [#1435](https://github.com/jasmine/jasmine/issues/1435) from @voithos
|
||||
- Fixes [#1431](https://github.com/jasmine/jasmine/issues/1431)
|
||||
|
||||
|
||||
* Throw an error for invalid nesting of a suite functions
|
||||
- Merges [#1411](https://github.com/jasmine/jasmine/issues/1411) from @ksvitkovsky
|
||||
- Fixes [#1295](https://github.com/jasmine/jasmine/issues/1295)
|
||||
|
||||
|
||||
* Deep clone args before passing them to reporters
|
||||
- Merges [#1424](https://github.com/jasmine/jasmine/issues/1424) from @aj-dev
|
||||
|
||||
|
||||
* Fix "Before Committing" section of CONTRIBUTING.md.
|
||||
- Merges [#1429](https://github.com/jasmine/jasmine/issues/1429) from @voithos
|
||||
|
||||
|
||||
* Fix lint warning in CallTracker.
|
||||
- Merges [#1428](https://github.com/jasmine/jasmine/issues/1428) from @voithos
|
||||
|
||||
|
||||
* clearTimeout should now correctly clear a timeout that is also scheduled to run at the same tick.
|
||||
- Merges [#1427](https://github.com/jasmine/jasmine/issues/1427) from @leahciMic
|
||||
- Fixes [#1426](https://github.com/jasmine/jasmine/issues/1426)
|
||||
|
||||
|
||||
* Add a note about `defineProperty` for `spyOnProperty`
|
||||
- Fixes [#1415](https://github.com/jasmine/jasmine/issues/1415)
|
||||
|
||||
|
||||
* Add Promise checking to eq
|
||||
- Merges [#1386](https://github.com/jasmine/jasmine/issues/1386) from @sderickson
|
||||
- Fixes [#1314](https://github.com/jasmine/jasmine/issues/1314)
|
||||
|
||||
|
||||
------
|
||||
|
||||
_Release Notes generated with _[Anchorman](http://github.com/infews/anchorman)_
|
||||
15
release_notes/2.9.1.md
Normal file
15
release_notes/2.9.1.md
Normal file
@@ -0,0 +1,15 @@
|
||||
# Jasmine Core 2.9.1 Release Notes
|
||||
|
||||
## Summary
|
||||
|
||||
This is a hotfix release to fix a breaking change from the 2.9.0 release
|
||||
|
||||
## Changes
|
||||
|
||||
* Clear timeouts when starting to process a milli instead of at the end
|
||||
- Fixes #1482
|
||||
|
||||
|
||||
------
|
||||
|
||||
_Release Notes generated with _[Anchorman](http://github.com/infews/anchorman)_
|
||||
19
release_notes/2.99.md
Normal file
19
release_notes/2.99.md
Normal file
@@ -0,0 +1,19 @@
|
||||
# Jasmine-Core 2.99 Release Notes
|
||||
|
||||
## Summary
|
||||
|
||||
This release is part of the upgrade path to Jasmine 3.0. It deprecates some functionality that will change.
|
||||
|
||||
## Changes
|
||||
|
||||
* Add ability to report deprecation warnings from within the suite and display them in the HTML reporter
|
||||
* Add deprecation messages for things that will change/break in 3.0
|
||||
* * done for async functionality will now add a failure if it is invoked with an Error
|
||||
* * Env.catchExceptions and the query param are going away, in favor of a more fully functional fail fast handler
|
||||
* * jasmine.Any(Object) will no longer match null
|
||||
* * Unhandled errors during suite load will be caught and reported as failures by Jasmine
|
||||
* * Calling execute more than once on the same spec will definitely fail in 3.0
|
||||
|
||||
------
|
||||
|
||||
_Release Notes generated with _[Anchorman](http://github.com/infews/anchorman)_
|
||||
82
release_notes/3.0.md
Normal file
82
release_notes/3.0.md
Normal file
@@ -0,0 +1,82 @@
|
||||
# Jasmine-Core 3.0 Release Notes
|
||||
|
||||
## Summary
|
||||
|
||||
Jasmine 3.0 is a major release of Jasmine, and as such includes some breaking changes in addition to various new features.
|
||||
|
||||
There is also a 2.99 release of Jasmine that will present deprecation warnings for suites that will encounter different behavior in 3.0.
|
||||
|
||||
## Breaking Changes
|
||||
|
||||
* Replace old "catch exceptions" logic with proper fail fast with error reporting
|
||||
- Fixes [#414](https://github.com/jasmine/jasmine/issues/414)
|
||||
- Fixes [jasmine/jasmine-npm#16](https://github.com/jasmine/jasmine/jasmine-npm/issues/16)
|
||||
|
||||
* Detect an Error passed to `done` and add an expectation failure
|
||||
- Fixes [#567](https://github.com/jasmine/jasmine/issues/567)
|
||||
|
||||
* Unify status for xdescribe and xit
|
||||
- Ensure *All's only execute if at least one child will run
|
||||
- Specs will report a status of `excluded` instead of disabled
|
||||
- Fixes [#1418](https://github.com/jasmine/jasmine/issues/1418)
|
||||
|
||||
* Suite level errors all report the same way (on suiteDone)
|
||||
|
||||
* Refactor QueueRunner and remove references to functions that Jasmine is done with
|
||||
|
||||
* expect(null).toEqual(jasmine.any(Object)) no longer passes
|
||||
- Fixes [#1255](https://github.com/jasmine/jasmine/issues/1255)
|
||||
|
||||
* Default to running tests in random order
|
||||
|
||||
## Changes
|
||||
|
||||
* Remove node modules from python wheel, and update languages
|
||||
|
||||
* Allow reporter callbacks to be asynchronous
|
||||
- Fixes [#842](https://github.com/jasmine/jasmine/issues/842)
|
||||
|
||||
* Allow adding custom spy strategies
|
||||
|
||||
* Add the ability to specify the strategy to use for a spy based on which parameters are passed
|
||||
|
||||
* Added links to re-run the suites containing a failing spec
|
||||
|
||||
* Added a toHaveClass matcher
|
||||
|
||||
* More informative pretty-printing of DOM elements
|
||||
|
||||
* Allow jasmine-npm to handle its own load errors
|
||||
|
||||
* Treat random= as a no-op rather than disabling randomization
|
||||
|
||||
* Use prototype for spy strategy for better memory management
|
||||
|
||||
* Remove console.js altogether
|
||||
|
||||
* Add safari 10 and update readme to include edge
|
||||
|
||||
* Determine overall status in core, not reporters
|
||||
|
||||
* Filter Jasmine frames from stack traces
|
||||
|
||||
* Treat afterAll errors at any level as failures
|
||||
|
||||
* Improved reporting of load errors and afterAll errors
|
||||
- Pass file and line number to reporters when present
|
||||
- Show file and line number in the HTML reporter when present
|
||||
- Visually separate adjacent errors in the HTML reporter
|
||||
|
||||
* Report loading errors as loading errors, not afterAll errors
|
||||
|
||||
* HTML reporter reports overall failure if there are any global errors
|
||||
|
||||
* Fail if error events (e.g. syntax errors) occur during loading
|
||||
|
||||
* Allow use of a predicate function to validate thrown exceptions
|
||||
|
||||
* Check truthiness of toThrowError args, not arg count
|
||||
|
||||
------
|
||||
|
||||
_Release Notes generated with _[Anchorman](http://github.com/infews/anchorman)_
|
||||
110
release_notes/older_versions.md
Normal file
110
release_notes/older_versions.md
Normal file
@@ -0,0 +1,110 @@
|
||||
# Release 1.0.1.1 — November 9, 2010
|
||||
|
||||
## Jasmine Gem
|
||||
|
||||
## Bugs fixed
|
||||
* Rails 3.0 and RSpec 2.0 are now supported.
|
||||
|
||||
|
||||
## Known issues
|
||||
* Rails 3 generators are not yet implemented -- coming soon!
|
||||
|
||||
|
||||
-----
|
||||
# Release 1.0.1 — October 5, 2010
|
||||
-----
|
||||
|
||||
## Jasmine Core
|
||||
|
||||
## Bugs fixed
|
||||
* Bug fixes for Internet Explorer (thanks fschwiet, fabiomcosta, and jfirebaugh).
|
||||
|
||||
|
||||
## Jasmine Gem
|
||||
|
||||
## Bugs fixed
|
||||
* Bug fix for Windows (thanks jfirebaugh).
|
||||
|
||||
|
||||
-----
|
||||
# Release 1.0 — September 14, 2010
|
||||
-----
|
||||
|
||||
## Jasmine Core
|
||||
|
||||
## Features
|
||||
* `waitsFor()` arguments can now be specified in any order. Timeout and message are optional.
|
||||
* The default `waitsFor()` timeout period is now specified in `env.defaultTimeoutInterval`; the default value is 5 seconds.
|
||||
* Added link to jasmine site from html runner.
|
||||
* Added license file to standalone distribution.
|
||||
* New friendly version number.
|
||||
|
||||
|
||||
## Bugs fixed
|
||||
* `waitsFor()` hanged forever if latch function never returned true.
|
||||
* The `not.toThrow()` matcher threw an exception when used with no args.
|
||||
* The `toThrow()` matcher, when inverted, gave misleading failure messages.
|
||||
* Spy matchers, when inverted, gave misleading failure messages.
|
||||
|
||||
|
||||
## Deprecations
|
||||
* Deprecated `waits()` block in favor of `waitsFor()`; `waits()` will be removed in a future release.
|
||||
* Deprecated `toNotBe()`, `toNotEqual()`, `toNotMatch()`, and `toNotContain()` matchers; they will be removed in a future release.
|
||||
* Console X was removed from the distribution as it was no longer used.
|
||||
* To give us some flexibility for future features, wrapped matcher functions now return `undefined` (they previously returned `true` or `false`, but this was undocumented).
|
||||
|
||||
|
||||
## Jasmine Gem
|
||||
|
||||
## Features
|
||||
* Jasmine now supports JRuby.
|
||||
* Jasmine now supports Ruby 1.9.
|
||||
|
||||
|
||||
## Bugs fixed
|
||||
* Various generator issues fixed.
|
||||
|
||||
|
||||
## Known issues
|
||||
* Rails 3 and RSpec 2 are not yet fully supported.
|
||||
|
||||
|
||||
-----
|
||||
# Release 0.11.1 — June 25, 2010
|
||||
-----
|
||||
|
||||
## Jasmine Core
|
||||
|
||||
### Features
|
||||
* Jasmine no longer logs "Jasmine Running…" messages to the log by default. This can be enabled in runner.html by adding 'trivialReporter.logRunningSpecs = true;'.
|
||||
* The `wasCalled()`, `wasCalledWith()`, `wasNotCalled()` and `wasNotCalledWith()` matchers have been deprecated. The new matchers `toHaveBeenCalled()` and `toHaveBeenCalledWith()` have been added. You can use the `not` prefix to achieve equivalent of the `wasNot…()` expectation (e.g. `not.toHaveBeenCalled()`).
|
||||
|
||||
|
||||
## Notables
|
||||
* A barebones version of Jasmine is now available on <a href="http://pivotal.github.com/jasmine/">http://pivotal.github.com/jasmine/</a>.
|
||||
|
||||
|
||||
-----
|
||||
# Release 0.11.0 — June 23, 2010
|
||||
-----
|
||||
## Jasmine Core
|
||||
|
||||
## Features
|
||||
* The version number has been removed from the generated single-file /lib/jasmine.js. We're also now uploading this file, with the version number in the filename, to github's Downloads page.
|
||||
* Old-style matchers (those using this.report(), from before 0.10.x) are no longer supported. See the <span class="caps">README</span> for instructions on writing new-style matchers.
|
||||
* <strong>jasmine.log</strong> pretty-prints its parameters to the spec's output.
|
||||
* Jasmine no longer depends on 'window'.
|
||||
* <span class="caps">HTML</span> runner should show number of passes/fails by spec, not expectation.
|
||||
* Small modification to JsApiReporter data format.
|
||||
|
||||
|
||||
## Bugs fixed:
|
||||
* If multiple beforeEach blocks were declared, they were executed in reverse order.
|
||||
* Specs with duplicate names confused TrivialReporter output.
|
||||
* Errors in describe functions caused later tests to be weirdly nested.
|
||||
* Nested specs weren't reported properly by the JsApiReporter.
|
||||
|
||||
|
||||
## Known issues:
|
||||
* If you turn on the mock clock, you'll get a spurious log message at the end of your spec.
|
||||
|
||||
5
setup.py
5
setup.py
@@ -7,7 +7,7 @@ with open('package.json') as packageFile:
|
||||
setup(
|
||||
name="jasmine-core",
|
||||
version=version,
|
||||
url="http://pivotal.github.io/jasmine/",
|
||||
url="http://jasmine.github.io",
|
||||
author="Pivotal Labs",
|
||||
author_email="jasmine-js@googlegroups.com",
|
||||
description=('Jasmine is a Behavior Driven Development testing framework for JavaScript. It does not rely on '+
|
||||
@@ -23,9 +23,6 @@ setup(
|
||||
'License :: OSI Approved :: MIT License',
|
||||
'Operating System :: OS Independent',
|
||||
'Programming Language :: Python',
|
||||
'Programming Language :: Python :: 2',
|
||||
'Programming Language :: Python :: 2.6',
|
||||
'Programming Language :: Python :: 2.7',
|
||||
'Programming Language :: Python :: 3',
|
||||
'Programming Language :: Python :: 3.2',
|
||||
'Programming Language :: Python :: 3.3',
|
||||
|
||||
@@ -1,239 +0,0 @@
|
||||
describe("ConsoleReporter", function() {
|
||||
var out;
|
||||
|
||||
beforeEach(function() {
|
||||
out = (function() {
|
||||
var output = "";
|
||||
return {
|
||||
print: function(str) {
|
||||
output += str;
|
||||
},
|
||||
getOutput: function() {
|
||||
return output;
|
||||
},
|
||||
clear: function() {
|
||||
output = "";
|
||||
}
|
||||
};
|
||||
}());
|
||||
});
|
||||
|
||||
it("reports that the suite has started to the console", function() {
|
||||
var reporter = new j$.ConsoleReporter({
|
||||
print: out.print
|
||||
});
|
||||
|
||||
reporter.jasmineStarted();
|
||||
|
||||
expect(out.getOutput()).toEqual("Started\n");
|
||||
});
|
||||
|
||||
it("starts the provided timer when jasmine starts", function() {
|
||||
var timerSpy = jasmine.createSpyObj('timer', ['start']),
|
||||
reporter = new j$.ConsoleReporter({
|
||||
print: out.print,
|
||||
timer: timerSpy
|
||||
});
|
||||
|
||||
reporter.jasmineStarted();
|
||||
|
||||
expect(timerSpy.start).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("reports a passing spec as a dot", function() {
|
||||
var reporter = new j$.ConsoleReporter({
|
||||
print: out.print
|
||||
});
|
||||
|
||||
reporter.specDone({status: "passed"});
|
||||
|
||||
expect(out.getOutput()).toEqual(".");
|
||||
});
|
||||
|
||||
it("does not report a disabled spec", function() {
|
||||
var reporter = new j$.ConsoleReporter({
|
||||
print: out.print
|
||||
});
|
||||
|
||||
reporter.specDone({status: "disabled"});
|
||||
|
||||
expect(out.getOutput()).toEqual("");
|
||||
});
|
||||
|
||||
it("reports a failing spec as an 'F'", function() {
|
||||
var reporter = new j$.ConsoleReporter({
|
||||
print: out.print
|
||||
});
|
||||
|
||||
reporter.specDone({status: "failed"});
|
||||
|
||||
expect(out.getOutput()).toEqual("F");
|
||||
});
|
||||
|
||||
it("reports a pending spec as a '*'", function() {
|
||||
var reporter = new j$.ConsoleReporter({
|
||||
print: out.print
|
||||
});
|
||||
|
||||
reporter.specDone({status: "pending"});
|
||||
|
||||
expect(out.getOutput()).toEqual("*");
|
||||
});
|
||||
|
||||
it("alerts user if there are no specs", function(){
|
||||
var reporter = new j$.ConsoleReporter({
|
||||
print: out.print
|
||||
});
|
||||
|
||||
reporter.jasmineStarted();
|
||||
out.clear();
|
||||
reporter.jasmineDone();
|
||||
|
||||
expect(out.getOutput()).toMatch(/No specs found/);
|
||||
});
|
||||
|
||||
it("reports a summary when done (singular spec and time)", function() {
|
||||
var timerSpy = jasmine.createSpyObj('timer', ['start', 'elapsed']),
|
||||
reporter = new j$.ConsoleReporter({
|
||||
print: out.print,
|
||||
timer: timerSpy
|
||||
});
|
||||
|
||||
reporter.jasmineStarted();
|
||||
reporter.specDone({status: "passed"});
|
||||
|
||||
timerSpy.elapsed.and.returnValue(1000);
|
||||
|
||||
out.clear();
|
||||
reporter.jasmineDone();
|
||||
|
||||
expect(out.getOutput()).toMatch(/1 spec, 0 failures/);
|
||||
expect(out.getOutput()).not.toMatch(/0 pending specs/);
|
||||
expect(out.getOutput()).toMatch("Finished in 1 second\n");
|
||||
});
|
||||
|
||||
it("reports a summary when done (pluralized specs and seconds)", function() {
|
||||
var timerSpy = jasmine.createSpyObj('timer', ['start', 'elapsed']),
|
||||
reporter = new j$.ConsoleReporter({
|
||||
print: out.print,
|
||||
timer: timerSpy
|
||||
});
|
||||
|
||||
reporter.jasmineStarted();
|
||||
reporter.specDone({status: "passed"});
|
||||
reporter.specDone({status: "pending"});
|
||||
reporter.specDone({
|
||||
status: "failed",
|
||||
description: "with a failing spec",
|
||||
fullName: "A suite with a failing spec",
|
||||
failedExpectations: [
|
||||
{
|
||||
passed: false,
|
||||
message: "Expected true to be false.",
|
||||
expected: false,
|
||||
actual: true,
|
||||
stack: "foo\nbar\nbaz"
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
out.clear();
|
||||
|
||||
timerSpy.elapsed.and.returnValue(100);
|
||||
|
||||
reporter.jasmineDone();
|
||||
|
||||
expect(out.getOutput()).toMatch(/3 specs, 1 failure, 1 pending spec/);
|
||||
expect(out.getOutput()).toMatch("Finished in 0.1 seconds\n");
|
||||
});
|
||||
|
||||
it("reports a summary when done that includes stack traces for a failing suite", function() {
|
||||
var reporter = new j$.ConsoleReporter({
|
||||
print: out.print
|
||||
});
|
||||
|
||||
reporter.jasmineStarted();
|
||||
reporter.specDone({status: "passed"});
|
||||
reporter.specDone({
|
||||
status: "failed",
|
||||
description: "with a failing spec",
|
||||
fullName: "A suite with a failing spec",
|
||||
failedExpectations: [
|
||||
{
|
||||
passed: false,
|
||||
message: "Expected true to be false.",
|
||||
expected: false,
|
||||
actual: true,
|
||||
stack: "foo bar baz"
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
out.clear();
|
||||
|
||||
reporter.jasmineDone({});
|
||||
|
||||
expect(out.getOutput()).toMatch(/true to be false/);
|
||||
expect(out.getOutput()).toMatch(/foo bar baz/);
|
||||
});
|
||||
|
||||
it("calls the onComplete callback when the suite is done", function() {
|
||||
var onComplete = jasmine.createSpy('onComplete'),
|
||||
reporter = new j$.ConsoleReporter({
|
||||
print: out.print,
|
||||
onComplete: onComplete
|
||||
});
|
||||
|
||||
reporter.jasmineDone({});
|
||||
|
||||
expect(onComplete).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
|
||||
describe("with color", function() {
|
||||
|
||||
it("reports that the suite has started to the console", function() {
|
||||
var reporter = new j$.ConsoleReporter({
|
||||
print: out.print,
|
||||
showColors: true
|
||||
});
|
||||
|
||||
reporter.jasmineStarted();
|
||||
|
||||
expect(out.getOutput()).toEqual("Started\n");
|
||||
});
|
||||
|
||||
it("reports a passing spec as a dot", function() {
|
||||
var reporter = new j$.ConsoleReporter({
|
||||
print: out.print,
|
||||
showColors: true
|
||||
});
|
||||
|
||||
reporter.specDone({status: "passed"});
|
||||
|
||||
expect(out.getOutput()).toEqual("\x1B[32m.\x1B[0m");
|
||||
});
|
||||
|
||||
it("does not report a disabled spec", function() {
|
||||
var reporter = new j$.ConsoleReporter({
|
||||
print: out.print,
|
||||
showColors: true
|
||||
});
|
||||
|
||||
reporter.specDone({status: 'disabled'});
|
||||
|
||||
expect(out.getOutput()).toEqual("");
|
||||
});
|
||||
|
||||
it("reports a failing spec as an 'F'", function() {
|
||||
var reporter = new j$.ConsoleReporter({
|
||||
print: out.print,
|
||||
showColors: true
|
||||
});
|
||||
|
||||
reporter.specDone({status: 'failed'});
|
||||
|
||||
expect(out.getOutput()).toEqual("\x1B[31mF\x1B[0m");
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1,46 +0,0 @@
|
||||
describe("Any", function() {
|
||||
it("matches a string", function() {
|
||||
var any = new j$.Any(String);
|
||||
|
||||
expect(any.jasmineMatches("foo")).toBe(true);
|
||||
});
|
||||
|
||||
it("matches a number", function() {
|
||||
var any = new j$.Any(Number);
|
||||
|
||||
expect(any.jasmineMatches(1)).toBe(true);
|
||||
});
|
||||
|
||||
it("matches a function", function() {
|
||||
var any = new j$.Any(Function);
|
||||
|
||||
expect(any.jasmineMatches(function(){})).toBe(true);
|
||||
});
|
||||
|
||||
it("matches an Object", function() {
|
||||
var any = new j$.Any(Object);
|
||||
|
||||
expect(any.jasmineMatches({})).toBe(true);
|
||||
});
|
||||
|
||||
it("matches a Boolean", function() {
|
||||
var any = new j$.Any(Boolean);
|
||||
|
||||
expect(any.jasmineMatches(true)).toBe(true);
|
||||
});
|
||||
|
||||
it("matches another constructed object", function() {
|
||||
var Thing = function() {},
|
||||
any = new j$.Any(Thing);
|
||||
|
||||
expect(any.jasmineMatches(new Thing())).toBe(true);
|
||||
});
|
||||
|
||||
it("jasmineToString's itself", function() {
|
||||
var any = new j$.Any(Number);
|
||||
|
||||
expect(any.jasmineToString()).toMatch('<jasmine.any');
|
||||
expect(any.jasmineToString()).toMatch('Number');
|
||||
});
|
||||
|
||||
});
|
||||
@@ -1,6 +1,6 @@
|
||||
describe("CallTracker", function() {
|
||||
it("tracks that it was called when executed", function() {
|
||||
var callTracker = new j$.CallTracker();
|
||||
var callTracker = new jasmineUnderTest.CallTracker();
|
||||
|
||||
expect(callTracker.any()).toBe(false);
|
||||
|
||||
@@ -10,7 +10,7 @@ describe("CallTracker", function() {
|
||||
});
|
||||
|
||||
it("tracks that number of times that it is executed", function() {
|
||||
var callTracker = new j$.CallTracker();
|
||||
var callTracker = new jasmineUnderTest.CallTracker();
|
||||
|
||||
expect(callTracker.count()).toEqual(0);
|
||||
|
||||
@@ -20,7 +20,7 @@ describe("CallTracker", function() {
|
||||
});
|
||||
|
||||
it("tracks the params from each execution", function() {
|
||||
var callTracker = new j$.CallTracker();
|
||||
var callTracker = new jasmineUnderTest.CallTracker();
|
||||
|
||||
callTracker.track({object: void 0, args: []});
|
||||
callTracker.track({object: {}, args: [0, "foo"]});
|
||||
@@ -31,13 +31,13 @@ describe("CallTracker", function() {
|
||||
});
|
||||
|
||||
it("returns any empty array when there was no call", function() {
|
||||
var callTracker = new j$.CallTracker();
|
||||
var callTracker = new jasmineUnderTest.CallTracker();
|
||||
|
||||
expect(callTracker.argsFor(0)).toEqual([]);
|
||||
});
|
||||
|
||||
it("allows access for the arguments for all calls", function() {
|
||||
var callTracker = new j$.CallTracker();
|
||||
var callTracker = new jasmineUnderTest.CallTracker();
|
||||
|
||||
callTracker.track({object: {}, args: []});
|
||||
callTracker.track({object: {}, args: [0, "foo"]});
|
||||
@@ -46,7 +46,7 @@ describe("CallTracker", function() {
|
||||
});
|
||||
|
||||
it("tracks the context and arguments for each call", function() {
|
||||
var callTracker = new j$.CallTracker();
|
||||
var callTracker = new jasmineUnderTest.CallTracker();
|
||||
|
||||
callTracker.track({object: {}, args: []});
|
||||
callTracker.track({object: {}, args: [0, "foo"]});
|
||||
@@ -57,7 +57,7 @@ describe("CallTracker", function() {
|
||||
});
|
||||
|
||||
it("simplifies access to the arguments for the last (most recent) call", function() {
|
||||
var callTracker = new j$.CallTracker();
|
||||
var callTracker = new jasmineUnderTest.CallTracker();
|
||||
|
||||
callTracker.track();
|
||||
callTracker.track({object: {}, args: [0, "foo"]});
|
||||
@@ -69,13 +69,13 @@ describe("CallTracker", function() {
|
||||
});
|
||||
|
||||
it("returns a useful falsy value when there isn't a last (most recent) call", function() {
|
||||
var callTracker = new j$.CallTracker();
|
||||
var callTracker = new jasmineUnderTest.CallTracker();
|
||||
|
||||
expect(callTracker.mostRecent()).toBeFalsy();
|
||||
});
|
||||
|
||||
it("simplifies access to the arguments for the first (oldest) call", function() {
|
||||
var callTracker = new j$.CallTracker();
|
||||
var callTracker = new jasmineUnderTest.CallTracker();
|
||||
|
||||
callTracker.track({object: {}, args: [0, "foo"]});
|
||||
|
||||
@@ -83,14 +83,14 @@ describe("CallTracker", function() {
|
||||
});
|
||||
|
||||
it("returns a useful falsy value when there isn't a first (oldest) call", function() {
|
||||
var callTracker = new j$.CallTracker();
|
||||
var callTracker = new jasmineUnderTest.CallTracker();
|
||||
|
||||
expect(callTracker.first()).toBeFalsy();
|
||||
});
|
||||
|
||||
|
||||
it("allows the tracking to be reset", function() {
|
||||
var callTracker = new j$.CallTracker();
|
||||
var callTracker = new jasmineUnderTest.CallTracker();
|
||||
|
||||
callTracker.track();
|
||||
callTracker.track({object: {}, args: [0, "foo"]});
|
||||
@@ -102,4 +102,29 @@ describe("CallTracker", function() {
|
||||
expect(callTracker.all()).toEqual([]);
|
||||
expect(callTracker.mostRecent()).toBeFalsy();
|
||||
});
|
||||
|
||||
it("allows object arguments to be shallow cloned", function() {
|
||||
var callTracker = new jasmineUnderTest.CallTracker();
|
||||
callTracker.saveArgumentsByValue();
|
||||
|
||||
var objectArg = {"foo": "bar"},
|
||||
arrayArg = ["foo", "bar"];
|
||||
|
||||
callTracker.track({object: {}, args: [objectArg, arrayArg, false, undefined, null, NaN, "", 0, 1.0]});
|
||||
|
||||
expect(callTracker.mostRecent().args[0]).not.toBe(objectArg);
|
||||
expect(callTracker.mostRecent().args[0]).toEqual(objectArg);
|
||||
expect(callTracker.mostRecent().args[1]).not.toBe(arrayArg);
|
||||
expect(callTracker.mostRecent().args[1]).toEqual(arrayArg);
|
||||
});
|
||||
|
||||
it('saves primitive arguments by value', function() {
|
||||
var callTracker = new jasmineUnderTest.CallTracker(),
|
||||
args = [undefined, null, false, '', /\s/, 0, 1.2, NaN];
|
||||
|
||||
callTracker.saveArgumentsByValue();
|
||||
callTracker.track({ object: {}, args: args });
|
||||
|
||||
expect(callTracker.mostRecent().args).toEqual(args);
|
||||
});
|
||||
});
|
||||
|
||||
137
spec/core/ClearStackSpec.js
Normal file
137
spec/core/ClearStackSpec.js
Normal file
@@ -0,0 +1,137 @@
|
||||
describe("ClearStack", function() {
|
||||
it("works in an integrationy way", function(done) {
|
||||
var clearStack = jasmineUnderTest.getClearStack(jasmineUnderTest.getGlobal());
|
||||
|
||||
clearStack(function() {
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it("uses setImmediate when available", function() {
|
||||
var setImmediate = jasmine.createSpy('setImmediate').and.callFake(function(fn) { fn() }),
|
||||
global = { setImmediate: setImmediate },
|
||||
clearStack = jasmineUnderTest.getClearStack(global),
|
||||
called = false;
|
||||
|
||||
clearStack(function() {
|
||||
called = true;
|
||||
});
|
||||
|
||||
expect(called).toBe(true);
|
||||
expect(setImmediate).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("uses setTimeout instead of setImmediate every 10 calls to make sure we release the CPU", function() {
|
||||
var setImmediate = jasmine.createSpy('setImmediate'),
|
||||
setTimeout = jasmine.createSpy('setTimeout'),
|
||||
global = { setImmediate: setImmediate, setTimeout: setTimeout },
|
||||
clearStack = jasmineUnderTest.getClearStack(global);
|
||||
|
||||
clearStack(function() { });
|
||||
clearStack(function() { });
|
||||
clearStack(function() { });
|
||||
clearStack(function() { });
|
||||
clearStack(function() { });
|
||||
clearStack(function() { });
|
||||
clearStack(function() { });
|
||||
clearStack(function() { });
|
||||
clearStack(function() { });
|
||||
|
||||
expect(setImmediate).toHaveBeenCalled();
|
||||
expect(setTimeout).not.toHaveBeenCalled();
|
||||
|
||||
clearStack(function() { });
|
||||
expect(setImmediate.calls.count()).toEqual(9);
|
||||
expect(setTimeout.calls.count()).toEqual(1);
|
||||
|
||||
clearStack(function() { });
|
||||
expect(setImmediate.calls.count()).toEqual(10);
|
||||
expect(setTimeout.calls.count()).toEqual(1);
|
||||
});
|
||||
|
||||
it("uses MessageChannels when available", function() {
|
||||
var fakeChannel = {
|
||||
port1: {},
|
||||
port2: { postMessage: function() { fakeChannel.port1.onmessage(); } }
|
||||
},
|
||||
global = { MessageChannel: function() { return fakeChannel; } },
|
||||
clearStack = jasmineUnderTest.getClearStack(global),
|
||||
called = false;
|
||||
|
||||
clearStack(function() {
|
||||
called = true;
|
||||
});
|
||||
|
||||
expect(called).toBe(true);
|
||||
});
|
||||
|
||||
it("uses setTimeout instead of MessageChannel every 10 calls to make sure we release the CPU", function() {
|
||||
var fakeChannel = {
|
||||
port1: {},
|
||||
port2: {
|
||||
postMessage: jasmine.createSpy('postMessage').and.callFake(function() {
|
||||
fakeChannel.port1.onmessage();
|
||||
})
|
||||
}
|
||||
},
|
||||
setTimeout = jasmine.createSpy('setTimeout'),
|
||||
global = { MessageChannel: function() { return fakeChannel; }, setTimeout: setTimeout },
|
||||
clearStack = jasmineUnderTest.getClearStack(global);
|
||||
|
||||
clearStack(function() { });
|
||||
clearStack(function() { });
|
||||
clearStack(function() { });
|
||||
clearStack(function() { });
|
||||
clearStack(function() { });
|
||||
clearStack(function() { });
|
||||
clearStack(function() { });
|
||||
clearStack(function() { });
|
||||
clearStack(function() { });
|
||||
|
||||
expect(fakeChannel.port2.postMessage).toHaveBeenCalled();
|
||||
expect(setTimeout).not.toHaveBeenCalled();
|
||||
|
||||
clearStack(function() { });
|
||||
expect(fakeChannel.port2.postMessage.calls.count()).toEqual(9);
|
||||
expect(setTimeout.calls.count()).toEqual(1);
|
||||
|
||||
clearStack(function() { });
|
||||
expect(fakeChannel.port2.postMessage.calls.count()).toEqual(10);
|
||||
expect(setTimeout.calls.count()).toEqual(1);
|
||||
});
|
||||
|
||||
it("calls setTimeout when onmessage is called recursively", function() {
|
||||
var fakeChannel = {
|
||||
port1: {},
|
||||
port2: { postMessage: function() { fakeChannel.port1.onmessage(); } }
|
||||
},
|
||||
setTimeout = jasmine.createSpy('setTimeout'),
|
||||
global = {
|
||||
MessageChannel: function() { return fakeChannel; },
|
||||
setTimeout: setTimeout,
|
||||
},
|
||||
clearStack = jasmineUnderTest.getClearStack(global),
|
||||
fn = jasmine.createSpy("second clearStack function");
|
||||
|
||||
clearStack(function() {
|
||||
clearStack(fn);
|
||||
});
|
||||
|
||||
expect(fn).not.toHaveBeenCalled();
|
||||
expect(setTimeout).toHaveBeenCalledWith(fn, 0);
|
||||
});
|
||||
|
||||
it("falls back to setTimeout", function() {
|
||||
var setTimeout = jasmine.createSpy('setTimeout').and.callFake(function(fn) { fn() }),
|
||||
global = { setTimeout: setTimeout },
|
||||
clearStack = jasmineUnderTest.getClearStack(global),
|
||||
called = false;
|
||||
|
||||
clearStack(function() {
|
||||
called = true;
|
||||
});
|
||||
|
||||
expect(called).toBe(true);
|
||||
expect(setTimeout).toHaveBeenCalledWith(jasmine.any(Function), 0);
|
||||
});
|
||||
});
|
||||
@@ -1,12 +1,14 @@
|
||||
describe("Clock", function() {
|
||||
|
||||
var NODE_JS = typeof process !== 'undefined' && process.versions && typeof process.versions.node === 'string';
|
||||
|
||||
it("does not replace setTimeout until it is installed", function() {
|
||||
var fakeSetTimeout = jasmine.createSpy("global setTimeout"),
|
||||
fakeGlobal = { setTimeout: fakeSetTimeout },
|
||||
delayedFunctionScheduler = jasmine.createSpyObj("delayedFunctionScheduler", ["scheduleFunction"]),
|
||||
delayedFn = jasmine.createSpy("delayedFn"),
|
||||
mockDate = { install: function() {}, tick: function() {}, uninstall: function() {} },
|
||||
clock = new j$.Clock(fakeGlobal, delayedFunctionScheduler, mockDate);
|
||||
clock = new jasmineUnderTest.Clock(fakeGlobal, function () { return delayedFunctionScheduler; }, mockDate);
|
||||
|
||||
fakeGlobal.setTimeout(delayedFn, 0);
|
||||
|
||||
@@ -28,7 +30,7 @@ describe("Clock", function() {
|
||||
delayedFunctionScheduler = jasmine.createSpyObj("delayedFunctionScheduler", ["removeFunctionWithId"]),
|
||||
delayedFn = jasmine.createSpy("delayedFn"),
|
||||
mockDate = { install: function() {}, tick: function() {}, uninstall: function() {} },
|
||||
clock = new j$.Clock(fakeGlobal, delayedFunctionScheduler, mockDate);
|
||||
clock = new jasmineUnderTest.Clock(fakeGlobal, function () { return delayedFunctionScheduler; }, mockDate);
|
||||
|
||||
fakeGlobal.clearTimeout("foo");
|
||||
|
||||
@@ -50,7 +52,7 @@ describe("Clock", function() {
|
||||
delayedFunctionScheduler = jasmine.createSpyObj("delayedFunctionScheduler", ["scheduleFunction"]),
|
||||
delayedFn = jasmine.createSpy("delayedFn"),
|
||||
mockDate = { install: function() {}, tick: function() {}, uninstall: function() {} },
|
||||
clock = new j$.Clock(fakeGlobal, delayedFunctionScheduler, mockDate);
|
||||
clock = new jasmineUnderTest.Clock(fakeGlobal, function () { return delayedFunctionScheduler; }, mockDate);
|
||||
|
||||
fakeGlobal.setInterval(delayedFn, 0);
|
||||
|
||||
@@ -72,7 +74,7 @@ describe("Clock", function() {
|
||||
delayedFunctionScheduler = jasmine.createSpyObj("delayedFunctionScheduler", ["removeFunctionWithId"]),
|
||||
delayedFn = jasmine.createSpy("delayedFn"),
|
||||
mockDate = { install: function() {}, tick: function() {}, uninstall: function() {} },
|
||||
clock = new j$.Clock(fakeGlobal, delayedFunctionScheduler, mockDate);
|
||||
clock = new jasmineUnderTest.Clock(fakeGlobal, function () { return delayedFunctionScheduler; }, mockDate);
|
||||
|
||||
fakeGlobal.clearInterval("foo");
|
||||
|
||||
@@ -88,6 +90,78 @@ describe("Clock", function() {
|
||||
expect(fakeClearInterval).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("does not install if the current setTimeout is not the original function on the global", function() {
|
||||
var originalFakeSetTimeout = function() {},
|
||||
replacedSetTimeout = function() {},
|
||||
fakeGlobal = { setTimeout: originalFakeSetTimeout },
|
||||
delayedFunctionSchedulerFactory = jasmine.createSpy('delayedFunctionSchedulerFactory'),
|
||||
mockDate = {},
|
||||
clock = new jasmineUnderTest.Clock(fakeGlobal, delayedFunctionSchedulerFactory, mockDate);
|
||||
|
||||
fakeGlobal.setTimeout = replacedSetTimeout;
|
||||
|
||||
expect(function() {
|
||||
clock.install();
|
||||
}).toThrowError(/unable to install/);
|
||||
|
||||
expect(delayedFunctionSchedulerFactory).not.toHaveBeenCalled();
|
||||
expect(fakeGlobal.setTimeout).toBe(replacedSetTimeout);
|
||||
});
|
||||
|
||||
it("does not install if the current clearTimeout is not the original function on the global", function() {
|
||||
var originalFakeClearTimeout = function() {},
|
||||
replacedClearTimeout = function() {},
|
||||
fakeGlobal = { clearTimeout: originalFakeClearTimeout },
|
||||
delayedFunctionSchedulerFactory = jasmine.createSpy('delayedFunctionSchedulerFactory'),
|
||||
mockDate = {},
|
||||
clock = new jasmineUnderTest.Clock(fakeGlobal, delayedFunctionSchedulerFactory, mockDate);
|
||||
|
||||
fakeGlobal.clearTimeout = replacedClearTimeout;
|
||||
|
||||
expect(function() {
|
||||
clock.install();
|
||||
}).toThrowError(/unable to install/);
|
||||
|
||||
expect(delayedFunctionSchedulerFactory).not.toHaveBeenCalled();
|
||||
expect(fakeGlobal.clearTimeout).toBe(replacedClearTimeout);
|
||||
});
|
||||
|
||||
it("does not install if the current setInterval is not the original function on the global", function() {
|
||||
var originalFakeSetInterval = function() {},
|
||||
replacedSetInterval = function() {},
|
||||
fakeGlobal = { setInterval: originalFakeSetInterval },
|
||||
delayedFunctionSchedulerFactory = jasmine.createSpy('delayedFunctionSchedulerFactory'),
|
||||
mockDate = {},
|
||||
clock = new jasmineUnderTest.Clock(fakeGlobal, delayedFunctionSchedulerFactory, mockDate);
|
||||
|
||||
fakeGlobal.setInterval = replacedSetInterval;
|
||||
|
||||
expect(function() {
|
||||
clock.install();
|
||||
}).toThrowError(/unable to install/);
|
||||
|
||||
expect(delayedFunctionSchedulerFactory).not.toHaveBeenCalled();
|
||||
expect(fakeGlobal.setInterval).toBe(replacedSetInterval);
|
||||
});
|
||||
|
||||
it("does not install if the current clearInterval is not the original function on the global", function() {
|
||||
var originalFakeClearInterval = function() {},
|
||||
replacedClearInterval = function() {},
|
||||
fakeGlobal = { clearInterval: originalFakeClearInterval },
|
||||
delayedFunctionSchedulerFactory = jasmine.createSpy('delayedFunctionSchedulerFactory'),
|
||||
mockDate = {},
|
||||
clock = new jasmineUnderTest.Clock(fakeGlobal, delayedFunctionSchedulerFactory, mockDate);
|
||||
|
||||
fakeGlobal.clearInterval = replacedClearInterval;
|
||||
|
||||
expect(function() {
|
||||
clock.install();
|
||||
}).toThrowError(/unable to install/);
|
||||
|
||||
expect(delayedFunctionSchedulerFactory).not.toHaveBeenCalled();
|
||||
expect(fakeGlobal.clearInterval).toBe(replacedClearInterval);
|
||||
});
|
||||
|
||||
it("replaces the global timer functions on uninstall", function() {
|
||||
var fakeSetTimeout = jasmine.createSpy("global setTimeout"),
|
||||
fakeClearTimeout = jasmine.createSpy("global clearTimeout"),
|
||||
@@ -102,7 +176,7 @@ describe("Clock", function() {
|
||||
delayedFunctionScheduler = jasmine.createSpyObj("delayedFunctionScheduler", ["scheduleFunction", "reset"]),
|
||||
delayedFn = jasmine.createSpy("delayedFn"),
|
||||
mockDate = { install: function() {}, tick: function() {}, uninstall: function() {} },
|
||||
clock = new j$.Clock(fakeGlobal, delayedFunctionScheduler, mockDate);
|
||||
clock = new jasmineUnderTest.Clock(fakeGlobal, function () { return delayedFunctionScheduler; }, mockDate);
|
||||
|
||||
clock.install();
|
||||
clock.uninstall();
|
||||
@@ -118,6 +192,103 @@ describe("Clock", function() {
|
||||
expect(delayedFunctionScheduler.scheduleFunction).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("can be installed for the duration of a passed in function and uninstalled when done", function() {
|
||||
var fakeSetTimeout = jasmine.createSpy("global setTimeout"),
|
||||
fakeClearTimeout = jasmine.createSpy("global clearTimeout"),
|
||||
fakeSetInterval = jasmine.createSpy("global setInterval"),
|
||||
fakeClearInterval = jasmine.createSpy("global clearInterval"),
|
||||
fakeGlobal = {
|
||||
setTimeout: fakeSetTimeout,
|
||||
clearTimeout: fakeClearTimeout,
|
||||
setInterval: fakeSetInterval,
|
||||
clearInterval: fakeClearInterval
|
||||
},
|
||||
delayedFunctionScheduler = jasmine.createSpyObj("delayedFunctionScheduler", ["scheduleFunction", "reset", "removeFunctionWithId"]),
|
||||
delayedFn = jasmine.createSpy("delayedFn"),
|
||||
mockDate = { install: function() {}, tick: function() {}, uninstall: function() {} },
|
||||
clock = new jasmineUnderTest.Clock(fakeGlobal, function () { return delayedFunctionScheduler; }, mockDate),
|
||||
passedFunctionCalled = false;
|
||||
|
||||
clock.withMock(function() {
|
||||
fakeGlobal.setTimeout(delayedFn, 0);
|
||||
fakeGlobal.clearTimeout("foo");
|
||||
fakeGlobal.setInterval(delayedFn, 10);
|
||||
fakeGlobal.clearInterval("bar");
|
||||
passedFunctionCalled = true;
|
||||
});
|
||||
|
||||
expect(passedFunctionCalled).toBe(true);
|
||||
|
||||
expect(fakeSetTimeout).not.toHaveBeenCalled();
|
||||
expect(fakeClearTimeout).not.toHaveBeenCalled();
|
||||
expect(fakeSetInterval).not.toHaveBeenCalled();
|
||||
expect(fakeClearInterval).not.toHaveBeenCalled();
|
||||
expect(delayedFunctionScheduler.scheduleFunction).toHaveBeenCalled();
|
||||
|
||||
delayedFunctionScheduler.scheduleFunction.calls.reset();
|
||||
|
||||
fakeGlobal.setTimeout(delayedFn, 0);
|
||||
fakeGlobal.clearTimeout("foo");
|
||||
fakeGlobal.setInterval(delayedFn, 10);
|
||||
fakeGlobal.clearInterval("bar");
|
||||
|
||||
expect(fakeSetTimeout).toHaveBeenCalledWith(delayedFn, 0);
|
||||
expect(fakeClearTimeout).toHaveBeenCalledWith("foo");
|
||||
expect(fakeSetInterval).toHaveBeenCalledWith(delayedFn, 10);
|
||||
expect(fakeClearInterval).toHaveBeenCalledWith("bar");
|
||||
expect(delayedFunctionScheduler.scheduleFunction).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("can be installed for the duration of a passed in function and uninstalled if an error is thrown", function() {
|
||||
var fakeSetTimeout = jasmine.createSpy("global setTimeout"),
|
||||
fakeClearTimeout = jasmine.createSpy("global clearTimeout"),
|
||||
fakeSetInterval = jasmine.createSpy("global setInterval"),
|
||||
fakeClearInterval = jasmine.createSpy("global clearInterval"),
|
||||
fakeGlobal = {
|
||||
setTimeout: fakeSetTimeout,
|
||||
clearTimeout: fakeClearTimeout,
|
||||
setInterval: fakeSetInterval,
|
||||
clearInterval: fakeClearInterval
|
||||
},
|
||||
delayedFunctionScheduler = jasmine.createSpyObj("delayedFunctionScheduler", ["scheduleFunction", "reset", "removeFunctionWithId"]),
|
||||
delayedFn = jasmine.createSpy("delayedFn"),
|
||||
mockDate = { install: function() {}, tick: function() {}, uninstall: function() {} },
|
||||
clock = new jasmineUnderTest.Clock(fakeGlobal, function () { return delayedFunctionScheduler; }, mockDate),
|
||||
passedFunctionCalled = false;
|
||||
|
||||
expect(function() {
|
||||
clock.withMock(function() {
|
||||
fakeGlobal.setTimeout(delayedFn, 0);
|
||||
fakeGlobal.clearTimeout("foo");
|
||||
fakeGlobal.setInterval(delayedFn, 10);
|
||||
fakeGlobal.clearInterval("bar");
|
||||
passedFunctionCalled = true;
|
||||
throw 'oops';
|
||||
});
|
||||
}).toThrow('oops');
|
||||
|
||||
expect(passedFunctionCalled).toBe(true);
|
||||
|
||||
expect(fakeSetTimeout).not.toHaveBeenCalled();
|
||||
expect(fakeClearTimeout).not.toHaveBeenCalled();
|
||||
expect(fakeSetInterval).not.toHaveBeenCalled();
|
||||
expect(fakeClearInterval).not.toHaveBeenCalled();
|
||||
expect(delayedFunctionScheduler.scheduleFunction).toHaveBeenCalled();
|
||||
|
||||
delayedFunctionScheduler.scheduleFunction.calls.reset();
|
||||
|
||||
fakeGlobal.setTimeout(delayedFn, 0);
|
||||
fakeGlobal.clearTimeout("foo");
|
||||
fakeGlobal.setInterval(delayedFn, 10);
|
||||
fakeGlobal.clearInterval("bar");
|
||||
|
||||
expect(fakeSetTimeout).toHaveBeenCalledWith(delayedFn, 0);
|
||||
expect(fakeClearTimeout).toHaveBeenCalledWith("foo");
|
||||
expect(fakeSetInterval).toHaveBeenCalledWith(delayedFn, 10);
|
||||
expect(fakeClearInterval).toHaveBeenCalledWith("bar");
|
||||
expect(delayedFunctionScheduler.scheduleFunction).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("schedules the delayed function (via setTimeout) with the fake timer", function() {
|
||||
var fakeSetTimeout = jasmine.createSpy('setTimeout'),
|
||||
scheduleFunction = jasmine.createSpy('scheduleFunction'),
|
||||
@@ -125,13 +296,19 @@ describe("Clock", function() {
|
||||
fakeGlobal = { setTimeout: fakeSetTimeout },
|
||||
delayedFn = jasmine.createSpy('delayedFn'),
|
||||
mockDate = { install: function() {}, tick: function() {}, uninstall: function() {} },
|
||||
clock = new j$.Clock(fakeGlobal, delayedFunctionScheduler, mockDate);
|
||||
clock = new jasmineUnderTest.Clock(fakeGlobal, function () { return delayedFunctionScheduler; }, mockDate),
|
||||
timeout = new clock.FakeTimeout();
|
||||
|
||||
clock.install();
|
||||
clock.setTimeout(delayedFn, 0, 'a', 'b');
|
||||
|
||||
expect(fakeSetTimeout).not.toHaveBeenCalled();
|
||||
expect(delayedFunctionScheduler.scheduleFunction).toHaveBeenCalledWith(delayedFn, 0, ['a', 'b']);
|
||||
|
||||
if (!NODE_JS) {
|
||||
expect(delayedFunctionScheduler.scheduleFunction).toHaveBeenCalledWith(delayedFn, 0, ['a', 'b']);
|
||||
} else {
|
||||
expect(delayedFunctionScheduler.scheduleFunction).toHaveBeenCalledWith(delayedFn, 0, ['a', 'b'], false, timeout);
|
||||
}
|
||||
});
|
||||
|
||||
it("returns an id for the delayed function", function() {
|
||||
@@ -142,13 +319,17 @@ describe("Clock", function() {
|
||||
fakeGlobal = { setTimeout: fakeSetTimeout },
|
||||
delayedFn = jasmine.createSpy('delayedFn'),
|
||||
mockDate = { install: function() {}, tick: function() {}, uninstall: function() {} },
|
||||
clock = new j$.Clock(fakeGlobal, delayedFunctionScheduler, mockDate),
|
||||
timeoutId;
|
||||
clock = new jasmineUnderTest.Clock(fakeGlobal, function () { return delayedFunctionScheduler; }, mockDate),
|
||||
timeout;
|
||||
|
||||
clock.install();
|
||||
timeoutId = clock.setTimeout(delayedFn, 0);
|
||||
timeout = clock.setTimeout(delayedFn, 0);
|
||||
|
||||
expect(timeoutId).toEqual(123);
|
||||
if (!NODE_JS) {
|
||||
expect(timeout).toEqual(123);
|
||||
} else {
|
||||
expect(timeout.constructor.name).toEqual('FakeTimeout');
|
||||
}
|
||||
});
|
||||
|
||||
it("clears the scheduled function with the scheduler", function() {
|
||||
@@ -157,7 +338,7 @@ describe("Clock", function() {
|
||||
fakeGlobal = { setTimeout: fakeClearTimeout },
|
||||
delayedFn = jasmine.createSpy('delayedFn'),
|
||||
mockDate = { install: function() {}, tick: function() {}, uninstall: function() {} },
|
||||
clock = new j$.Clock(fakeGlobal, delayedFunctionScheduler, mockDate);
|
||||
clock = new jasmineUnderTest.Clock(fakeGlobal, function () { return delayedFunctionScheduler; }, mockDate);
|
||||
|
||||
clock.install();
|
||||
clock.clearTimeout(123);
|
||||
@@ -173,13 +354,19 @@ describe("Clock", function() {
|
||||
fakeGlobal = { setInterval: fakeSetInterval },
|
||||
delayedFn = jasmine.createSpy('delayedFn'),
|
||||
mockDate = { install: function() {}, tick: function() {}, uninstall: function() {} },
|
||||
clock = new j$.Clock(fakeGlobal, delayedFunctionScheduler, mockDate);
|
||||
clock = new jasmineUnderTest.Clock(fakeGlobal, function () { return delayedFunctionScheduler; }, mockDate),
|
||||
timeout = new clock.FakeTimeout;
|
||||
|
||||
clock.install();
|
||||
clock.setInterval(delayedFn, 0, 'a', 'b');
|
||||
|
||||
expect(fakeSetInterval).not.toHaveBeenCalled();
|
||||
expect(delayedFunctionScheduler.scheduleFunction).toHaveBeenCalledWith(delayedFn, 0, ['a', 'b'], true);
|
||||
|
||||
if (!NODE_JS) {
|
||||
expect(delayedFunctionScheduler.scheduleFunction).toHaveBeenCalledWith(delayedFn, 0, ['a', 'b'], true);
|
||||
} else {
|
||||
expect(delayedFunctionScheduler.scheduleFunction).toHaveBeenCalledWith(delayedFn, 0, ['a', 'b'], true, timeout);
|
||||
}
|
||||
});
|
||||
|
||||
it("returns an id for the delayed function", function() {
|
||||
@@ -190,13 +377,17 @@ describe("Clock", function() {
|
||||
fakeGlobal = { setInterval: fakeSetInterval },
|
||||
delayedFn = jasmine.createSpy('delayedFn'),
|
||||
mockDate = { install: function() {}, tick: function() {}, uninstall: function() {} },
|
||||
clock = new j$.Clock(fakeGlobal, delayedFunctionScheduler, mockDate),
|
||||
intervalId;
|
||||
clock = new jasmineUnderTest.Clock(fakeGlobal, function () { return delayedFunctionScheduler; }, mockDate),
|
||||
interval;
|
||||
|
||||
clock.install();
|
||||
intervalId = clock.setInterval(delayedFn, 0);
|
||||
interval = clock.setInterval(delayedFn, 0);
|
||||
|
||||
expect(intervalId).toEqual(123);
|
||||
if (!NODE_JS) {
|
||||
expect(interval).toEqual(123);
|
||||
} else {
|
||||
expect(interval.constructor.name).toEqual('FakeTimeout');
|
||||
}
|
||||
});
|
||||
|
||||
it("clears the scheduled function with the scheduler", function() {
|
||||
@@ -205,7 +396,7 @@ describe("Clock", function() {
|
||||
fakeGlobal = { setInterval: clearInterval },
|
||||
delayedFn = jasmine.createSpy('delayedFn'),
|
||||
mockDate = { install: function() {}, tick: function() {}, uninstall: function() {} },
|
||||
clock = new j$.Clock(fakeGlobal, delayedFunctionScheduler, mockDate);
|
||||
clock = new jasmineUnderTest.Clock(fakeGlobal, function () { return delayedFunctionScheduler; }, mockDate);
|
||||
|
||||
clock.install();
|
||||
clock.clearInterval(123);
|
||||
@@ -215,43 +406,11 @@ describe("Clock", function() {
|
||||
});
|
||||
|
||||
it("gives you a friendly reminder if the Clock is not installed and you tick", function() {
|
||||
var clock = new j$.Clock({}, jasmine.createSpyObj('delayedFunctionScheduler', ['tick']));
|
||||
var clock = new jasmineUnderTest.Clock({}, jasmine.createSpyObj('delayedFunctionScheduler', ['tick']));
|
||||
expect(function() {
|
||||
clock.tick(50);
|
||||
}).toThrow();
|
||||
});
|
||||
|
||||
it("on IE < 9, fails if extra args are passed to fake clock", function() {
|
||||
//fail, because this would break in IE9.
|
||||
var fakeSetTimeout = jasmine.createSpy('setTimeout'),
|
||||
fakeSetInterval = jasmine.createSpy('setInterval'),
|
||||
delayedFunctionScheduler = jasmine.createSpyObj('delayedFunctionScheduler', ['scheduleFunction']),
|
||||
fn = jasmine.createSpy('fn'),
|
||||
fakeGlobal = {
|
||||
setTimeout: fakeSetTimeout,
|
||||
setInterval: fakeSetInterval
|
||||
},
|
||||
mockDate = { install: function() {}, tick: function() {}, uninstall: function() {} },
|
||||
clock = new j$.Clock(fakeGlobal, delayedFunctionScheduler, mockDate);
|
||||
|
||||
fakeSetTimeout.apply = null;
|
||||
fakeSetInterval.apply = null;
|
||||
|
||||
clock.install();
|
||||
|
||||
clock.setTimeout(fn, 0);
|
||||
expect(delayedFunctionScheduler.scheduleFunction).toHaveBeenCalledWith(fn, 0, []);
|
||||
expect(function() {
|
||||
clock.setTimeout(fn, 0, 'extra');
|
||||
}).toThrow();
|
||||
|
||||
clock.setInterval(fn, 0);
|
||||
expect(delayedFunctionScheduler.scheduleFunction).toHaveBeenCalledWith(fn, 0, [], true);
|
||||
expect(function() {
|
||||
clock.setInterval(fn, 0, 'extra');
|
||||
}).toThrow();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe("Clock (acceptance)", function() {
|
||||
@@ -260,9 +419,9 @@ describe("Clock (acceptance)", function() {
|
||||
delayedFn2 = jasmine.createSpy('delayedFn2'),
|
||||
delayedFn3 = jasmine.createSpy('delayedFn3'),
|
||||
recurring1 = jasmine.createSpy('recurring1'),
|
||||
delayedFunctionScheduler = new j$.DelayedFunctionScheduler(),
|
||||
delayedFunctionScheduler = new jasmineUnderTest.DelayedFunctionScheduler(),
|
||||
mockDate = { install: function() {}, tick: function() {}, uninstall: function() {} },
|
||||
clock = new j$.Clock({setTimeout: setTimeout}, delayedFunctionScheduler, mockDate);
|
||||
clock = new jasmineUnderTest.Clock({setTimeout: setTimeout}, function () { return delayedFunctionScheduler; }, mockDate);
|
||||
|
||||
clock.install();
|
||||
|
||||
@@ -307,9 +466,9 @@ describe("Clock (acceptance)", function() {
|
||||
|
||||
it("can clear a previously set timeout", function() {
|
||||
var clearedFn = jasmine.createSpy('clearedFn'),
|
||||
delayedFunctionScheduler = new j$.DelayedFunctionScheduler(),
|
||||
delayedFunctionScheduler = new jasmineUnderTest.DelayedFunctionScheduler(),
|
||||
mockDate = { install: function() {}, tick: function() {}, uninstall: function() {} },
|
||||
clock = new j$.Clock({setTimeout: function() {}}, delayedFunctionScheduler, mockDate),
|
||||
clock = new jasmineUnderTest.Clock({setTimeout: function() {}}, function () { return delayedFunctionScheduler; }, mockDate),
|
||||
timeoutId;
|
||||
|
||||
clock.install();
|
||||
@@ -323,11 +482,29 @@ describe("Clock (acceptance)", function() {
|
||||
expect(clearedFn).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("can clear a previously set interval using that interval's handler", function() {
|
||||
var spy = jasmine.createSpy('spy'),
|
||||
delayedFunctionScheduler = new jasmineUnderTest.DelayedFunctionScheduler(),
|
||||
mockDate = { install: function() {}, tick: function() {}, uninstall: function() {} },
|
||||
clock = new jasmineUnderTest.Clock({setInterval: function() {}}, function () { return delayedFunctionScheduler; }, mockDate),
|
||||
intervalId;
|
||||
|
||||
clock.install();
|
||||
|
||||
intervalId = clock.setInterval(function() {
|
||||
spy();
|
||||
clock.clearInterval(intervalId);
|
||||
}, 100);
|
||||
clock.tick(200);
|
||||
|
||||
expect(spy.calls.count()).toEqual(1);
|
||||
});
|
||||
|
||||
it("correctly schedules functions after the Clock has advanced", function() {
|
||||
var delayedFn1 = jasmine.createSpy('delayedFn1'),
|
||||
delayedFunctionScheduler = new j$.DelayedFunctionScheduler(),
|
||||
delayedFunctionScheduler = new jasmineUnderTest.DelayedFunctionScheduler(),
|
||||
mockDate = { install: function() {}, tick: function() {}, uninstall: function() {} },
|
||||
clock = new j$.Clock({setTimeout: function() {}}, delayedFunctionScheduler, mockDate);
|
||||
clock = new jasmineUnderTest.Clock({setTimeout: function() {}}, function () { return delayedFunctionScheduler; }, mockDate);
|
||||
|
||||
clock.install();
|
||||
|
||||
@@ -342,9 +519,9 @@ describe("Clock (acceptance)", function() {
|
||||
it("correctly schedules functions while the Clock is advancing", function() {
|
||||
var delayedFn1 = jasmine.createSpy('delayedFn1'),
|
||||
delayedFn2 = jasmine.createSpy('delayedFn2'),
|
||||
delayedFunctionScheduler = new j$.DelayedFunctionScheduler(),
|
||||
delayedFunctionScheduler = new jasmineUnderTest.DelayedFunctionScheduler(),
|
||||
mockDate = { install: function() {}, tick: function() {}, uninstall: function() {} },
|
||||
clock = new j$.Clock({setTimeout: function() {}}, delayedFunctionScheduler, mockDate);
|
||||
clock = new jasmineUnderTest.Clock({setTimeout: function() {}}, function () { return delayedFunctionScheduler; }, mockDate);
|
||||
|
||||
delayedFn1.and.callFake(function() { clock.setTimeout(delayedFn2, 0); });
|
||||
clock.install();
|
||||
@@ -361,9 +538,9 @@ describe("Clock (acceptance)", function() {
|
||||
it("correctly calls functions scheduled while the Clock is advancing", function() {
|
||||
var delayedFn1 = jasmine.createSpy('delayedFn1'),
|
||||
delayedFn2 = jasmine.createSpy('delayedFn2'),
|
||||
delayedFunctionScheduler = new j$.DelayedFunctionScheduler(),
|
||||
delayedFunctionScheduler = new jasmineUnderTest.DelayedFunctionScheduler(),
|
||||
mockDate = { install: function() {}, tick: function() {}, uninstall: function() {} },
|
||||
clock = new j$.Clock({setTimeout: function() {}}, delayedFunctionScheduler, mockDate);
|
||||
clock = new jasmineUnderTest.Clock({setTimeout: function() {}}, function () { return delayedFunctionScheduler; }, mockDate);
|
||||
|
||||
delayedFn1.and.callFake(function() { clock.setTimeout(delayedFn2, 1); });
|
||||
clock.install();
|
||||
@@ -371,14 +548,38 @@ describe("Clock (acceptance)", function() {
|
||||
|
||||
clock.tick(6);
|
||||
expect(delayedFn1).toHaveBeenCalled();
|
||||
expect(delayedFn2).toHaveBeenCalled();
|
||||
expect(delayedFn2).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("correctly schedules functions scheduled while the Clock is advancing but after the Clock is uninstalled", function() {
|
||||
var delayedFn1 = jasmine.createSpy('delayedFn1'),
|
||||
delayedFn2 = jasmine.createSpy('delayedFn2'),
|
||||
delayedFunctionScheduler = new jasmineUnderTest.DelayedFunctionScheduler(),
|
||||
mockDate = { install: function() {}, tick: function() {}, uninstall: function() {} },
|
||||
clock = new jasmineUnderTest.Clock({setTimeout: function() {}}, function () { return delayedFunctionScheduler; }, mockDate);
|
||||
|
||||
delayedFn1.and.callFake(function() {
|
||||
clock.uninstall();
|
||||
clock.install();
|
||||
clock.setTimeout(delayedFn2, 0);
|
||||
});
|
||||
|
||||
clock.install();
|
||||
clock.setTimeout(delayedFn1, 1);
|
||||
|
||||
clock.tick(1);
|
||||
expect(delayedFn1).toHaveBeenCalled();
|
||||
expect(delayedFn2).not.toHaveBeenCalled();
|
||||
|
||||
clock.tick(1);
|
||||
expect(delayedFn2).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("does not mock the Date object by default", function() {
|
||||
var delayedFunctionScheduler = new j$.DelayedFunctionScheduler(),
|
||||
var delayedFunctionScheduler = new jasmineUnderTest.DelayedFunctionScheduler(),
|
||||
global = {Date: Date},
|
||||
mockDate = new j$.MockDate(global),
|
||||
clock = new j$.Clock({setTimeout: setTimeout}, delayedFunctionScheduler, mockDate);
|
||||
mockDate = new jasmineUnderTest.MockDate(global),
|
||||
clock = new jasmineUnderTest.Clock({setTimeout: setTimeout}, function () { return delayedFunctionScheduler; }, mockDate);
|
||||
|
||||
clock.install();
|
||||
|
||||
@@ -392,10 +593,10 @@ describe("Clock (acceptance)", function() {
|
||||
});
|
||||
|
||||
it("mocks the Date object and sets it to current time", function() {
|
||||
var delayedFunctionScheduler = new j$.DelayedFunctionScheduler(),
|
||||
var delayedFunctionScheduler = new jasmineUnderTest.DelayedFunctionScheduler(),
|
||||
global = {Date: Date},
|
||||
mockDate = new j$.MockDate(global),
|
||||
clock = new j$.Clock({setTimeout: setTimeout}, delayedFunctionScheduler, mockDate);
|
||||
mockDate = new jasmineUnderTest.MockDate(global),
|
||||
clock = new jasmineUnderTest.Clock({setTimeout: setTimeout}, function () { return delayedFunctionScheduler; }, mockDate);
|
||||
|
||||
clock.install().mockDate();
|
||||
|
||||
@@ -416,10 +617,10 @@ describe("Clock (acceptance)", function() {
|
||||
});
|
||||
|
||||
it("mocks the Date object and sets it to a given time", function() {
|
||||
var delayedFunctionScheduler = new j$.DelayedFunctionScheduler(),
|
||||
var delayedFunctionScheduler = new jasmineUnderTest.DelayedFunctionScheduler(),
|
||||
global = {Date: Date},
|
||||
mockDate = new j$.MockDate(global),
|
||||
clock = new j$.Clock({setTimeout: setTimeout}, delayedFunctionScheduler, mockDate),
|
||||
mockDate = new jasmineUnderTest.MockDate(global),
|
||||
clock = new jasmineUnderTest.Clock({setTimeout: setTimeout}, function () { return delayedFunctionScheduler; }, mockDate),
|
||||
baseTime = new Date(2013, 9, 23);
|
||||
|
||||
|
||||
@@ -442,4 +643,68 @@ describe("Clock (acceptance)", function() {
|
||||
|
||||
expect(timeoutDate).toEqual(baseTime.getTime() + 150);
|
||||
});
|
||||
|
||||
it("mocks the Date object and updates the date per delayed function", function () {
|
||||
var delayedFunctionScheduler = new jasmineUnderTest.DelayedFunctionScheduler(),
|
||||
global = {Date: Date},
|
||||
mockDate = new jasmineUnderTest.MockDate(global),
|
||||
clock = new jasmineUnderTest.Clock({setTimeout: setTimeout}, function () { return delayedFunctionScheduler; }, mockDate),
|
||||
baseTime = new Date();
|
||||
|
||||
clock.install().mockDate(baseTime);
|
||||
|
||||
var actualTimes = [];
|
||||
var pushCurrentTime = function() { actualTimes.push(global.Date().getTime()); };
|
||||
delayedFunctionScheduler.scheduleFunction(pushCurrentTime);
|
||||
delayedFunctionScheduler.scheduleFunction(pushCurrentTime, 1);
|
||||
delayedFunctionScheduler.scheduleFunction(pushCurrentTime, 3);
|
||||
|
||||
clock.tick(1);
|
||||
expect(global.Date().getTime()).toEqual(baseTime.getTime() + 1);
|
||||
|
||||
clock.tick(3);
|
||||
expect(global.Date().getTime()).toEqual(baseTime.getTime() + 4);
|
||||
|
||||
clock.tick(1);
|
||||
expect(global.Date().getTime()).toEqual(baseTime.getTime() + 5);
|
||||
|
||||
expect(actualTimes).toEqual([baseTime.getTime(), baseTime.getTime() + 1, baseTime.getTime() + 3]);
|
||||
})
|
||||
|
||||
it('correctly clears a scheduled timeout while the Clock is advancing', function () {
|
||||
var delayedFunctionScheduler = new jasmineUnderTest.DelayedFunctionScheduler(),
|
||||
global = {Date: Date, setTimeout: undefined},
|
||||
mockDate = new jasmineUnderTest.MockDate(global),
|
||||
clock = new jasmineUnderTest.Clock(global, function () { return delayedFunctionScheduler; }, mockDate);
|
||||
|
||||
clock.install();
|
||||
|
||||
var timerId2;
|
||||
|
||||
global.setTimeout(function () {
|
||||
global.clearTimeout(timerId2);
|
||||
}, 100);
|
||||
|
||||
timerId2 = global.setTimeout(fail, 100);
|
||||
|
||||
clock.tick(100);
|
||||
});
|
||||
|
||||
it('correctly clears a scheduled interval while the Clock is advancing', function () {
|
||||
var delayedFunctionScheduler = new jasmineUnderTest.DelayedFunctionScheduler(),
|
||||
global = {Date: Date, setTimeout: undefined},
|
||||
mockDate = new jasmineUnderTest.MockDate(global),
|
||||
clock = new jasmineUnderTest.Clock(global, function () { return delayedFunctionScheduler; }, mockDate);
|
||||
|
||||
clock.install();
|
||||
|
||||
var timerId2;
|
||||
var timerId1 = global.setInterval(function () {
|
||||
global.clearInterval(timerId2);
|
||||
}, 100);
|
||||
|
||||
timerId2 = global.setInterval(fail, 100);
|
||||
|
||||
clock.tick(400);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
describe("DelayedFunctionScheduler", function() {
|
||||
it("schedules a function for later execution", function() {
|
||||
var scheduler = new j$.DelayedFunctionScheduler(),
|
||||
var scheduler = new jasmineUnderTest.DelayedFunctionScheduler(),
|
||||
fn = jasmine.createSpy('fn');
|
||||
|
||||
scheduler.scheduleFunction(fn, 0);
|
||||
@@ -13,7 +13,7 @@ describe("DelayedFunctionScheduler", function() {
|
||||
});
|
||||
|
||||
it("schedules a string for later execution", function() {
|
||||
var scheduler = new j$.DelayedFunctionScheduler(),
|
||||
var scheduler = new jasmineUnderTest.DelayedFunctionScheduler(),
|
||||
strfn = "horrible = true;";
|
||||
|
||||
scheduler.scheduleFunction(strfn, 0);
|
||||
@@ -24,7 +24,7 @@ describe("DelayedFunctionScheduler", function() {
|
||||
});
|
||||
|
||||
it("#tick defaults to 0", function() {
|
||||
var scheduler = new j$.DelayedFunctionScheduler(),
|
||||
var scheduler = new jasmineUnderTest.DelayedFunctionScheduler(),
|
||||
fn = jasmine.createSpy('fn');
|
||||
|
||||
scheduler.scheduleFunction(fn, 0);
|
||||
@@ -37,7 +37,7 @@ describe("DelayedFunctionScheduler", function() {
|
||||
});
|
||||
|
||||
it("defaults delay to 0", function() {
|
||||
var scheduler = new j$.DelayedFunctionScheduler(),
|
||||
var scheduler = new jasmineUnderTest.DelayedFunctionScheduler(),
|
||||
fn = jasmine.createSpy('fn');
|
||||
|
||||
scheduler.scheduleFunction(fn);
|
||||
@@ -50,7 +50,7 @@ describe("DelayedFunctionScheduler", function() {
|
||||
});
|
||||
|
||||
it("optionally passes params to scheduled functions", function() {
|
||||
var scheduler = new j$.DelayedFunctionScheduler(),
|
||||
var scheduler = new jasmineUnderTest.DelayedFunctionScheduler(),
|
||||
fn = jasmine.createSpy('fn');
|
||||
|
||||
scheduler.scheduleFunction(fn, 0, ['foo', 'bar']);
|
||||
@@ -63,7 +63,7 @@ describe("DelayedFunctionScheduler", function() {
|
||||
});
|
||||
|
||||
it("scheduled fns can optionally reoccur", function() {
|
||||
var scheduler = new j$.DelayedFunctionScheduler(),
|
||||
var scheduler = new jasmineUnderTest.DelayedFunctionScheduler(),
|
||||
fn = jasmine.createSpy('fn');
|
||||
|
||||
scheduler.scheduleFunction(fn, 20, [], true);
|
||||
@@ -85,7 +85,7 @@ describe("DelayedFunctionScheduler", function() {
|
||||
});
|
||||
|
||||
it("increments scheduled fns ids unless one is passed", function() {
|
||||
var scheduler = new j$.DelayedFunctionScheduler();
|
||||
var scheduler = new jasmineUnderTest.DelayedFunctionScheduler();
|
||||
|
||||
expect(scheduler.scheduleFunction(function() {
|
||||
}, 0)).toBe(1);
|
||||
@@ -98,7 +98,7 @@ describe("DelayedFunctionScheduler", function() {
|
||||
});
|
||||
|
||||
it("#removeFunctionWithId removes a previously scheduled function with a given id", function() {
|
||||
var scheduler = new j$.DelayedFunctionScheduler(),
|
||||
var scheduler = new jasmineUnderTest.DelayedFunctionScheduler(),
|
||||
fn = jasmine.createSpy('fn'),
|
||||
timeoutKey;
|
||||
|
||||
@@ -113,49 +113,8 @@ describe("DelayedFunctionScheduler", function() {
|
||||
expect(fn).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("reset removes scheduled functions", function() {
|
||||
var scheduler = new j$.DelayedFunctionScheduler(),
|
||||
fn = jasmine.createSpy('fn');
|
||||
|
||||
scheduler.scheduleFunction(fn, 0);
|
||||
|
||||
expect(fn).not.toHaveBeenCalled();
|
||||
|
||||
scheduler.reset();
|
||||
|
||||
scheduler.tick(0);
|
||||
|
||||
expect(fn).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("reset resets the returned ids", function() {
|
||||
var scheduler = new j$.DelayedFunctionScheduler();
|
||||
expect(scheduler.scheduleFunction(function() { }, 0)).toBe(1);
|
||||
expect(scheduler.scheduleFunction(function() { }, 0, [], false, 123)).toBe(123);
|
||||
|
||||
scheduler.reset();
|
||||
expect(scheduler.scheduleFunction(function() { }, 0)).toBe(1);
|
||||
expect(scheduler.scheduleFunction(function() { }, 0, [], false, 123)).toBe(123);
|
||||
});
|
||||
|
||||
it("reset resets the current tick time", function() {
|
||||
var scheduler = new j$.DelayedFunctionScheduler(),
|
||||
fn = jasmine.createSpy('fn');
|
||||
|
||||
expect(fn).not.toHaveBeenCalled();
|
||||
|
||||
scheduler.tick(15);
|
||||
scheduler.reset();
|
||||
|
||||
scheduler.scheduleFunction(fn, 20, [], false, 1, 20);
|
||||
|
||||
scheduler.tick(5);
|
||||
|
||||
expect(fn).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("executes recurring functions interleaved with regular functions in the correct order", function() {
|
||||
var scheduler = new j$.DelayedFunctionScheduler(),
|
||||
var scheduler = new jasmineUnderTest.DelayedFunctionScheduler(),
|
||||
fn = jasmine.createSpy('fn'),
|
||||
recurringCallCount = 0,
|
||||
recurring = jasmine.createSpy('recurring').and.callFake(function() {
|
||||
@@ -176,7 +135,7 @@ describe("DelayedFunctionScheduler", function() {
|
||||
});
|
||||
|
||||
it("schedules a function for later execution during a tick", function () {
|
||||
var scheduler = new j$.DelayedFunctionScheduler(),
|
||||
var scheduler = new jasmineUnderTest.DelayedFunctionScheduler(),
|
||||
fn = jasmine.createSpy('fn'),
|
||||
fnDelay = 10;
|
||||
|
||||
@@ -192,7 +151,7 @@ describe("DelayedFunctionScheduler", function() {
|
||||
});
|
||||
|
||||
it("#removeFunctionWithId removes a previously scheduled function with a given id during a tick", function () {
|
||||
var scheduler = new j$.DelayedFunctionScheduler(),
|
||||
var scheduler = new jasmineUnderTest.DelayedFunctionScheduler(),
|
||||
fn = jasmine.createSpy('fn'),
|
||||
fnDelay = 10,
|
||||
timeoutKey;
|
||||
@@ -210,7 +169,7 @@ describe("DelayedFunctionScheduler", function() {
|
||||
});
|
||||
|
||||
it("executes recurring functions interleaved with regular functions and functions scheduled during a tick in the correct order", function () {
|
||||
var scheduler = new j$.DelayedFunctionScheduler(),
|
||||
var scheduler = new jasmineUnderTest.DelayedFunctionScheduler(),
|
||||
fn = jasmine.createSpy('fn'),
|
||||
recurringCallCount = 0,
|
||||
recurring = jasmine.createSpy('recurring').and.callFake(function() {
|
||||
@@ -242,5 +201,86 @@ describe("DelayedFunctionScheduler", function() {
|
||||
expect(innerFn).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("executes recurring functions after rescheduling them", function () {
|
||||
var scheduler = new jasmineUnderTest.DelayedFunctionScheduler(),
|
||||
recurring = function() {
|
||||
expect(scheduler.scheduleFunction).toHaveBeenCalled();
|
||||
};
|
||||
|
||||
scheduler.scheduleFunction(recurring, 10, [], true);
|
||||
|
||||
spyOn(scheduler, "scheduleFunction");
|
||||
|
||||
scheduler.tick(10);
|
||||
});
|
||||
|
||||
it("removes functions during a tick that runs the function", function() {
|
||||
var scheduler = new jasmineUnderTest.DelayedFunctionScheduler(),
|
||||
spy = jasmine.createSpy('fn'),
|
||||
spyAndRemove = jasmine.createSpy('fn'),
|
||||
fnDelay = 10,
|
||||
timeoutKey;
|
||||
|
||||
spyAndRemove.and.callFake(function() {
|
||||
scheduler.removeFunctionWithId(timeoutKey);
|
||||
});
|
||||
|
||||
scheduler.scheduleFunction(spyAndRemove, fnDelay);
|
||||
|
||||
timeoutKey = scheduler.scheduleFunction(spy, fnDelay, [], true);
|
||||
|
||||
scheduler.tick(2 * fnDelay);
|
||||
|
||||
expect(spy).not.toHaveBeenCalled();
|
||||
expect(spyAndRemove).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("removes functions during the first tick that runs the function", function() {
|
||||
var scheduler = new jasmineUnderTest.DelayedFunctionScheduler(),
|
||||
fn = jasmine.createSpy('fn'),
|
||||
fnDelay = 10,
|
||||
timeoutKey;
|
||||
|
||||
timeoutKey = scheduler.scheduleFunction(fn, fnDelay, [], true);
|
||||
scheduler.scheduleFunction(function () {
|
||||
scheduler.removeFunctionWithId(timeoutKey);
|
||||
}, fnDelay);
|
||||
|
||||
expect(fn).not.toHaveBeenCalled();
|
||||
|
||||
scheduler.tick(3 * fnDelay);
|
||||
|
||||
expect(fn).toHaveBeenCalled();
|
||||
expect(fn.calls.count()).toBe(1);
|
||||
});
|
||||
|
||||
it("does not remove a function that hasn't been added yet", function() {
|
||||
var scheduler = new jasmineUnderTest.DelayedFunctionScheduler(),
|
||||
fn = jasmine.createSpy('fn'),
|
||||
fnDelay = 10,
|
||||
timeoutKey;
|
||||
|
||||
scheduler.removeFunctionWithId('foo');
|
||||
scheduler.scheduleFunction(fn, fnDelay, [], false, 'foo');
|
||||
|
||||
expect(fn).not.toHaveBeenCalled();
|
||||
|
||||
scheduler.tick(fnDelay + 1);
|
||||
|
||||
expect(fn).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("updates the mockDate per scheduled time", function () {
|
||||
var scheduler = new jasmineUnderTest.DelayedFunctionScheduler(),
|
||||
tickDate = jasmine.createSpy('tickDate');
|
||||
|
||||
scheduler.scheduleFunction(function() {});
|
||||
scheduler.scheduleFunction(function() {}, 1);
|
||||
|
||||
scheduler.tick(1, tickDate);
|
||||
|
||||
expect(tickDate).toHaveBeenCalledWith(0);
|
||||
expect(tickDate).toHaveBeenCalledWith(1);
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
@@ -2,76 +2,20 @@
|
||||
describe("Env", function() {
|
||||
var env;
|
||||
beforeEach(function() {
|
||||
env = new j$.Env();
|
||||
});
|
||||
|
||||
it('removes all spies when env is executed', function(done) {
|
||||
var originalFoo = function() {},
|
||||
testObj = {
|
||||
foo: originalFoo
|
||||
},
|
||||
firstSpec = jasmine.createSpy('firstSpec').and.callFake(function() {
|
||||
env.spyOn(testObj, 'foo');
|
||||
}),
|
||||
secondSpec = jasmine.createSpy('secondSpec').and.callFake(function() {
|
||||
expect(testObj.foo).toBe(originalFoo);
|
||||
});
|
||||
env.describe('test suite', function() {
|
||||
env.it('spec 0', firstSpec);
|
||||
env.it('spec 1', secondSpec);
|
||||
});
|
||||
|
||||
var assertions = function() {
|
||||
expect(firstSpec).toHaveBeenCalled();
|
||||
expect(secondSpec).toHaveBeenCalled();
|
||||
done();
|
||||
};
|
||||
|
||||
env.addReporter({ jasmineDone: assertions });
|
||||
|
||||
env.execute();
|
||||
});
|
||||
|
||||
describe("#spyOn", function() {
|
||||
it("checks for the existence of the object", function() {
|
||||
expect(function() {
|
||||
env.spyOn(void 0, 'pants');
|
||||
}).toThrowError(/could not find an object/);
|
||||
});
|
||||
|
||||
it("checks for the existence of the method", function() {
|
||||
var subject = {};
|
||||
|
||||
expect(function() {
|
||||
env.spyOn(subject, 'pants');
|
||||
}).toThrowError(/method does not exist/);
|
||||
});
|
||||
|
||||
it("checks if it has already been spied upon", function() {
|
||||
var subject = { spiedFunc: function() {} };
|
||||
|
||||
env.spyOn(subject, 'spiedFunc');
|
||||
|
||||
expect(function() {
|
||||
env.spyOn(subject, 'spiedFunc');
|
||||
}).toThrowError(/has already been spied upon/);
|
||||
});
|
||||
|
||||
it("overrides the method on the object and returns the spy", function() {
|
||||
var originalFunctionWasCalled = false;
|
||||
var subject = { spiedFunc: function() { originalFunctionWasCalled = true; } };
|
||||
|
||||
var spy = env.spyOn(subject, 'spiedFunc');
|
||||
|
||||
expect(subject.spiedFunc).toEqual(spy);
|
||||
});
|
||||
env = new jasmineUnderTest.Env();
|
||||
});
|
||||
|
||||
describe("#pending", function() {
|
||||
it("throws the Pending Spec exception", function() {
|
||||
expect(function() {
|
||||
env.pending();
|
||||
}).toThrow(j$.Spec.pendingSpecExceptionMessage);
|
||||
}).toThrow(jasmineUnderTest.Spec.pendingSpecExceptionMessage);
|
||||
});
|
||||
|
||||
it("throws the Pending Spec exception with a custom message", function() {
|
||||
expect(function() {
|
||||
env.pending('custom message');
|
||||
}).toThrow(jasmineUnderTest.Spec.pendingSpecExceptionMessage + 'custom message');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -81,5 +25,176 @@ describe("Env", function() {
|
||||
expect(suite.description).toEqual('Jasmine__TopLevel__Suite');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('can configure specs to throw errors on expectation failures', function() {
|
||||
env.throwOnExpectationFailure(true);
|
||||
|
||||
spyOn(jasmineUnderTest, 'Spec');
|
||||
env.it('foo', function() {});
|
||||
expect(jasmineUnderTest.Spec).toHaveBeenCalledWith(jasmine.objectContaining({
|
||||
throwOnExpectationFailure: true
|
||||
}));
|
||||
});
|
||||
|
||||
it('can configure suites to throw errors on expectation failures', function() {
|
||||
env.throwOnExpectationFailure(true);
|
||||
|
||||
spyOn(jasmineUnderTest, 'Suite');
|
||||
env.describe('foo', function() {});
|
||||
expect(jasmineUnderTest.Suite).toHaveBeenCalledWith(jasmine.objectContaining({
|
||||
throwOnExpectationFailure: true
|
||||
}));
|
||||
});
|
||||
|
||||
describe('#describe', function () {
|
||||
it("throws an error when given arguments", function() {
|
||||
expect(function() {
|
||||
env.describe('done method', function(done) {});
|
||||
}).toThrowError('describe does not expect any arguments');
|
||||
});
|
||||
|
||||
it('throws an error when it receives a non-fn argument', function() {
|
||||
// Some versions of PhantomJS return [object DOMWindow] when
|
||||
// Object.prototype.toString.apply is called with `undefined` or `null`.
|
||||
// In a similar fashion, IE8 gives [object Object] for both `undefined`
|
||||
// and `null`. We mostly just want these tests to check that using
|
||||
// anything other than a function throws an error.
|
||||
expect(function() {
|
||||
env.describe('undefined arg', undefined);
|
||||
}).toThrowError(/describe expects a function argument; received \[object (Undefined|DOMWindow|Object)\]/);
|
||||
expect(function() {
|
||||
env.describe('null arg', null);
|
||||
}).toThrowError(/describe expects a function argument; received \[object (Null|DOMWindow|Object)\]/);
|
||||
|
||||
expect(function() {
|
||||
env.describe('array arg', []);
|
||||
}).toThrowError('describe expects a function argument; received [object Array]');
|
||||
expect(function() {
|
||||
env.describe('object arg', {});
|
||||
}).toThrowError('describe expects a function argument; received [object Object]');
|
||||
|
||||
expect(function() {
|
||||
env.describe('fn arg', function() {});
|
||||
}).not.toThrowError('describe expects a function argument; received [object Function]');
|
||||
});
|
||||
});
|
||||
|
||||
describe('#it', function () {
|
||||
it('throws an error when it receives a non-fn argument', function() {
|
||||
expect(function() {
|
||||
env.it('undefined arg', null);
|
||||
}).toThrowError(/it expects a function argument; received \[object (Null|DOMWindow|Object)\]/);
|
||||
});
|
||||
|
||||
it('does not throw when it is not given a fn argument', function() {
|
||||
expect(function() {
|
||||
env.it('pending spec');
|
||||
}).not.toThrow();
|
||||
});
|
||||
|
||||
it('accepts an async function', function() {
|
||||
jasmine.getEnv().requireAsyncAwait();
|
||||
expect(function() {
|
||||
env.it('async', jasmine.getEnv().makeAsyncAwaitFunction());
|
||||
}).not.toThrow();
|
||||
});
|
||||
});
|
||||
|
||||
describe('#xit', function() {
|
||||
it('calls spec.pend with "Temporarily disabled with xit"', function() {
|
||||
var pendSpy = jasmine.createSpy();
|
||||
spyOn(env, 'it').and.returnValue({
|
||||
pend: pendSpy
|
||||
});
|
||||
env.xit('foo', function() {});
|
||||
expect(pendSpy).toHaveBeenCalledWith('Temporarily disabled with xit');
|
||||
});
|
||||
|
||||
it('throws an error when it receives a non-fn argument', function() {
|
||||
expect(function() {
|
||||
env.xit('undefined arg', null);
|
||||
}).toThrowError(/xit expects a function argument; received \[object (Null|DOMWindow|Object)\]/);
|
||||
});
|
||||
|
||||
it('does not throw when it is not given a fn argument', function() {
|
||||
expect(function() {
|
||||
env.xit('pending spec');
|
||||
}).not.toThrow();
|
||||
});
|
||||
|
||||
it('accepts an async function', function() {
|
||||
jasmine.getEnv().requireAsyncAwait();
|
||||
expect(function() {
|
||||
env.xit('async', jasmine.getEnv().makeAsyncAwaitFunction());
|
||||
}).not.toThrow();
|
||||
});
|
||||
});
|
||||
|
||||
describe('#fit', function () {
|
||||
it('throws an error when it receives a non-fn argument', function() {
|
||||
expect(function() {
|
||||
env.fit('undefined arg', undefined);
|
||||
}).toThrowError(/fit expects a function argument; received \[object (Undefined|DOMWindow|Object)\]/);
|
||||
});
|
||||
});
|
||||
|
||||
describe('#beforeEach', function () {
|
||||
it('throws an error when it receives a non-fn argument', function() {
|
||||
expect(function() {
|
||||
env.beforeEach(undefined);
|
||||
}).toThrowError(/beforeEach expects a function argument; received \[object (Undefined|DOMWindow|Object)\]/);
|
||||
});
|
||||
|
||||
it('accepts an async function', function() {
|
||||
jasmine.getEnv().requireAsyncAwait();
|
||||
expect(function() {
|
||||
env.beforeEach(jasmine.getEnv().makeAsyncAwaitFunction());
|
||||
}).not.toThrow();
|
||||
});
|
||||
});
|
||||
|
||||
describe('#beforeAll', function () {
|
||||
it('throws an error when it receives a non-fn argument', function() {
|
||||
expect(function() {
|
||||
env.beforeAll(undefined);
|
||||
}).toThrowError(/beforeAll expects a function argument; received \[object (Undefined|DOMWindow|Object)\]/);
|
||||
});
|
||||
|
||||
it('accepts an async function', function() {
|
||||
jasmine.getEnv().requireAsyncAwait();
|
||||
expect(function() {
|
||||
env.beforeAll(jasmine.getEnv().makeAsyncAwaitFunction());
|
||||
}).not.toThrow();
|
||||
});
|
||||
});
|
||||
|
||||
describe('#afterEach', function () {
|
||||
it('throws an error when it receives a non-fn argument', function() {
|
||||
expect(function() {
|
||||
env.afterEach(undefined);
|
||||
}).toThrowError(/afterEach expects a function argument; received \[object (Undefined|DOMWindow|Object)\]/);
|
||||
});
|
||||
|
||||
it('accepts an async function', function() {
|
||||
jasmine.getEnv().requireAsyncAwait();
|
||||
expect(function() {
|
||||
env.afterEach(jasmine.getEnv().makeAsyncAwaitFunction());
|
||||
}).not.toThrow();
|
||||
});
|
||||
});
|
||||
|
||||
describe('#afterAll', function () {
|
||||
it('throws an error when it receives a non-fn argument', function() {
|
||||
expect(function() {
|
||||
env.afterAll(undefined);
|
||||
}).toThrowError(/afterAll expects a function argument; received \[object (Undefined|DOMWindow|Object)\]/);
|
||||
});
|
||||
|
||||
it('accepts an async function', function() {
|
||||
jasmine.getEnv().requireAsyncAwait();
|
||||
expect(function() {
|
||||
env.afterAll(jasmine.getEnv().makeAsyncAwaitFunction());
|
||||
}).not.toThrow();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -7,7 +7,7 @@ describe("ExceptionFormatter", function() {
|
||||
message: 'you got your foo in my bar',
|
||||
name: 'A Classic Mistake'
|
||||
},
|
||||
exceptionFormatter = new j$.ExceptionFormatter(),
|
||||
exceptionFormatter = new jasmineUnderTest.ExceptionFormatter(),
|
||||
message = exceptionFormatter.message(sampleFirefoxException);
|
||||
|
||||
expect(message).toEqual('A Classic Mistake: you got your foo in my bar in foo.js (line 1978)');
|
||||
@@ -20,7 +20,7 @@ describe("ExceptionFormatter", function() {
|
||||
message: 'you got your foo in my bar',
|
||||
name: 'A Classic Mistake'
|
||||
},
|
||||
exceptionFormatter = new j$.ExceptionFormatter(),
|
||||
exceptionFormatter = new jasmineUnderTest.ExceptionFormatter(),
|
||||
message = exceptionFormatter.message(sampleWebkitException);
|
||||
|
||||
expect(message).toEqual('A Classic Mistake: you got your foo in my bar in foo.js (line 1978)');
|
||||
@@ -31,7 +31,7 @@ describe("ExceptionFormatter", function() {
|
||||
message: 'you got your foo in my bar',
|
||||
name: 'A Classic Mistake'
|
||||
},
|
||||
exceptionFormatter = new j$.ExceptionFormatter(),
|
||||
exceptionFormatter = new jasmineUnderTest.ExceptionFormatter(),
|
||||
message = exceptionFormatter.message(sampleV8);
|
||||
|
||||
expect(message).toEqual('A Classic Mistake: you got your foo in my bar');
|
||||
@@ -39,7 +39,7 @@ describe("ExceptionFormatter", function() {
|
||||
|
||||
it("formats thrown exceptions that aren't errors", function() {
|
||||
var thrown = "crazy error",
|
||||
exceptionFormatter = new j$.ExceptionFormatter(),
|
||||
exceptionFormatter = new jasmineUnderTest.ExceptionFormatter(),
|
||||
message = exceptionFormatter.message(thrown);
|
||||
|
||||
expect(message).toEqual("crazy error thrown");
|
||||
@@ -47,17 +47,74 @@ describe("ExceptionFormatter", function() {
|
||||
});
|
||||
|
||||
describe("#stack", function() {
|
||||
it("formats stack traces from Webkit, Firefox, node.js or IE10+", function() {
|
||||
if (jasmine.getEnv().ieVersion < 10 || jasmine.getEnv().safariVersion < 6) { return; }
|
||||
|
||||
it("formats stack traces", function() {
|
||||
var error;
|
||||
try { throw new Error("an error") } catch(e) { error = e; }
|
||||
|
||||
expect(new j$.ExceptionFormatter().stack(error)).toMatch(/ExceptionFormatterSpec\.js.*\d+/)
|
||||
expect(new jasmineUnderTest.ExceptionFormatter().stack(error)).toMatch(/ExceptionFormatterSpec\.js.*\d+/)
|
||||
});
|
||||
|
||||
it("filters Jasmine stack frames from V8 style traces", function() {
|
||||
var error = {
|
||||
stack: 'Error: nope\n' +
|
||||
' at fn1 (http://localhost:8888/__spec__/core/UtilSpec.js:115:19)\n' +
|
||||
' at fn2 (http://localhost:8888/__jasmine__/jasmine.js:4320:20)\n' +
|
||||
' at fn3 (http://localhost:8888/__jasmine__/jasmine.js:4320:20)\n' +
|
||||
' at fn4 (http://localhost:8888/__spec__/core/UtilSpec.js:110:19)\n'
|
||||
};
|
||||
var subject = new jasmineUnderTest.ExceptionFormatter({
|
||||
jasmineFile: 'http://localhost:8888/__jasmine__/jasmine.js'
|
||||
});
|
||||
var result = subject.stack(error);
|
||||
expect(result).toEqual('Error: nope\n' +
|
||||
' at fn1 (http://localhost:8888/__spec__/core/UtilSpec.js:115:19)\n' +
|
||||
' at <Jasmine>\n' +
|
||||
' at fn4 (http://localhost:8888/__spec__/core/UtilSpec.js:110:19)'
|
||||
);
|
||||
});
|
||||
|
||||
it("filters Jamine stack frames from Webkit style traces", function() {
|
||||
var error = {
|
||||
stack: 'http://localhost:8888/__spec__/core/UtilSpec.js:115:28\n' +
|
||||
'fn1@http://localhost:8888/__jasmine__/jasmine.js:4320:27\n' +
|
||||
'fn2@http://localhost:8888/__jasmine__/jasmine.js:4320:27\n' +
|
||||
'http://localhost:8888/__spec__/core/UtilSpec.js:115:28'
|
||||
};
|
||||
var subject = new jasmineUnderTest.ExceptionFormatter({
|
||||
jasmineFile: 'http://localhost:8888/__jasmine__/jasmine.js'
|
||||
});
|
||||
var result = subject.stack(error);
|
||||
expect(result).toEqual(
|
||||
'http://localhost:8888/__spec__/core/UtilSpec.js:115:28\n' +
|
||||
'<Jasmine>\n' +
|
||||
'http://localhost:8888/__spec__/core/UtilSpec.js:115:28'
|
||||
);
|
||||
});
|
||||
|
||||
it("filters Jasmine stack frames in this environment", function() {
|
||||
var error, i;
|
||||
try { throw new Error("an error"); } catch(e) { error = e; }
|
||||
var subject = new jasmineUnderTest.ExceptionFormatter({
|
||||
jasmineFile: jasmine.util.jasmineFile()
|
||||
});
|
||||
var result = subject.stack(error);
|
||||
var lines = result.split('\n');
|
||||
|
||||
if (lines[0].match(/an error/)) {
|
||||
lines.shift();
|
||||
}
|
||||
|
||||
expect(lines[0]).toMatch(/ExceptionFormatterSpec.js/);
|
||||
expect(lines[1]).toMatch(/<Jasmine>/);
|
||||
|
||||
// Node has some number of additional frames below Jasmine.
|
||||
for (i = 2; i < lines.length; i++) {
|
||||
expect(lines[i]).not.toMatch(/jasmine.js/);
|
||||
}
|
||||
});
|
||||
|
||||
it("returns null if no Error provided", function() {
|
||||
expect(new j$.ExceptionFormatter().stack()).toBeNull();
|
||||
expect(new jasmineUnderTest.ExceptionFormatter().stack()).toBeNull();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -2,67 +2,45 @@ describe('Exceptions:', function() {
|
||||
var env;
|
||||
|
||||
beforeEach(function() {
|
||||
env = new j$.Env();
|
||||
env = new jasmineUnderTest.Env();
|
||||
});
|
||||
|
||||
describe('with break on exception', function() {
|
||||
it('should not catch the exception', function() {
|
||||
env.catchExceptions(false);
|
||||
env.describe('suite for break on exceptions', function() {
|
||||
env.it('should break when an exception is thrown', function() {
|
||||
throw new Error('I should hit a breakpoint!');
|
||||
});
|
||||
it('should handle exceptions thrown, but continue', function(done) {
|
||||
var secondTest = jasmine.createSpy('second test');
|
||||
env.describe('Suite for handles exceptions', function () {
|
||||
env.it('should be a test that fails because it throws an exception', function() {
|
||||
throw new Error();
|
||||
});
|
||||
var spy = jasmine.createSpy('spy');
|
||||
|
||||
try {
|
||||
env.execute();
|
||||
spy();
|
||||
}
|
||||
catch (e) {}
|
||||
|
||||
expect(spy).not.toHaveBeenCalled();
|
||||
env.it('should be a passing test that runs after exceptions are thrown from a async test', secondTest);
|
||||
});
|
||||
|
||||
var expectations = function() {
|
||||
expect(secondTest).toHaveBeenCalled();
|
||||
done();
|
||||
};
|
||||
|
||||
env.addReporter({ jasmineDone: expectations });
|
||||
env.execute();
|
||||
});
|
||||
|
||||
describe("with catch on exception", function() {
|
||||
it('should handle exceptions thrown, but continue', function(done) {
|
||||
var secondTest = jasmine.createSpy('second test');
|
||||
env.describe('Suite for handles exceptions', function () {
|
||||
env.it('should be a test that fails because it throws an exception', function() {
|
||||
throw new Error();
|
||||
});
|
||||
env.it('should be a passing test that runs after exceptions are thrown from a async test', secondTest);
|
||||
it("should handle exceptions thrown directly in top-level describe blocks and continue", function(done) {
|
||||
var secondDescribe = jasmine.createSpy("second describe");
|
||||
env.describe("a suite that throws an exception", function () {
|
||||
env.it("is a test that should pass", function () {
|
||||
this.expect(true).toEqual(true);
|
||||
});
|
||||
|
||||
var expectations = function() {
|
||||
expect(secondTest).toHaveBeenCalled();
|
||||
done();
|
||||
};
|
||||
|
||||
env.addReporter({ jasmineDone: expectations });
|
||||
env.execute();
|
||||
throw new Error("top level error");
|
||||
});
|
||||
env.describe("a suite that doesn't throw an exception", secondDescribe);
|
||||
|
||||
it("should handle exceptions thrown directly in top-level describe blocks and continue", function(done) {
|
||||
var secondDescribe = jasmine.createSpy("second describe");
|
||||
env.describe("a suite that throws an exception", function () {
|
||||
env.it("is a test that should pass", function () {
|
||||
this.expect(true).toEqual(true);
|
||||
});
|
||||
var expectations = function() {
|
||||
expect(secondDescribe).toHaveBeenCalled();
|
||||
done();
|
||||
};
|
||||
|
||||
throw new Error("top level error");
|
||||
});
|
||||
env.describe("a suite that doesn't throw an exception", secondDescribe);
|
||||
|
||||
var expectations = function() {
|
||||
expect(secondDescribe).toHaveBeenCalled();
|
||||
done();
|
||||
};
|
||||
|
||||
env.addReporter({ jasmineDone: expectations });
|
||||
env.execute();
|
||||
});
|
||||
env.addReporter({ jasmineDone: expectations });
|
||||
env.execute();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
describe("buildExpectationResult", function() {
|
||||
it("defaults to passed", function() {
|
||||
var result = j$.buildExpectationResult({passed: 'some-value'});
|
||||
var result = jasmineUnderTest.buildExpectationResult({passed: 'some-value'});
|
||||
expect(result.passed).toBe('some-value');
|
||||
});
|
||||
|
||||
it("message defaults to Passed for passing specs", function() {
|
||||
var result = j$.buildExpectationResult({passed: true, message: 'some-value'});
|
||||
var result = jasmineUnderTest.buildExpectationResult({passed: true, message: 'some-value'});
|
||||
expect(result.message).toBe('Passed.');
|
||||
});
|
||||
|
||||
it("message returns the message for failing expectations", function() {
|
||||
var result = j$.buildExpectationResult({passed: false, message: 'some-value'});
|
||||
var result = jasmineUnderTest.buildExpectationResult({passed: false, message: 'some-value'});
|
||||
expect(result.message).toBe('some-value');
|
||||
});
|
||||
|
||||
@@ -18,7 +18,7 @@ describe("buildExpectationResult", function() {
|
||||
var fakeError = {message: 'foo'},
|
||||
messageFormatter = jasmine.createSpy("exception message formatter").and.returnValue(fakeError.message);
|
||||
|
||||
var result = j$.buildExpectationResult(
|
||||
var result = jasmineUnderTest.buildExpectationResult(
|
||||
{
|
||||
passed: false,
|
||||
error: fakeError,
|
||||
@@ -33,7 +33,7 @@ describe("buildExpectationResult", function() {
|
||||
var fakeError = {stack: 'foo'},
|
||||
stackFormatter = jasmine.createSpy("stack formatter").and.returnValue(fakeError.stack);
|
||||
|
||||
var result = j$.buildExpectationResult(
|
||||
var result = jasmineUnderTest.buildExpectationResult(
|
||||
{
|
||||
passed: false,
|
||||
error: fakeError,
|
||||
@@ -45,17 +45,17 @@ describe("buildExpectationResult", function() {
|
||||
});
|
||||
|
||||
it("matcherName returns passed matcherName", function() {
|
||||
var result = j$.buildExpectationResult({matcherName: 'some-value'});
|
||||
var result = jasmineUnderTest.buildExpectationResult({matcherName: 'some-value'});
|
||||
expect(result.matcherName).toBe('some-value');
|
||||
});
|
||||
|
||||
it("expected returns passed expected", function() {
|
||||
var result = j$.buildExpectationResult({expected: 'some-value'});
|
||||
var result = jasmineUnderTest.buildExpectationResult({expected: 'some-value'});
|
||||
expect(result.expected).toBe('some-value');
|
||||
});
|
||||
|
||||
it("actual returns passed actual", function() {
|
||||
var result = j$.buildExpectationResult({actual: 'some-value'});
|
||||
var result = jasmineUnderTest.buildExpectationResult({actual: 'some-value'});
|
||||
expect(result.actual).toBe('some-value');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
describe("Expectation", function() {
|
||||
it(".addMatchers makes matchers available to any expectation", function() {
|
||||
it("makes custom matchers available to this expectation", function() {
|
||||
var matchers = {
|
||||
toFoo: function() {},
|
||||
toBar: function() {}
|
||||
},
|
||||
expectation;
|
||||
|
||||
j$.Expectation.addMatchers(matchers);
|
||||
|
||||
expectation = new j$.Expectation({});
|
||||
expectation = new jasmineUnderTest.Expectation({
|
||||
customMatchers: matchers
|
||||
});
|
||||
|
||||
expect(expectation.toFoo).toBeDefined();
|
||||
expect(expectation.toBar).toBeDefined();
|
||||
@@ -20,37 +20,18 @@ describe("Expectation", function() {
|
||||
},
|
||||
expectation;
|
||||
|
||||
j$.Expectation.addCoreMatchers(coreMatchers);
|
||||
jasmineUnderTest.Expectation.addCoreMatchers(coreMatchers);
|
||||
|
||||
expectation = new j$.Expectation({});
|
||||
expectation = new jasmineUnderTest.Expectation({});
|
||||
|
||||
expect(expectation.toQuux).toBeDefined();
|
||||
});
|
||||
|
||||
it(".resetMatchers should keep only core matchers", function() {
|
||||
var matchers = {
|
||||
toFoo: function() {}
|
||||
},
|
||||
coreMatchers = {
|
||||
toQuux: function() {}
|
||||
},
|
||||
expectation;
|
||||
|
||||
j$.Expectation.addCoreMatchers(coreMatchers);
|
||||
j$.Expectation.addMatchers(matchers);
|
||||
j$.Expectation.resetMatchers();
|
||||
|
||||
expectation = new j$.Expectation({});
|
||||
|
||||
expect(expectation.toQuux).toBeDefined();
|
||||
expect(expectation.toFoo).toBeUndefined();
|
||||
});
|
||||
|
||||
it("Factory builds an expectation/negative expectation", function() {
|
||||
var builtExpectation = j$.Expectation.Factory();
|
||||
var builtExpectation = jasmineUnderTest.Expectation.Factory();
|
||||
|
||||
expect(builtExpectation instanceof j$.Expectation).toBe(true);
|
||||
expect(builtExpectation.not instanceof j$.Expectation).toBe(true);
|
||||
expect(builtExpectation instanceof jasmineUnderTest.Expectation).toBe(true);
|
||||
expect(builtExpectation.not instanceof jasmineUnderTest.Expectation).toBe(true);
|
||||
expect(builtExpectation.not.isNot).toBe(true);
|
||||
});
|
||||
|
||||
@@ -65,10 +46,9 @@ describe("Expectation", function() {
|
||||
addExpectationResult = jasmine.createSpy("addExpectationResult"),
|
||||
expectation;
|
||||
|
||||
j$.Expectation.addMatchers(matchers);
|
||||
|
||||
expectation = new j$.Expectation({
|
||||
expectation = new jasmineUnderTest.Expectation({
|
||||
util: util,
|
||||
customMatchers: matchers,
|
||||
customEqualityTesters: customEqualityTesters,
|
||||
actual: "an actual",
|
||||
addExpectationResult: addExpectationResult
|
||||
@@ -94,10 +74,9 @@ describe("Expectation", function() {
|
||||
addExpectationResult = jasmine.createSpy("addExpectationResult"),
|
||||
expectation;
|
||||
|
||||
j$.Expectation.addMatchers(matchers);
|
||||
|
||||
expectation = new j$.Expectation({
|
||||
expectation = new jasmineUnderTest.Expectation({
|
||||
util: util,
|
||||
customMatchers: matchers,
|
||||
actual: "an actual",
|
||||
addExpectationResult: addExpectationResult
|
||||
});
|
||||
@@ -121,10 +100,8 @@ describe("Expectation", function() {
|
||||
addExpectationResult = jasmine.createSpy("addExpectationResult"),
|
||||
expectation;
|
||||
|
||||
j$.Expectation.addMatchers(matchers);
|
||||
|
||||
expectation = new j$.Expectation({
|
||||
matchers: matchers,
|
||||
expectation = new jasmineUnderTest.Expectation({
|
||||
customMatchers: matchers,
|
||||
util: util,
|
||||
actual: "an actual",
|
||||
addExpectationResult: addExpectationResult
|
||||
@@ -136,6 +113,7 @@ describe("Expectation", function() {
|
||||
matcherName: "toFoo",
|
||||
passed: true,
|
||||
message: "",
|
||||
error: undefined,
|
||||
expected: "hello",
|
||||
actual: "an actual"
|
||||
});
|
||||
@@ -155,10 +133,8 @@ describe("Expectation", function() {
|
||||
addExpectationResult = jasmine.createSpy("addExpectationResult"),
|
||||
expectation;
|
||||
|
||||
j$.Expectation.addMatchers(matchers);
|
||||
|
||||
expectation = new j$.Expectation({
|
||||
matchers: matchers,
|
||||
expectation = new jasmineUnderTest.Expectation({
|
||||
customMatchers: matchers,
|
||||
util: util,
|
||||
actual: "an actual",
|
||||
addExpectationResult: addExpectationResult
|
||||
@@ -171,7 +147,8 @@ describe("Expectation", function() {
|
||||
passed: false,
|
||||
expected: "hello",
|
||||
actual: "an actual",
|
||||
message: ""
|
||||
message: "",
|
||||
error: undefined
|
||||
});
|
||||
});
|
||||
|
||||
@@ -191,10 +168,9 @@ describe("Expectation", function() {
|
||||
addExpectationResult = jasmine.createSpy("addExpectationResult"),
|
||||
expectation;
|
||||
|
||||
j$.Expectation.addMatchers(matchers);
|
||||
|
||||
expectation = new j$.Expectation({
|
||||
expectation = new jasmineUnderTest.Expectation({
|
||||
actual: "an actual",
|
||||
customMatchers: matchers,
|
||||
addExpectationResult: addExpectationResult
|
||||
});
|
||||
|
||||
@@ -205,7 +181,8 @@ describe("Expectation", function() {
|
||||
passed: false,
|
||||
expected: "hello",
|
||||
actual: "an actual",
|
||||
message: "I am a custom message"
|
||||
message: "I am a custom message",
|
||||
error: undefined
|
||||
});
|
||||
});
|
||||
|
||||
@@ -225,10 +202,8 @@ describe("Expectation", function() {
|
||||
addExpectationResult = jasmine.createSpy("addExpectationResult"),
|
||||
expectation;
|
||||
|
||||
j$.Expectation.addMatchers(matchers);
|
||||
|
||||
expectation = new j$.Expectation({
|
||||
matchers: matchers,
|
||||
expectation = new jasmineUnderTest.Expectation({
|
||||
customMatchers: matchers,
|
||||
actual: "an actual",
|
||||
addExpectationResult: addExpectationResult
|
||||
});
|
||||
@@ -240,7 +215,8 @@ describe("Expectation", function() {
|
||||
passed: false,
|
||||
expected: "hello",
|
||||
actual: "an actual",
|
||||
message: "I am a custom message"
|
||||
message: "I am a custom message",
|
||||
error: undefined
|
||||
});
|
||||
});
|
||||
|
||||
@@ -259,10 +235,8 @@ describe("Expectation", function() {
|
||||
actual = "an actual",
|
||||
expectation;
|
||||
|
||||
j$.Expectation.addMatchers(matchers);
|
||||
|
||||
expectation = new j$.Expectation({
|
||||
matchers: matchers,
|
||||
expectation = new jasmineUnderTest.Expectation({
|
||||
customMatchers: matchers,
|
||||
actual: "an actual",
|
||||
addExpectationResult: addExpectationResult,
|
||||
isNot: true
|
||||
@@ -274,6 +248,7 @@ describe("Expectation", function() {
|
||||
matcherName: "toFoo",
|
||||
passed: true,
|
||||
message: "",
|
||||
error: undefined,
|
||||
expected: "hello",
|
||||
actual: actual
|
||||
});
|
||||
@@ -294,10 +269,8 @@ describe("Expectation", function() {
|
||||
actual = "an actual",
|
||||
expectation;
|
||||
|
||||
j$.Expectation.addMatchers(matchers);
|
||||
|
||||
expectation = new j$.Expectation({
|
||||
matchers: matchers,
|
||||
expectation = new jasmineUnderTest.Expectation({
|
||||
customMatchers: matchers,
|
||||
actual: "an actual",
|
||||
util: util,
|
||||
addExpectationResult: addExpectationResult,
|
||||
@@ -311,7 +284,8 @@ describe("Expectation", function() {
|
||||
passed: false,
|
||||
expected: "hello",
|
||||
actual: actual,
|
||||
message: "default message"
|
||||
message: "default message",
|
||||
error: undefined
|
||||
});
|
||||
});
|
||||
|
||||
@@ -332,10 +306,8 @@ describe("Expectation", function() {
|
||||
actual = "an actual",
|
||||
expectation;
|
||||
|
||||
j$.Expectation.addMatchers(matchers);
|
||||
|
||||
expectation = new j$.Expectation({
|
||||
matchers: matchers,
|
||||
expectation = new jasmineUnderTest.Expectation({
|
||||
customMatchers: matchers,
|
||||
actual: "an actual",
|
||||
addExpectationResult: addExpectationResult,
|
||||
isNot: true
|
||||
@@ -348,7 +320,8 @@ describe("Expectation", function() {
|
||||
passed: false,
|
||||
expected: "hello",
|
||||
actual: actual,
|
||||
message: "I am a custom message"
|
||||
message: "I am a custom message",
|
||||
error: undefined
|
||||
});
|
||||
});
|
||||
|
||||
@@ -365,10 +338,8 @@ describe("Expectation", function() {
|
||||
actual = "an actual",
|
||||
expectation;
|
||||
|
||||
j$.Expectation.addMatchers(matchers);
|
||||
|
||||
expectation = new j$.Expectation({
|
||||
matchers: matchers,
|
||||
expectation = new jasmineUnderTest.Expectation({
|
||||
customMatchers: matchers,
|
||||
actual: "an actual",
|
||||
addExpectationResult: addExpectationResult,
|
||||
isNot: true
|
||||
@@ -381,7 +352,8 @@ describe("Expectation", function() {
|
||||
passed: true,
|
||||
expected: "hello",
|
||||
actual: actual,
|
||||
message: ""
|
||||
message: "",
|
||||
error: undefined
|
||||
});
|
||||
});
|
||||
|
||||
@@ -403,10 +375,8 @@ describe("Expectation", function() {
|
||||
actual = "an actual",
|
||||
expectation;
|
||||
|
||||
j$.Expectation.addMatchers(matchers);
|
||||
|
||||
expectation = new j$.Expectation({
|
||||
matchers: matchers,
|
||||
expectation = new jasmineUnderTest.Expectation({
|
||||
customMatchers: matchers,
|
||||
actual: "an actual",
|
||||
addExpectationResult: addExpectationResult,
|
||||
isNot: true
|
||||
@@ -419,7 +389,44 @@ describe("Expectation", function() {
|
||||
passed: false,
|
||||
expected: "hello",
|
||||
actual: actual,
|
||||
message: "I'm a custom message"
|
||||
message: "I'm a custom message",
|
||||
error: undefined
|
||||
});
|
||||
});
|
||||
|
||||
it("reports a custom error message to the spec", function() {
|
||||
var customError = new Error("I am a custom error");
|
||||
var matchers = {
|
||||
toFoo: function() {
|
||||
return {
|
||||
compare: function() {
|
||||
return {
|
||||
pass: false,
|
||||
message: "I am a custom message",
|
||||
error: customError
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
},
|
||||
addExpectationResult = jasmine.createSpy("addExpectationResult"),
|
||||
expectation;
|
||||
|
||||
expectation = new jasmineUnderTest.Expectation({
|
||||
actual: "an actual",
|
||||
customMatchers: matchers,
|
||||
addExpectationResult: addExpectationResult
|
||||
});
|
||||
|
||||
expectation.toFoo("hello");
|
||||
|
||||
expect(addExpectationResult).toHaveBeenCalledWith(false, {
|
||||
matcherName: "toFoo",
|
||||
passed: false,
|
||||
expected: "hello",
|
||||
actual: "an actual",
|
||||
message: "I am a custom message",
|
||||
error: customError
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
110
spec/core/GlobalErrorsSpec.js
Normal file
110
spec/core/GlobalErrorsSpec.js
Normal file
@@ -0,0 +1,110 @@
|
||||
describe("GlobalErrors", function() {
|
||||
it("calls the added handler on error", function() {
|
||||
var fakeGlobal = { onerror: null },
|
||||
handler = jasmine.createSpy('errorHandler'),
|
||||
errors = new jasmineUnderTest.GlobalErrors(fakeGlobal);
|
||||
|
||||
errors.install();
|
||||
errors.pushListener(handler);
|
||||
|
||||
fakeGlobal.onerror('foo');
|
||||
|
||||
expect(handler).toHaveBeenCalledWith('foo');
|
||||
});
|
||||
|
||||
it("only calls the most recent handler", function() {
|
||||
var fakeGlobal = { onerror: null },
|
||||
handler1 = jasmine.createSpy('errorHandler1'),
|
||||
handler2 = jasmine.createSpy('errorHandler2'),
|
||||
errors = new jasmineUnderTest.GlobalErrors(fakeGlobal);
|
||||
|
||||
errors.install();
|
||||
errors.pushListener(handler1);
|
||||
errors.pushListener(handler2);
|
||||
|
||||
fakeGlobal.onerror('foo');
|
||||
|
||||
expect(handler1).not.toHaveBeenCalled();
|
||||
expect(handler2).toHaveBeenCalledWith('foo');
|
||||
});
|
||||
|
||||
it("calls previous handlers when one is removed", function() {
|
||||
var fakeGlobal = { onerror: null },
|
||||
handler1 = jasmine.createSpy('errorHandler1'),
|
||||
handler2 = jasmine.createSpy('errorHandler2'),
|
||||
errors = new jasmineUnderTest.GlobalErrors(fakeGlobal);
|
||||
|
||||
errors.install();
|
||||
errors.pushListener(handler1);
|
||||
errors.pushListener(handler2);
|
||||
|
||||
errors.popListener();
|
||||
|
||||
fakeGlobal.onerror('foo');
|
||||
|
||||
expect(handler1).toHaveBeenCalledWith('foo');
|
||||
expect(handler2).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("uninstalls itself, putting back a previous callback", function() {
|
||||
var originalCallback = jasmine.createSpy('error'),
|
||||
fakeGlobal = { onerror: originalCallback },
|
||||
errors = new jasmineUnderTest.GlobalErrors(fakeGlobal);
|
||||
|
||||
expect(fakeGlobal.onerror).toBe(originalCallback);
|
||||
|
||||
errors.install();
|
||||
|
||||
expect(fakeGlobal.onerror).not.toBe(originalCallback);
|
||||
|
||||
errors.uninstall();
|
||||
|
||||
expect(fakeGlobal.onerror).toBe(originalCallback);
|
||||
});
|
||||
|
||||
it("rethrows the original error when there is no handler", function() {
|
||||
var fakeGlobal = { },
|
||||
errors = new jasmineUnderTest.GlobalErrors(fakeGlobal),
|
||||
originalError = new Error('nope');
|
||||
|
||||
errors.install();
|
||||
|
||||
try {
|
||||
fakeGlobal.onerror(originalError);
|
||||
} catch (e) {
|
||||
expect(e).toBe(originalError);
|
||||
}
|
||||
|
||||
errors.uninstall();
|
||||
});
|
||||
|
||||
it("works in node.js", function() {
|
||||
var fakeGlobal = {
|
||||
process: {
|
||||
on: jasmine.createSpy('process.on'),
|
||||
removeListener: jasmine.createSpy('process.removeListener'),
|
||||
listeners: jasmine.createSpy('process.listeners').and.returnValue(['foo']),
|
||||
removeAllListeners: jasmine.createSpy('process.removeAllListeners')
|
||||
}
|
||||
},
|
||||
handler = jasmine.createSpy('errorHandler'),
|
||||
errors = new jasmineUnderTest.GlobalErrors(fakeGlobal);
|
||||
|
||||
errors.install();
|
||||
expect(fakeGlobal.process.on).toHaveBeenCalledWith('uncaughtException', jasmine.any(Function));
|
||||
expect(fakeGlobal.process.listeners).toHaveBeenCalledWith('uncaughtException');
|
||||
expect(fakeGlobal.process.removeAllListeners).toHaveBeenCalledWith('uncaughtException');
|
||||
|
||||
errors.pushListener(handler);
|
||||
|
||||
var addedListener = fakeGlobal.process.on.calls.argsFor(0)[1];
|
||||
addedListener(new Error('bar'));
|
||||
|
||||
expect(handler).toHaveBeenCalledWith(new Error('bar'));
|
||||
|
||||
errors.uninstall();
|
||||
|
||||
expect(fakeGlobal.process.removeListener).toHaveBeenCalledWith('uncaughtException', addedListener);
|
||||
expect(fakeGlobal.process.on).toHaveBeenCalledWith('uncaughtException', 'foo');
|
||||
});
|
||||
});
|
||||
@@ -5,7 +5,7 @@ xdescribe('JsApiReporter (integration specs)', function() {
|
||||
var suite, nestedSuite, nestedSpec;
|
||||
|
||||
beforeEach(function() {
|
||||
env = new j$.Env();
|
||||
env = new jasmineUnderTest.Env();
|
||||
|
||||
suite = env.describe("top-level suite", function() {
|
||||
spec1 = env.it("spec 1", function() {
|
||||
@@ -25,7 +25,7 @@ xdescribe('JsApiReporter (integration specs)', function() {
|
||||
|
||||
});
|
||||
|
||||
reporter = new j$.JsApiReporter({});
|
||||
reporter = new jasmineUnderTest.JsApiReporter({});
|
||||
env.addReporter(reporter);
|
||||
|
||||
env.execute();
|
||||
@@ -82,7 +82,7 @@ xdescribe('JsApiReporter (integration specs)', function() {
|
||||
describe("JsApiReporter", function() {
|
||||
|
||||
it("knows when a full environment is started", function() {
|
||||
var reporter = new j$.JsApiReporter({});
|
||||
var reporter = new jasmineUnderTest.JsApiReporter({});
|
||||
|
||||
expect(reporter.started).toBe(false);
|
||||
expect(reporter.finished).toBe(false);
|
||||
@@ -94,7 +94,7 @@ describe("JsApiReporter", function() {
|
||||
});
|
||||
|
||||
it("knows when a full environment is done", function() {
|
||||
var reporter = new j$.JsApiReporter({});
|
||||
var reporter = new jasmineUnderTest.JsApiReporter({});
|
||||
|
||||
expect(reporter.started).toBe(false);
|
||||
expect(reporter.finished).toBe(false);
|
||||
@@ -106,13 +106,13 @@ describe("JsApiReporter", function() {
|
||||
});
|
||||
|
||||
it("defaults to 'loaded' status", function() {
|
||||
var reporter = new j$.JsApiReporter({});
|
||||
var reporter = new jasmineUnderTest.JsApiReporter({});
|
||||
|
||||
expect(reporter.status()).toEqual('loaded');
|
||||
});
|
||||
|
||||
it("reports 'started' when Jasmine has started", function() {
|
||||
var reporter = new j$.JsApiReporter({});
|
||||
var reporter = new jasmineUnderTest.JsApiReporter({});
|
||||
|
||||
reporter.jasmineStarted();
|
||||
|
||||
@@ -120,7 +120,7 @@ describe("JsApiReporter", function() {
|
||||
});
|
||||
|
||||
it("reports 'done' when Jasmine is done", function() {
|
||||
var reporter = new j$.JsApiReporter({});
|
||||
var reporter = new jasmineUnderTest.JsApiReporter({});
|
||||
|
||||
reporter.jasmineDone({});
|
||||
|
||||
@@ -128,7 +128,7 @@ describe("JsApiReporter", function() {
|
||||
});
|
||||
|
||||
it("tracks a suite", function() {
|
||||
var reporter = new j$.JsApiReporter({});
|
||||
var reporter = new jasmineUnderTest.JsApiReporter({});
|
||||
|
||||
reporter.suiteStarted({
|
||||
id: 123,
|
||||
@@ -151,7 +151,7 @@ describe("JsApiReporter", function() {
|
||||
describe("#specResults", function() {
|
||||
var reporter, specResult1, specResult2;
|
||||
beforeEach(function() {
|
||||
reporter = new j$.JsApiReporter({});
|
||||
reporter = new jasmineUnderTest.JsApiReporter({});
|
||||
specResult1 = {
|
||||
id: 1,
|
||||
description: "A spec"
|
||||
@@ -178,10 +178,47 @@ describe("JsApiReporter", function() {
|
||||
});
|
||||
});
|
||||
|
||||
describe("#suiteResults", function(){
|
||||
var reporter, suiteResult1, suiteResult2;
|
||||
beforeEach(function() {
|
||||
reporter = new jasmineUnderTest.JsApiReporter({});
|
||||
suiteStarted1 = {
|
||||
id: 1
|
||||
};
|
||||
suiteResult1 = {
|
||||
id: 1,
|
||||
status: 'failed',
|
||||
failedExpectations: [{ message: 'My After All Exception' }]
|
||||
};
|
||||
suiteResult2 = {
|
||||
id: 2,
|
||||
status: 'passed'
|
||||
};
|
||||
|
||||
reporter.suiteStarted(suiteStarted1);
|
||||
reporter.suiteDone(suiteResult1);
|
||||
reporter.suiteDone(suiteResult2);
|
||||
});
|
||||
|
||||
it('should not include suite starts', function(){
|
||||
expect(reporter.suiteResults(0,3).length).toEqual(2);
|
||||
});
|
||||
|
||||
it("should return a slice of results", function() {
|
||||
expect(reporter.suiteResults(0, 1)).toEqual([suiteResult1]);
|
||||
expect(reporter.suiteResults(1, 1)).toEqual([suiteResult2]);
|
||||
});
|
||||
|
||||
it("returns nothing for out of bounds indicies", function() {
|
||||
expect(reporter.suiteResults(0, 3)).toEqual([suiteResult1, suiteResult2]);
|
||||
expect(reporter.suiteResults(2, 3)).toEqual([]);
|
||||
});
|
||||
});
|
||||
|
||||
describe("#executionTime", function() {
|
||||
it("should start the timer when jasmine starts", function() {
|
||||
var timerSpy = jasmine.createSpyObj('timer', ['start', 'elapsed']),
|
||||
reporter = new j$.JsApiReporter({
|
||||
reporter = new jasmineUnderTest.JsApiReporter({
|
||||
timer: timerSpy
|
||||
});
|
||||
|
||||
@@ -191,7 +228,7 @@ describe("JsApiReporter", function() {
|
||||
|
||||
it("should return the time it took the specs to run, in ms", function() {
|
||||
var timerSpy = jasmine.createSpyObj('timer', ['start', 'elapsed']),
|
||||
reporter = new j$.JsApiReporter({
|
||||
reporter = new jasmineUnderTest.JsApiReporter({
|
||||
timer: timerSpy
|
||||
});
|
||||
|
||||
@@ -203,7 +240,7 @@ describe("JsApiReporter", function() {
|
||||
describe("when the specs haven't finished being run", function() {
|
||||
it("should return undefined", function() {
|
||||
var timerSpy = jasmine.createSpyObj('timer', ['start', 'elapsed']),
|
||||
reporter = new j$.JsApiReporter({
|
||||
reporter = new jasmineUnderTest.JsApiReporter({
|
||||
timer: timerSpy
|
||||
});
|
||||
|
||||
@@ -211,4 +248,12 @@ describe("JsApiReporter", function() {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('#runDetails', function() {
|
||||
it('should have details about the run', function() {
|
||||
var reporter = new jasmineUnderTest.JsApiReporter({});
|
||||
reporter.jasmineDone({some: {run: 'details'}});
|
||||
expect(reporter.runDetails).toEqual({some: {run: 'details'}});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
describe("FakeDate", function() {
|
||||
it("does not fail if no global date is found", function() {
|
||||
var fakeGlobal = {},
|
||||
mockDate = new j$.MockDate(fakeGlobal);
|
||||
mockDate = new jasmineUnderTest.MockDate(fakeGlobal);
|
||||
|
||||
expect(function() {
|
||||
mockDate.install();
|
||||
@@ -17,7 +17,7 @@ describe("FakeDate", function() {
|
||||
}
|
||||
}),
|
||||
fakeGlobal = { Date: globalDate },
|
||||
mockDate = new j$.MockDate(fakeGlobal);
|
||||
mockDate = new jasmineUnderTest.MockDate(fakeGlobal);
|
||||
|
||||
expect(fakeGlobal.Date).toEqual(globalDate);
|
||||
mockDate.install();
|
||||
@@ -32,7 +32,7 @@ describe("FakeDate", function() {
|
||||
}
|
||||
}),
|
||||
fakeGlobal = { Date: globalDate },
|
||||
mockDate = new j$.MockDate(fakeGlobal);
|
||||
mockDate = new jasmineUnderTest.MockDate(fakeGlobal);
|
||||
|
||||
mockDate.install();
|
||||
mockDate.uninstall();
|
||||
@@ -49,7 +49,7 @@ describe("FakeDate", function() {
|
||||
}
|
||||
}),
|
||||
fakeGlobal = { Date: globalDate },
|
||||
mockDate = new j$.MockDate(fakeGlobal);
|
||||
mockDate = new jasmineUnderTest.MockDate(fakeGlobal);
|
||||
|
||||
mockDate.install();
|
||||
|
||||
@@ -60,7 +60,7 @@ describe("FakeDate", function() {
|
||||
|
||||
it("can accept a date as time base when installing", function() {
|
||||
var fakeGlobal = { Date: Date },
|
||||
mockDate = new j$.MockDate(fakeGlobal),
|
||||
mockDate = new jasmineUnderTest.MockDate(fakeGlobal),
|
||||
baseDate = new Date();
|
||||
|
||||
spyOn(baseDate, 'getTime').and.returnValue(123);
|
||||
@@ -71,10 +71,11 @@ describe("FakeDate", function() {
|
||||
|
||||
it("makes real dates", function() {
|
||||
var fakeGlobal = { Date: Date },
|
||||
mockDate = new j$.MockDate(fakeGlobal);
|
||||
mockDate = new jasmineUnderTest.MockDate(fakeGlobal);
|
||||
|
||||
mockDate.install();
|
||||
expect(new fakeGlobal.Date()).toEqual(jasmine.any(Date));
|
||||
expect(new fakeGlobal.Date() instanceof fakeGlobal.Date).toBe(true);
|
||||
});
|
||||
|
||||
it("fakes current time when using Date.now()", function() {
|
||||
@@ -88,7 +89,7 @@ describe("FakeDate", function() {
|
||||
fakeGlobal = { Date: globalDate };
|
||||
|
||||
globalDate.now = function() {};
|
||||
var mockDate = new j$.MockDate(fakeGlobal);
|
||||
var mockDate = new jasmineUnderTest.MockDate(fakeGlobal);
|
||||
|
||||
mockDate.install();
|
||||
|
||||
@@ -104,7 +105,7 @@ describe("FakeDate", function() {
|
||||
}
|
||||
}),
|
||||
fakeGlobal = { Date: globalDate },
|
||||
mockDate = new j$.MockDate(fakeGlobal);
|
||||
mockDate = new jasmineUnderTest.MockDate(fakeGlobal);
|
||||
|
||||
mockDate.install();
|
||||
|
||||
@@ -122,7 +123,7 @@ describe("FakeDate", function() {
|
||||
fakeGlobal = { Date: globalDate };
|
||||
|
||||
globalDate.now = function() {};
|
||||
var mockDate = new j$.MockDate(fakeGlobal);
|
||||
var mockDate = new jasmineUnderTest.MockDate(fakeGlobal);
|
||||
|
||||
mockDate.install();
|
||||
|
||||
@@ -146,7 +147,7 @@ describe("FakeDate", function() {
|
||||
fakeGlobal = { Date: globalDate };
|
||||
|
||||
globalDate.now = function() {};
|
||||
var mockDate = new j$.MockDate(fakeGlobal);
|
||||
var mockDate = new jasmineUnderTest.MockDate(fakeGlobal);
|
||||
|
||||
mockDate.install();
|
||||
|
||||
@@ -159,7 +160,7 @@ describe("FakeDate", function() {
|
||||
|
||||
it("allows creation of a Date in a different time than the mocked time", function() {
|
||||
var fakeGlobal = { Date: Date },
|
||||
mockDate = new j$.MockDate(fakeGlobal);
|
||||
mockDate = new jasmineUnderTest.MockDate(fakeGlobal);
|
||||
|
||||
mockDate.install();
|
||||
|
||||
@@ -169,7 +170,7 @@ describe("FakeDate", function() {
|
||||
|
||||
it("allows creation of a Date that isn't fully specified", function() {
|
||||
var fakeGlobal = { Date: Date },
|
||||
mockDate = new j$.MockDate(fakeGlobal);
|
||||
mockDate = new jasmineUnderTest.MockDate(fakeGlobal);
|
||||
|
||||
mockDate.install();
|
||||
|
||||
@@ -179,7 +180,7 @@ describe("FakeDate", function() {
|
||||
|
||||
it('allows creation of a Date with millis', function() {
|
||||
var fakeGlobal = { Date: Date },
|
||||
mockDate = new j$.MockDate(fakeGlobal),
|
||||
mockDate = new jasmineUnderTest.MockDate(fakeGlobal),
|
||||
now = new Date(2014, 3, 15).getTime();
|
||||
|
||||
mockDate.install();
|
||||
@@ -190,7 +191,7 @@ describe("FakeDate", function() {
|
||||
|
||||
it("copies all Date properties to the mocked date", function() {
|
||||
var fakeGlobal = { Date: Date },
|
||||
mockDate = new j$.MockDate(fakeGlobal);
|
||||
mockDate = new jasmineUnderTest.MockDate(fakeGlobal);
|
||||
|
||||
mockDate.install();
|
||||
|
||||
|
||||
@@ -1,70 +0,0 @@
|
||||
describe("ObjectContaining", function() {
|
||||
|
||||
it("matches any actual to an empty object", function() {
|
||||
var containing = new j$.ObjectContaining({});
|
||||
|
||||
expect(containing.jasmineMatches("foo")).toBe(true);
|
||||
});
|
||||
|
||||
it("does not match an empty object actual", function() {
|
||||
var containing = new j$.ObjectContaining("foo");
|
||||
|
||||
expect(function() {
|
||||
containing.jasmineMatches({})
|
||||
}).toThrowError(/not 'foo'/)
|
||||
});
|
||||
|
||||
it("matches when the key/value pair is present in the actual", function() {
|
||||
var containing = new j$.ObjectContaining({foo: "fooVal"});
|
||||
|
||||
expect(containing.jasmineMatches({foo: "fooVal", bar: "barVal"})).toBe(true);
|
||||
});
|
||||
|
||||
it("does not match when the key/value pair is not present in the actual", function() {
|
||||
var containing = new j$.ObjectContaining({foo: "fooVal"});
|
||||
|
||||
expect(containing.jasmineMatches({bar: "barVal", quux: "quuxVal"})).toBe(false);
|
||||
});
|
||||
|
||||
it("does not match when the key is present but the value is different in the actual", function() {
|
||||
var containing = new j$.ObjectContaining({foo: "other"});
|
||||
|
||||
expect(containing.jasmineMatches({foo: "fooVal", bar: "barVal"})).toBe(false);
|
||||
});
|
||||
|
||||
it("mismatchValues parameter must return array with mismatched reason", function() {
|
||||
var containing = new j$.ObjectContaining({foo: "other"});
|
||||
|
||||
var mismatchKeys = [];
|
||||
var mismatchValues = [];
|
||||
|
||||
containing.jasmineMatches({foo: "fooVal", bar: "barVal"}, mismatchKeys, mismatchValues);
|
||||
|
||||
expect(mismatchValues.length).toBe(1);
|
||||
expect(mismatchValues[0]).toEqual("'foo' was 'fooVal' in actual, but was 'other' in expected.");
|
||||
});
|
||||
|
||||
it("adds keys in expected but not actual to the mismatchKeys parameter", function() {
|
||||
var containing = new j$.ObjectContaining({foo: "fooVal"});
|
||||
|
||||
var mismatchKeys = [];
|
||||
var mismatchValues = [];
|
||||
|
||||
containing.jasmineMatches({bar: "barVal"}, mismatchKeys, mismatchValues);
|
||||
|
||||
expect(mismatchKeys.length).toBe(1);
|
||||
expect(mismatchKeys[0]).toEqual("expected has key 'foo', but missing from actual.");
|
||||
});
|
||||
|
||||
it("jasmineToString's itself", function() {
|
||||
var containing = new j$.ObjectContaining({});
|
||||
|
||||
expect(containing.jasmineToString()).toMatch("<jasmine.objectContaining");
|
||||
});
|
||||
|
||||
it("matches recursively", function() {
|
||||
var containing = new j$.ObjectContaining({one: new j$.ObjectContaining({two: {}})});
|
||||
|
||||
expect(containing.jasmineMatches({one: {two: {}}})).toBe(true);
|
||||
});
|
||||
});
|
||||
@@ -1,65 +1,216 @@
|
||||
describe("j$.pp", function () {
|
||||
describe("jasmineUnderTest.pp", function () {
|
||||
it("should wrap strings in single quotes", function() {
|
||||
expect(j$.pp("some string")).toEqual("'some string'");
|
||||
expect(j$.pp("som' string")).toEqual("'som' string'");
|
||||
expect(jasmineUnderTest.pp("some string")).toEqual("'some string'");
|
||||
expect(jasmineUnderTest.pp("som' string")).toEqual("'som' string'");
|
||||
});
|
||||
|
||||
it("should stringify primitives properly", function() {
|
||||
expect(j$.pp(true)).toEqual("true");
|
||||
expect(j$.pp(false)).toEqual("false");
|
||||
expect(j$.pp(null)).toEqual("null");
|
||||
expect(j$.pp(jasmine.undefined)).toEqual("undefined");
|
||||
expect(j$.pp(3)).toEqual("3");
|
||||
expect(j$.pp(-3.14)).toEqual("-3.14");
|
||||
expect(j$.pp(-0)).toEqual("-0");
|
||||
expect(jasmineUnderTest.pp(true)).toEqual("true");
|
||||
expect(jasmineUnderTest.pp(false)).toEqual("false");
|
||||
expect(jasmineUnderTest.pp(null)).toEqual("null");
|
||||
expect(jasmineUnderTest.pp(jasmine.undefined)).toEqual("undefined");
|
||||
expect(jasmineUnderTest.pp(3)).toEqual("3");
|
||||
expect(jasmineUnderTest.pp(-3.14)).toEqual("-3.14");
|
||||
expect(jasmineUnderTest.pp(-0)).toEqual("-0");
|
||||
});
|
||||
|
||||
it("should stringify arrays properly", function() {
|
||||
expect(j$.pp([1, 2])).toEqual("[ 1, 2 ]");
|
||||
expect(j$.pp([1, 'foo', {}, jasmine.undefined, null])).toEqual("[ 1, 'foo', { }, undefined, null ]");
|
||||
describe('stringify sets', function() {
|
||||
it("should stringify sets properly", function() {
|
||||
jasmine.getEnv().requireFunctioningSets();
|
||||
var set = new Set();
|
||||
set.add(1);
|
||||
set.add(2);
|
||||
expect(jasmineUnderTest.pp(set)).toEqual("Set( 1, 2 )");
|
||||
});
|
||||
|
||||
it("should truncate sets with more elments than jasmineUnderTest.MAX_PRETTY_PRINT_ARRAY_LENGTH", function() {
|
||||
jasmine.getEnv().requireFunctioningSets();
|
||||
var originalMaxSize = jasmineUnderTest.MAX_PRETTY_PRINT_ARRAY_LENGTH;
|
||||
|
||||
try {
|
||||
jasmineUnderTest.MAX_PRETTY_PRINT_ARRAY_LENGTH = 2;
|
||||
var set = new Set();
|
||||
set.add('a');
|
||||
set.add('b');
|
||||
set.add('c');
|
||||
expect(jasmineUnderTest.pp(set)).toEqual("Set( 'a', 'b', ... )");
|
||||
} finally {
|
||||
jasmineUnderTest.MAX_PRETTY_PRINT_ARRAY_LENGTH = originalMaxSize;
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
it("should indicate circular array references", function() {
|
||||
var array1 = [1, 2];
|
||||
var array2 = [array1];
|
||||
array1.push(array2);
|
||||
expect(j$.pp(array1)).toEqual("[ 1, 2, [ <circular reference: Array> ] ]");
|
||||
describe('stringify maps', function() {
|
||||
it("should stringify maps properly", function() {
|
||||
jasmine.getEnv().requireFunctioningMaps();
|
||||
var map = new Map();
|
||||
map.set(1,2);
|
||||
expect(jasmineUnderTest.pp(map)).toEqual("Map( [ 1, 2 ] )");
|
||||
});
|
||||
|
||||
it("should truncate maps with more elments than jasmineUnderTest.MAX_PRETTY_PRINT_ARRAY_LENGTH", function() {
|
||||
jasmine.getEnv().requireFunctioningMaps();
|
||||
var originalMaxSize = jasmineUnderTest.MAX_PRETTY_PRINT_ARRAY_LENGTH;
|
||||
|
||||
try {
|
||||
jasmineUnderTest.MAX_PRETTY_PRINT_ARRAY_LENGTH = 2;
|
||||
var map = new Map();
|
||||
map.set("a",1);
|
||||
map.set("b",2);
|
||||
map.set("c",3);
|
||||
expect(jasmineUnderTest.pp(map)).toEqual("Map( [ 'a', 1 ], [ 'b', 2 ], ... )");
|
||||
} finally {
|
||||
jasmineUnderTest.MAX_PRETTY_PRINT_ARRAY_LENGTH = originalMaxSize;
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
describe('stringify arrays', function() {
|
||||
it("should stringify arrays properly", function() {
|
||||
expect(jasmineUnderTest.pp([1, 2])).toEqual("[ 1, 2 ]");
|
||||
expect(jasmineUnderTest.pp([1, 'foo', {}, jasmine.undefined, null])).toEqual("[ 1, 'foo', Object({ }), undefined, null ]");
|
||||
});
|
||||
|
||||
it("should truncate arrays that are longer than jasmineUnderTest.MAX_PRETTY_PRINT_ARRAY_LENGTH", function() {
|
||||
var originalMaxLength = jasmineUnderTest.MAX_PRETTY_PRINT_ARRAY_LENGTH;
|
||||
var array = [1, 2, 3];
|
||||
|
||||
try {
|
||||
jasmineUnderTest.MAX_PRETTY_PRINT_ARRAY_LENGTH = 2;
|
||||
expect(jasmineUnderTest.pp(array)).toEqual("[ 1, 2, ... ]");
|
||||
} finally {
|
||||
jasmineUnderTest.MAX_PRETTY_PRINT_ARRAY_LENGTH = originalMaxLength;
|
||||
}
|
||||
});
|
||||
|
||||
it("should stringify arrays with properties properly", function() {
|
||||
var arr = [1, 2];
|
||||
arr.foo = 'bar';
|
||||
arr.baz = {};
|
||||
expect(jasmineUnderTest.pp(arr)).toEqual("[ 1, 2, foo: 'bar', baz: Object({ }) ]");
|
||||
});
|
||||
|
||||
it("should stringify empty arrays with properties properly", function() {
|
||||
var empty = [];
|
||||
empty.foo = 'bar';
|
||||
empty.baz = {};
|
||||
expect(jasmineUnderTest.pp(empty)).toEqual("[ foo: 'bar', baz: Object({ }) ]");
|
||||
});
|
||||
|
||||
it("should stringify long arrays with properties properly", function() {
|
||||
var originalMaxLength = jasmineUnderTest.MAX_PRETTY_PRINT_ARRAY_LENGTH;
|
||||
var long = [1,2,3];
|
||||
long.foo = 'bar';
|
||||
long.baz = {};
|
||||
|
||||
try {
|
||||
jasmineUnderTest.MAX_PRETTY_PRINT_ARRAY_LENGTH = 2;
|
||||
expect(jasmineUnderTest.pp(long)).toEqual("[ 1, 2, ..., foo: 'bar', baz: Object({ }) ]");
|
||||
} finally {
|
||||
jasmineUnderTest.MAX_PRETTY_PRINT_ARRAY_LENGTH = originalMaxLength;
|
||||
}
|
||||
});
|
||||
|
||||
it("should indicate circular array references", function() {
|
||||
var array1 = [1, 2];
|
||||
var array2 = [array1];
|
||||
array1.push(array2);
|
||||
expect(jasmineUnderTest.pp(array1)).toEqual("[ 1, 2, [ <circular reference: Array> ] ]");
|
||||
});
|
||||
|
||||
it("should not indicate circular references incorrectly", function() {
|
||||
var array = [ [1] ];
|
||||
expect(jasmineUnderTest.pp(array)).toEqual("[ [ 1 ] ]");
|
||||
});
|
||||
});
|
||||
|
||||
it("should stringify objects properly", function() {
|
||||
expect(j$.pp({foo: 'bar'})).toEqual("{ foo: 'bar' }");
|
||||
expect(j$.pp({foo:'bar', baz:3, nullValue: null, undefinedValue: jasmine.undefined})).toEqual("{ foo: 'bar', baz: 3, nullValue: null, undefinedValue: undefined }");
|
||||
expect(j$.pp({foo: function () {
|
||||
}, bar: [1, 2, 3]})).toEqual("{ foo: Function, bar: [ 1, 2, 3 ] }");
|
||||
expect(jasmineUnderTest.pp({foo: 'bar'})).toEqual("Object({ foo: 'bar' })");
|
||||
expect(jasmineUnderTest.pp({foo:'bar', baz:3, nullValue: null, undefinedValue: jasmine.undefined})).toEqual("Object({ foo: 'bar', baz: 3, nullValue: null, undefinedValue: undefined })");
|
||||
expect(jasmineUnderTest.pp({foo: function () {
|
||||
}, bar: [1, 2, 3]})).toEqual("Object({ foo: Function, bar: [ 1, 2, 3 ] })");
|
||||
});
|
||||
|
||||
it("should truncate objects with too many keys", function () {
|
||||
var originalMaxLength = jasmineUnderTest.MAX_PRETTY_PRINT_ARRAY_LENGTH;
|
||||
var long = {a: 1, b: 2, c: 3};
|
||||
|
||||
try {
|
||||
jasmineUnderTest.MAX_PRETTY_PRINT_ARRAY_LENGTH = 2;
|
||||
expect(jasmineUnderTest.pp(long)).toEqual("Object({ a: 1, b: 2, ... })");
|
||||
} finally {
|
||||
jasmineUnderTest.MAX_PRETTY_PRINT_ARRAY_LENGTH = originalMaxLength;
|
||||
}
|
||||
});
|
||||
|
||||
function withMaxChars(maxChars, fn) {
|
||||
var originalMaxChars = jasmineUnderTest.MAX_PRETTY_PRINT_CHARS;
|
||||
|
||||
try {
|
||||
jasmineUnderTest.MAX_PRETTY_PRINT_CHARS = maxChars;
|
||||
fn();
|
||||
} finally {
|
||||
jasmineUnderTest.MAX_PRETTY_PRINT_CHARS = originalMaxChars;
|
||||
}
|
||||
}
|
||||
|
||||
it("should truncate outputs that are too long", function() {
|
||||
var big = [
|
||||
{ a: 1, b: "a long string" },
|
||||
{}
|
||||
];
|
||||
|
||||
withMaxChars(34, function() {
|
||||
expect(jasmineUnderTest.pp(big)).toEqual("[ Object({ a: 1, b: 'a long st ...");
|
||||
});
|
||||
});
|
||||
|
||||
it("should not serialize more objects after hitting MAX_PRETTY_PRINT_CHARS", function() {
|
||||
var a = { jasmineToString: function() { return 'object a'; } },
|
||||
b = { jasmineToString: function() { return 'object b'; } },
|
||||
c = { jasmineToString: jasmine.createSpy('c jasmineToString').and.returnValue('') },
|
||||
d = { jasmineToString: jasmine.createSpy('d jasmineToString').and.returnValue('') };
|
||||
|
||||
withMaxChars(30, function() {
|
||||
jasmineUnderTest.pp([{a: a, b: b, c: c}, d]);
|
||||
expect(c.jasmineToString).not.toHaveBeenCalled();
|
||||
expect(d.jasmineToString).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
it("should print 'null' as the constructor of an object with its own constructor property", function() {
|
||||
expect(jasmineUnderTest.pp({constructor: function() {}})).toContain("null({");
|
||||
expect(jasmineUnderTest.pp({constructor: 'foo'})).toContain("null({");
|
||||
});
|
||||
|
||||
it("should not include inherited properties when stringifying an object", function() {
|
||||
var SomeClass = function() {};
|
||||
var SomeClass = function SomeClass() {};
|
||||
SomeClass.prototype.foo = "inherited foo";
|
||||
var instance = new SomeClass();
|
||||
instance.bar = "my own bar";
|
||||
expect(j$.pp(instance)).toEqual("{ bar: 'my own bar' }");
|
||||
expect(jasmineUnderTest.pp(instance)).toEqual("SomeClass({ bar: 'my own bar' })");
|
||||
});
|
||||
|
||||
it("should not recurse objects and arrays more deeply than j$.MAX_PRETTY_PRINT_DEPTH", function() {
|
||||
var originalMaxDepth = j$.MAX_PRETTY_PRINT_DEPTH;
|
||||
it("should not recurse objects and arrays more deeply than jasmineUnderTest.MAX_PRETTY_PRINT_DEPTH", function() {
|
||||
var originalMaxDepth = jasmineUnderTest.MAX_PRETTY_PRINT_DEPTH;
|
||||
var nestedObject = { level1: { level2: { level3: { level4: "leaf" } } } };
|
||||
var nestedArray = [1, [2, [3, [4, "leaf"]]]];
|
||||
|
||||
try {
|
||||
j$.MAX_PRETTY_PRINT_DEPTH = 2;
|
||||
expect(j$.pp(nestedObject)).toEqual("{ level1: { level2: Object } }");
|
||||
expect(j$.pp(nestedArray)).toEqual("[ 1, [ 2, Array ] ]");
|
||||
jasmineUnderTest.MAX_PRETTY_PRINT_DEPTH = 2;
|
||||
expect(jasmineUnderTest.pp(nestedObject)).toEqual("Object({ level1: Object({ level2: Object }) })");
|
||||
expect(jasmineUnderTest.pp(nestedArray)).toEqual("[ 1, [ 2, Array ] ]");
|
||||
|
||||
j$.MAX_PRETTY_PRINT_DEPTH = 3;
|
||||
expect(j$.pp(nestedObject)).toEqual("{ level1: { level2: { level3: Object } } }");
|
||||
expect(j$.pp(nestedArray)).toEqual("[ 1, [ 2, [ 3, Array ] ] ]");
|
||||
jasmineUnderTest.MAX_PRETTY_PRINT_DEPTH = 3;
|
||||
expect(jasmineUnderTest.pp(nestedObject)).toEqual("Object({ level1: Object({ level2: Object({ level3: Object }) }) })");
|
||||
expect(jasmineUnderTest.pp(nestedArray)).toEqual("[ 1, [ 2, [ 3, Array ] ] ]");
|
||||
|
||||
j$.MAX_PRETTY_PRINT_DEPTH = 4;
|
||||
expect(j$.pp(nestedObject)).toEqual("{ level1: { level2: { level3: { level4: 'leaf' } } } }");
|
||||
expect(j$.pp(nestedArray)).toEqual("[ 1, [ 2, [ 3, [ 4, 'leaf' ] ] ] ]");
|
||||
jasmineUnderTest.MAX_PRETTY_PRINT_DEPTH = 4;
|
||||
expect(jasmineUnderTest.pp(nestedObject)).toEqual("Object({ level1: Object({ level2: Object({ level3: Object({ level4: 'leaf' }) }) }) })");
|
||||
expect(jasmineUnderTest.pp(nestedArray)).toEqual("[ 1, [ 2, [ 3, [ 4, 'leaf' ] ] ] ]");
|
||||
} finally {
|
||||
j$.MAX_PRETTY_PRINT_DEPTH = originalMaxDepth;
|
||||
jasmineUnderTest.MAX_PRETTY_PRINT_DEPTH = originalMaxDepth;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -68,30 +219,18 @@ describe("j$.pp", function () {
|
||||
var frozenObject = {foo: {bar: 'baz'}};
|
||||
frozenObject.circular = frozenObject;
|
||||
frozenObject = Object.freeze(frozenObject);
|
||||
expect(j$.pp(frozenObject)).toEqual("{ foo: { bar: 'baz' }, circular: <circular reference: Object> }");
|
||||
}
|
||||
});
|
||||
|
||||
it("should truncate arrays that are longer than j$.MAX_PRETTY_PRINT_ARRAY_LENGTH", function() {
|
||||
var originalMaxLength = j$.MAX_PRETTY_PRINT_ARRAY_LENGTH;
|
||||
var array = [1, 2, 3];
|
||||
|
||||
try {
|
||||
j$.MAX_PRETTY_PRINT_ARRAY_LENGTH = 2;
|
||||
expect(j$.pp(array)).toEqual("[ 1, 2, ... ]");
|
||||
} finally {
|
||||
j$.MAX_PRETTY_PRINT_ARRAY_LENGTH = originalMaxLength;
|
||||
expect(jasmineUnderTest.pp(frozenObject)).toEqual("Object({ foo: Object({ bar: 'baz' }), circular: <circular reference: Object> })");
|
||||
}
|
||||
});
|
||||
|
||||
it("should stringify RegExp objects properly", function() {
|
||||
expect(j$.pp(/x|y|z/)).toEqual("/x|y|z/");
|
||||
expect(jasmineUnderTest.pp(/x|y|z/)).toEqual("/x|y|z/");
|
||||
});
|
||||
|
||||
it("should indicate circular object references", function() {
|
||||
var sampleValue = {foo: 'hello'};
|
||||
sampleValue.nested = sampleValue;
|
||||
expect(j$.pp(sampleValue)).toEqual("{ foo: 'hello', nested: <circular reference: Object> }");
|
||||
expect(jasmineUnderTest.pp(sampleValue)).toEqual("Object({ foo: 'hello', nested: <circular reference: Object> })");
|
||||
});
|
||||
|
||||
it("should indicate getters on objects as such", function() {
|
||||
@@ -103,37 +242,43 @@ describe("j$.pp", function () {
|
||||
});
|
||||
}
|
||||
if (sampleValue.__defineGetter__) {
|
||||
expect(j$.pp(sampleValue)).toEqual("{ id: 1, calculatedValue: <getter> }");
|
||||
expect(jasmineUnderTest.pp(sampleValue)).toEqual("Object({ id: 1, calculatedValue: <getter> })");
|
||||
}
|
||||
else {
|
||||
expect(j$.pp(sampleValue)).toEqual("{ id: 1 }");
|
||||
expect(jasmineUnderTest.pp(sampleValue)).toEqual("Object({ id: 1 })");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
it('should not do HTML escaping of strings', function() {
|
||||
expect(j$.pp('some <b>html string</b> &', false)).toEqual('\'some <b>html string</b> &\'');
|
||||
expect(jasmineUnderTest.pp('some <b>html string</b> &', false)).toEqual('\'some <b>html string</b> &\'');
|
||||
});
|
||||
|
||||
it("should abbreviate the global (usually window) object", function() {
|
||||
expect(j$.pp(jasmine.getGlobal())).toEqual("<global>");
|
||||
expect(jasmineUnderTest.pp(jasmine.getGlobal())).toEqual("<global>");
|
||||
});
|
||||
|
||||
it("should stringify Date objects properly", function() {
|
||||
var now = new Date();
|
||||
expect(j$.pp(now)).toEqual("Date(" + now.toString() + ")");
|
||||
expect(jasmineUnderTest.pp(now)).toEqual("Date(" + now.toString() + ")");
|
||||
});
|
||||
|
||||
it("should stringify spy objects properly", function() {
|
||||
var TestObject = {
|
||||
someFunction: function() {}
|
||||
},
|
||||
env = new j$.Env();
|
||||
someFunction: function() {}
|
||||
},
|
||||
env = new jasmineUnderTest.Env();
|
||||
|
||||
env.spyOn(TestObject, 'someFunction');
|
||||
expect(j$.pp(TestObject.someFunction)).toEqual("spy on someFunction");
|
||||
var spyRegistry = new jasmineUnderTest.SpyRegistry({
|
||||
currentSpies: function() {return [];},
|
||||
createSpy: function(name, originalFn) {
|
||||
return jasmineUnderTest.Spy(name, originalFn);
|
||||
}
|
||||
});
|
||||
|
||||
expect(j$.pp(j$.createSpy("something"))).toEqual("spy on something");
|
||||
spyRegistry.spyOn(TestObject, 'someFunction');
|
||||
expect(jasmineUnderTest.pp(TestObject.someFunction)).toEqual("spy on someFunction");
|
||||
|
||||
expect(jasmineUnderTest.pp(env.createSpy("something"))).toEqual("spy on something");
|
||||
});
|
||||
|
||||
it("should stringify objects that implement jasmineToString", function () {
|
||||
@@ -141,16 +286,47 @@ describe("j$.pp", function () {
|
||||
jasmineToString: function () { return "strung"; }
|
||||
};
|
||||
|
||||
expect(j$.pp(obj)).toEqual("strung");
|
||||
expect(jasmineUnderTest.pp(obj)).toEqual("strung");
|
||||
});
|
||||
|
||||
it("should stringify objects that implement custom toString", function () {
|
||||
var obj = {
|
||||
toString: function () { return "my toString"; }
|
||||
};
|
||||
|
||||
expect(jasmineUnderTest.pp(obj)).toEqual("my toString");
|
||||
|
||||
// Simulate object from another global context (e.g. an iframe or Web Worker) that does not actually have a custom
|
||||
// toString despite obj.toString !== Object.prototype.toString
|
||||
var objFromOtherContext = {
|
||||
foo: 'bar',
|
||||
toString: function () { return Object.prototype.toString.call(this); }
|
||||
};
|
||||
|
||||
expect(jasmineUnderTest.pp(objFromOtherContext)).toEqual("Object({ foo: 'bar', toString: Function })");
|
||||
});
|
||||
|
||||
it("should stringify objects have have a toString that isn't a function", function() {
|
||||
var obj = {
|
||||
toString: "foo"
|
||||
};
|
||||
|
||||
expect(jasmineUnderTest.pp(obj)).toEqual("Object({ toString: 'foo' })");
|
||||
});
|
||||
|
||||
it("should stringify objects from anonymous constructors with custom toString", function () {
|
||||
var MyAnonymousConstructor = (function() { return function () {}; })();
|
||||
MyAnonymousConstructor.toString = function () { return ''; };
|
||||
|
||||
var a = new MyAnonymousConstructor();
|
||||
|
||||
expect(jasmineUnderTest.pp(a)).toEqual("<anonymous>({ })");
|
||||
});
|
||||
|
||||
it("should handle objects with null prototype", function() {
|
||||
if (jasmine.getEnv().ieVersion < 9) { return; }
|
||||
|
||||
var obj = Object.create(null);
|
||||
obj.foo = 'bar';
|
||||
|
||||
expect(j$.pp(obj)).toEqual("{ foo: 'bar' }");
|
||||
expect(jasmineUnderTest.pp(obj)).toEqual("null({ foo: 'bar' })");
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -2,15 +2,35 @@ describe("QueueRunner", function() {
|
||||
|
||||
it("runs all the functions it's passed", function() {
|
||||
var calls = [],
|
||||
fn1 = jasmine.createSpy('fn1'),
|
||||
fn2 = jasmine.createSpy('fn2'),
|
||||
queueRunner = new j$.QueueRunner({
|
||||
fns: [fn1, fn2]
|
||||
queueableFn1 = { fn: jasmine.createSpy('fn1') },
|
||||
queueableFn2 = { fn: jasmine.createSpy('fn2') },
|
||||
queueRunner = new jasmineUnderTest.QueueRunner({
|
||||
queueableFns: [queueableFn1, queueableFn2]
|
||||
});
|
||||
fn1.and.callFake(function() {
|
||||
queueableFn1.fn.and.callFake(function() {
|
||||
calls.push('fn1');
|
||||
});
|
||||
fn2.and.callFake(function() {
|
||||
queueableFn2.fn.and.callFake(function() {
|
||||
calls.push('fn2');
|
||||
});
|
||||
|
||||
queueRunner.execute();
|
||||
|
||||
expect(calls).toEqual(['fn1', 'fn2']);
|
||||
});
|
||||
|
||||
it("runs cleanup functions after the others", function() {
|
||||
var calls = [],
|
||||
queueableFn1 = { fn: jasmine.createSpy('fn1') },
|
||||
queueableFn2 = { fn: jasmine.createSpy('fn2') },
|
||||
queueRunner = new jasmineUnderTest.QueueRunner({
|
||||
queueableFns: [queueableFn1],
|
||||
cleanupFns: [queueableFn2]
|
||||
});
|
||||
queueableFn1.fn.and.callFake(function() {
|
||||
calls.push('fn1');
|
||||
});
|
||||
queueableFn2.fn.and.callFake(function() {
|
||||
calls.push('fn2');
|
||||
});
|
||||
|
||||
@@ -20,19 +40,19 @@ describe("QueueRunner", function() {
|
||||
});
|
||||
|
||||
it("calls each function with a consistent 'this'-- an empty object", function() {
|
||||
var fn1 = jasmine.createSpy('fn1'),
|
||||
fn2 = jasmine.createSpy('fn2'),
|
||||
fn3 = function(done) { asyncContext = this; done(); },
|
||||
queueRunner = new j$.QueueRunner({
|
||||
fns: [fn1, fn2, fn3]
|
||||
var queueableFn1 = { fn: jasmine.createSpy('fn1') },
|
||||
queueableFn2 = { fn: jasmine.createSpy('fn2') },
|
||||
queueableFn3 = { fn: function(done) { asyncContext = this; done(); } },
|
||||
queueRunner = new jasmineUnderTest.QueueRunner({
|
||||
queueableFns: [queueableFn1, queueableFn2, queueableFn3]
|
||||
}),
|
||||
asyncContext;
|
||||
|
||||
queueRunner.execute();
|
||||
|
||||
var context = fn1.calls.first().object;
|
||||
expect(context).toEqual({});
|
||||
expect(fn2.calls.first().object).toBe(context);
|
||||
var context = queueableFn1.fn.calls.first().object;
|
||||
expect(context).toEqual(new jasmineUnderTest.UserContext());
|
||||
expect(queueableFn2.fn.calls.first().object).toBe(context);
|
||||
expect(asyncContext).toBe(context);
|
||||
});
|
||||
|
||||
@@ -53,20 +73,20 @@ describe("QueueRunner", function() {
|
||||
beforeCallback = jasmine.createSpy('beforeCallback'),
|
||||
fnCallback = jasmine.createSpy('fnCallback'),
|
||||
afterCallback = jasmine.createSpy('afterCallback'),
|
||||
fn1 = function(done) {
|
||||
queueableFn1 = { fn: function(done) {
|
||||
beforeCallback();
|
||||
setTimeout(done, 100);
|
||||
},
|
||||
fn2 = function(done) {
|
||||
} },
|
||||
queueableFn2 = { fn: function(done) {
|
||||
fnCallback();
|
||||
setTimeout(done, 100);
|
||||
},
|
||||
fn3 = function(done) {
|
||||
} },
|
||||
queueableFn3 = { fn: function(done) {
|
||||
afterCallback();
|
||||
setTimeout(done, 100);
|
||||
},
|
||||
queueRunner = new j$.QueueRunner({
|
||||
fns: [fn1, fn2, fn3],
|
||||
} },
|
||||
queueRunner = new jasmineUnderTest.QueueRunner({
|
||||
queueableFns: [queueableFn1, queueableFn2, queueableFn3],
|
||||
onComplete: onComplete
|
||||
});
|
||||
|
||||
@@ -93,55 +113,123 @@ describe("QueueRunner", function() {
|
||||
expect(onComplete).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("sets a timeout if requested for asynchronous functions so they don't go on forever", function() {
|
||||
var beforeFn = function(done) { },
|
||||
fn = jasmine.createSpy('fn'),
|
||||
onComplete = jasmine.createSpy('onComplete'),
|
||||
onException = jasmine.createSpy('onException'),
|
||||
queueRunner = new j$.QueueRunner({
|
||||
fns: [beforeFn, fn],
|
||||
onComplete: onComplete,
|
||||
onException: onException,
|
||||
enforceTimeout: function() { return true; }
|
||||
it("explicitly fails an async function with a provided fail function and moves to the next function", function() {
|
||||
var queueableFn1 = { fn: function(done) {
|
||||
setTimeout(function() { done.fail('foo'); }, 100);
|
||||
} },
|
||||
queueableFn2 = { fn: jasmine.createSpy('fn2') },
|
||||
failFn = jasmine.createSpy('fail'),
|
||||
queueRunner = new jasmineUnderTest.QueueRunner({
|
||||
queueableFns: [queueableFn1, queueableFn2],
|
||||
fail: failFn
|
||||
});
|
||||
|
||||
queueRunner.execute();
|
||||
expect(fn).not.toHaveBeenCalled();
|
||||
|
||||
jasmine.clock().tick(j$.DEFAULT_TIMEOUT_INTERVAL);
|
||||
expect(failFn).not.toHaveBeenCalled();
|
||||
expect(queueableFn2.fn).not.toHaveBeenCalled();
|
||||
|
||||
jasmine.clock().tick(100);
|
||||
|
||||
expect(failFn).toHaveBeenCalledWith('foo');
|
||||
expect(queueableFn2.fn).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("explicitly fails an async function when next is called with an Error and moves to the next function", function() {
|
||||
var err = new Error('foo'),
|
||||
queueableFn1 = { fn: function(done) {
|
||||
setTimeout(function() { done(err); }, 100);
|
||||
} },
|
||||
queueableFn2 = { fn: jasmine.createSpy('fn2') },
|
||||
failFn = jasmine.createSpy('fail'),
|
||||
queueRunner = new jasmineUnderTest.QueueRunner({
|
||||
queueableFns: [queueableFn1, queueableFn2],
|
||||
fail: failFn
|
||||
});
|
||||
|
||||
queueRunner.execute();
|
||||
|
||||
expect(failFn).not.toHaveBeenCalled();
|
||||
expect(queueableFn2.fn).not.toHaveBeenCalled();
|
||||
|
||||
jasmine.clock().tick(100);
|
||||
|
||||
expect(failFn).toHaveBeenCalledWith(err);
|
||||
expect(queueableFn2.fn).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("does not cause an explicit fail if execution is being stopped", function() {
|
||||
var err = new jasmineUnderTest.StopExecutionError('foo'),
|
||||
queueableFn1 = { fn: function(done) {
|
||||
setTimeout(function() { done(err); }, 100);
|
||||
} },
|
||||
queueableFn2 = { fn: jasmine.createSpy('fn2') },
|
||||
failFn = jasmine.createSpy('fail'),
|
||||
queueRunner = new jasmineUnderTest.QueueRunner({
|
||||
queueableFns: [queueableFn1, queueableFn2],
|
||||
fail: failFn
|
||||
});
|
||||
|
||||
queueRunner.execute();
|
||||
|
||||
expect(failFn).not.toHaveBeenCalled();
|
||||
expect(queueableFn2.fn).not.toHaveBeenCalled();
|
||||
|
||||
jasmine.clock().tick(100);
|
||||
|
||||
expect(failFn).not.toHaveBeenCalled();
|
||||
expect(queueableFn2.fn).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("sets a timeout if requested for asynchronous functions so they don't go on forever", function() {
|
||||
var timeout = 3,
|
||||
beforeFn = { fn: function(done) { }, type: 'before', timeout: function() { return timeout; } },
|
||||
queueableFn = { fn: jasmine.createSpy('fn'), type: 'queueable' },
|
||||
onComplete = jasmine.createSpy('onComplete'),
|
||||
onException = jasmine.createSpy('onException'),
|
||||
queueRunner = new jasmineUnderTest.QueueRunner({
|
||||
queueableFns: [beforeFn, queueableFn],
|
||||
onComplete: onComplete,
|
||||
onException: onException
|
||||
});
|
||||
|
||||
queueRunner.execute();
|
||||
expect(queueableFn.fn).not.toHaveBeenCalled();
|
||||
|
||||
jasmine.clock().tick(timeout);
|
||||
|
||||
expect(onException).toHaveBeenCalledWith(jasmine.any(Error));
|
||||
expect(fn).toHaveBeenCalled();
|
||||
expect(queueableFn.fn).toHaveBeenCalled();
|
||||
expect(onComplete).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("by default does not set a timeout for asynchronous functions", function() {
|
||||
var beforeFn = function(done) { },
|
||||
fn = jasmine.createSpy('fn'),
|
||||
var beforeFn = { fn: function(done) { } },
|
||||
queueableFn = { fn: jasmine.createSpy('fn') },
|
||||
onComplete = jasmine.createSpy('onComplete'),
|
||||
onException = jasmine.createSpy('onException'),
|
||||
queueRunner = new j$.QueueRunner({
|
||||
fns: [beforeFn, fn],
|
||||
queueRunner = new jasmineUnderTest.QueueRunner({
|
||||
queueableFns: [beforeFn, queueableFn],
|
||||
onComplete: onComplete,
|
||||
onException: onException,
|
||||
});
|
||||
|
||||
queueRunner.execute();
|
||||
expect(fn).not.toHaveBeenCalled();
|
||||
expect(queueableFn.fn).not.toHaveBeenCalled();
|
||||
|
||||
jasmine.clock().tick(j$.DEFAULT_TIMEOUT_INTERVAL);
|
||||
jasmine.clock().tick(jasmineUnderTest.DEFAULT_TIMEOUT_INTERVAL);
|
||||
|
||||
expect(onException).not.toHaveBeenCalled();
|
||||
expect(fn).not.toHaveBeenCalled();
|
||||
expect(queueableFn.fn).not.toHaveBeenCalled();
|
||||
expect(onComplete).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("clears the timeout when an async function throws an exception, to prevent additional onException calls", function() {
|
||||
var fn = function(done) { throw new Error("error!"); },
|
||||
it("clears the timeout when an async function throws an exception, to prevent additional exception reporting", function() {
|
||||
var queueableFn = { fn: function(done) { throw new Error("error!"); } },
|
||||
onComplete = jasmine.createSpy('onComplete'),
|
||||
onException = jasmine.createSpy('onException'),
|
||||
queueRunner = new j$.QueueRunner({
|
||||
fns: [fn],
|
||||
queueRunner = new jasmineUnderTest.QueueRunner({
|
||||
queueableFns: [queueableFn],
|
||||
onComplete: onComplete,
|
||||
onException: onException
|
||||
});
|
||||
@@ -151,98 +239,347 @@ describe("QueueRunner", function() {
|
||||
expect(onComplete).toHaveBeenCalled();
|
||||
expect(onException).toHaveBeenCalled();
|
||||
|
||||
jasmine.clock().tick(j$.DEFAULT_TIMEOUT_INTERVAL);
|
||||
jasmine.clock().tick(jasmineUnderTest.DEFAULT_TIMEOUT_INTERVAL);
|
||||
expect(onException.calls.count()).toEqual(1);
|
||||
});
|
||||
|
||||
it("clears the timeout when the done callback is called", function() {
|
||||
var fn = function(done) { done(); },
|
||||
var queueableFn = { fn: function(done) { done(); } },
|
||||
onComplete = jasmine.createSpy('onComplete'),
|
||||
onException = jasmine.createSpy('onException'),
|
||||
queueRunner = new j$.QueueRunner({
|
||||
fns: [fn],
|
||||
queueRunner = new jasmineUnderTest.QueueRunner({
|
||||
queueableFns: [queueableFn],
|
||||
onComplete: onComplete,
|
||||
onException: onException
|
||||
});
|
||||
|
||||
queueRunner.execute();
|
||||
|
||||
jasmine.clock().tick(1);
|
||||
expect(onComplete).toHaveBeenCalled();
|
||||
|
||||
jasmine.clock().tick(j$.DEFAULT_TIMEOUT_INTERVAL);
|
||||
jasmine.clock().tick(jasmineUnderTest.DEFAULT_TIMEOUT_INTERVAL);
|
||||
expect(onException).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("only moves to the next spec the first time you call done", function() {
|
||||
var fn = function(done) {done(); done();},
|
||||
nextFn = jasmine.createSpy('nextFn');
|
||||
queueRunner = new j$.QueueRunner({
|
||||
fns: [fn, nextFn]
|
||||
});
|
||||
|
||||
queueRunner.execute();
|
||||
expect(nextFn.calls.count()).toEqual(1);
|
||||
});
|
||||
|
||||
it("does not move to the next spec if done is called after an exception has ended the spec", function() {
|
||||
var fn = function(done) {
|
||||
setTimeout(done, 1);
|
||||
throw new Error('error!');
|
||||
},
|
||||
nextFn = jasmine.createSpy('nextFn');
|
||||
queueRunner = new j$.QueueRunner({
|
||||
fns: [fn, nextFn]
|
||||
});
|
||||
var queueableFn = { fn: function(done) {done(); done();} },
|
||||
nextQueueableFn = { fn: jasmine.createSpy('nextFn') },
|
||||
queueRunner = new jasmineUnderTest.QueueRunner({
|
||||
queueableFns: [queueableFn, nextQueueableFn]
|
||||
});
|
||||
|
||||
queueRunner.execute();
|
||||
jasmine.clock().tick(1);
|
||||
expect(nextFn.calls.count()).toEqual(1);
|
||||
expect(nextQueueableFn.fn.calls.count()).toEqual(1);
|
||||
});
|
||||
|
||||
it("does not move to the next spec if done is called after an exception has ended the spec", function() {
|
||||
var queueableFn = { fn: function(done) {
|
||||
setTimeout(done, 1);
|
||||
throw new Error('error!');
|
||||
} },
|
||||
nextQueueableFn = { fn: jasmine.createSpy('nextFn') },
|
||||
queueRunner = new jasmineUnderTest.QueueRunner({
|
||||
queueableFns: [queueableFn, nextQueueableFn]
|
||||
});
|
||||
|
||||
queueRunner.execute();
|
||||
jasmine.clock().tick(1);
|
||||
expect(nextQueueableFn.fn.calls.count()).toEqual(1);
|
||||
});
|
||||
|
||||
it("should return a null when you call done", function () {
|
||||
// Some promises want handlers to return anything but undefined to help catch "forgotten returns".
|
||||
var doneReturn,
|
||||
queueableFn = { fn: function(done) {
|
||||
doneReturn = done();
|
||||
} },
|
||||
queueRunner = new jasmineUnderTest.QueueRunner({
|
||||
queueableFns: [queueableFn]
|
||||
});
|
||||
|
||||
queueRunner.execute();
|
||||
expect(doneReturn).toBe(null);
|
||||
});
|
||||
|
||||
it("continues running functions when an exception is thrown in async code without timing out", function() {
|
||||
var queueableFn = { fn: function(done) { throwAsync(); }, timeout: function() { return 1; } },
|
||||
nextQueueableFn = { fn: jasmine.createSpy("nextFunction") },
|
||||
onException = jasmine.createSpy('onException'),
|
||||
globalErrors = { pushListener: jasmine.createSpy('pushListener'), popListener: jasmine.createSpy('popListener') },
|
||||
queueRunner = new jasmineUnderTest.QueueRunner({
|
||||
queueableFns: [queueableFn, nextQueueableFn],
|
||||
onException: onException,
|
||||
globalErrors: globalErrors
|
||||
}),
|
||||
throwAsync = function() {
|
||||
globalErrors.pushListener.calls.mostRecent().args[0](new Error('foo'));
|
||||
jasmine.clock().tick(2);
|
||||
};
|
||||
|
||||
nextQueueableFn.fn.and.callFake(function() {
|
||||
// should remove the same function that was added
|
||||
expect(globalErrors.popListener).toHaveBeenCalledWith(globalErrors.pushListener.calls.argsFor(1)[0]);
|
||||
});
|
||||
|
||||
queueRunner.execute();
|
||||
|
||||
function errorWithMessage(message) {
|
||||
return {
|
||||
asymmetricMatch: function(other) {
|
||||
return new RegExp(message).test(other.message);
|
||||
},
|
||||
toString: function() {
|
||||
return '<Error with message like "' + message + '">';
|
||||
}
|
||||
};
|
||||
}
|
||||
expect(onException).not.toHaveBeenCalledWith(errorWithMessage(/DEFAULT_TIMEOUT_INTERVAL/));
|
||||
expect(onException).toHaveBeenCalledWith(errorWithMessage(/^foo$/));
|
||||
expect(nextQueueableFn.fn).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("handles exceptions thrown while waiting for the stack to clear", function() {
|
||||
var queueableFn = { fn: function(done) { done() } },
|
||||
global = {},
|
||||
errorListeners = [],
|
||||
globalErrors = {
|
||||
pushListener: function(f) { errorListeners.push(f); },
|
||||
popListener: function() { errorListeners.pop(); }
|
||||
},
|
||||
clearStack = jasmine.createSpy('clearStack'),
|
||||
onException = jasmine.createSpy('onException'),
|
||||
queueRunner = new jasmineUnderTest.QueueRunner({
|
||||
queueableFns: [queueableFn],
|
||||
globalErrors: globalErrors,
|
||||
clearStack: clearStack,
|
||||
onException: onException
|
||||
}),
|
||||
error = new Error('nope');
|
||||
|
||||
queueRunner.execute();
|
||||
jasmine.clock().tick();
|
||||
expect(clearStack).toHaveBeenCalled();
|
||||
expect(errorListeners.length).toEqual(1);
|
||||
errorListeners[0](error);
|
||||
clearStack.calls.argsFor(0)[0]();
|
||||
expect(onException).toHaveBeenCalledWith(error);
|
||||
});
|
||||
});
|
||||
|
||||
it("calls an exception handler when an exception is thrown in a fn", function() {
|
||||
var fn = function() {
|
||||
describe("with a function that returns a promise", function() {
|
||||
function StubPromise() {}
|
||||
|
||||
StubPromise.prototype.then = function(resolve, reject) {
|
||||
this.resolveHandler = resolve;
|
||||
this.rejectHandler = reject;
|
||||
};
|
||||
|
||||
beforeEach(function() {
|
||||
jasmine.clock().install();
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
jasmine.clock().uninstall();
|
||||
});
|
||||
|
||||
it("runs the function asynchronously, advancing once the promise is settled", function() {
|
||||
var onComplete = jasmine.createSpy('onComplete'),
|
||||
fnCallback = jasmine.createSpy('fnCallback'),
|
||||
p1 = new StubPromise(),
|
||||
p2 = new StubPromise(),
|
||||
queueableFn1 = { fn: function() {
|
||||
setTimeout(function() {
|
||||
p1.resolveHandler();
|
||||
}, 100);
|
||||
return p1;
|
||||
} };
|
||||
queueableFn2 = { fn: function() {
|
||||
fnCallback();
|
||||
setTimeout(function() {
|
||||
p2.resolveHandler();
|
||||
}, 100);
|
||||
return p2;
|
||||
} },
|
||||
queueRunner = new jasmineUnderTest.QueueRunner({
|
||||
queueableFns: [queueableFn1, queueableFn2],
|
||||
onComplete: onComplete
|
||||
});
|
||||
|
||||
queueRunner.execute();
|
||||
expect(fnCallback).not.toHaveBeenCalled();
|
||||
expect(onComplete).not.toHaveBeenCalled();
|
||||
|
||||
jasmine.clock().tick(100);
|
||||
|
||||
expect(fnCallback).toHaveBeenCalled();
|
||||
expect(onComplete).not.toHaveBeenCalled();
|
||||
|
||||
jasmine.clock().tick(100);
|
||||
|
||||
expect(onComplete).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("handles a rejected promise like an unhandled exception", function() {
|
||||
var promise = new StubPromise(),
|
||||
queueableFn1 = { fn: function() {
|
||||
setTimeout(function() {
|
||||
promise.rejectHandler('foo')
|
||||
}, 100);
|
||||
return promise;
|
||||
} },
|
||||
queueableFn2 = { fn: jasmine.createSpy('fn2') },
|
||||
failFn = jasmine.createSpy('fail'),
|
||||
onExceptionCallback = jasmine.createSpy('on exception callback'),
|
||||
queueRunner = new jasmineUnderTest.QueueRunner({
|
||||
queueableFns: [queueableFn1, queueableFn2],
|
||||
onException: onExceptionCallback
|
||||
});
|
||||
|
||||
queueRunner.execute();
|
||||
|
||||
expect(onExceptionCallback).not.toHaveBeenCalled();
|
||||
expect(queueableFn2.fn).not.toHaveBeenCalled();
|
||||
|
||||
jasmine.clock().tick(100);
|
||||
|
||||
expect(onExceptionCallback).toHaveBeenCalledWith('foo');
|
||||
expect(queueableFn2.fn).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
it("calls exception handlers when an exception is thrown in a fn", function() {
|
||||
var queueableFn = { type: 'queueable',
|
||||
fn: function() {
|
||||
throw new Error('fake error');
|
||||
},
|
||||
exceptionCallback = jasmine.createSpy('exception callback'),
|
||||
queueRunner = new j$.QueueRunner({
|
||||
fns: [fn],
|
||||
onException: exceptionCallback
|
||||
} },
|
||||
onExceptionCallback = jasmine.createSpy('on exception callback'),
|
||||
queueRunner = new jasmineUnderTest.QueueRunner({
|
||||
queueableFns: [queueableFn],
|
||||
onException: onExceptionCallback
|
||||
});
|
||||
|
||||
queueRunner.execute();
|
||||
|
||||
expect(exceptionCallback).toHaveBeenCalledWith(jasmine.any(Error));
|
||||
});
|
||||
|
||||
it("rethrows an exception if told to", function() {
|
||||
var fn = function() {
|
||||
throw new Error('fake error');
|
||||
},
|
||||
queueRunner = new j$.QueueRunner({
|
||||
fns: [fn],
|
||||
catchException: function(e) { return false; }
|
||||
});
|
||||
|
||||
expect(queueRunner.execute).toThrow();
|
||||
expect(onExceptionCallback).toHaveBeenCalledWith(jasmine.any(Error));
|
||||
});
|
||||
|
||||
it("continues running the functions even after an exception is thrown in an async spec", function() {
|
||||
var fn = function(done) { throw new Error("error"); },
|
||||
nextFn = jasmine.createSpy("nextFunction"),
|
||||
queueRunner = new j$.QueueRunner({
|
||||
fns: [fn, nextFn]
|
||||
var queueableFn = { fn: function(done) { throw new Error("error"); } },
|
||||
nextQueueableFn = { fn: jasmine.createSpy("nextFunction") },
|
||||
queueRunner = new jasmineUnderTest.QueueRunner({
|
||||
queueableFns: [queueableFn, nextQueueableFn]
|
||||
});
|
||||
|
||||
queueRunner.execute();
|
||||
expect(nextFn).toHaveBeenCalled();
|
||||
expect(nextQueueableFn.fn).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
describe("When configured to complete on first error", function() {
|
||||
it("skips to cleanup functions on the first exception", function() {
|
||||
var queueableFn = { fn: function() { throw new Error("error"); } },
|
||||
nextQueueableFn = { fn: jasmine.createSpy("nextFunction") },
|
||||
cleanupFn = { fn: jasmine.createSpy("cleanup") },
|
||||
queueRunner = new jasmineUnderTest.QueueRunner({
|
||||
queueableFns: [queueableFn, nextQueueableFn],
|
||||
cleanupFns: [cleanupFn],
|
||||
completeOnFirstError: true
|
||||
});
|
||||
|
||||
queueRunner.execute();
|
||||
expect(nextQueueableFn.fn).not.toHaveBeenCalled();
|
||||
expect(cleanupFn.fn).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("does not skip when a cleanup function throws", function() {
|
||||
var queueableFn = { fn: function() { } },
|
||||
cleanupFn1 = { fn: function() { throw new Error("error"); } },
|
||||
cleanupFn2 = { fn: jasmine.createSpy("cleanupFn2") },
|
||||
queueRunner = new jasmineUnderTest.QueueRunner({
|
||||
queueableFns: [queueableFn],
|
||||
cleanupFns: [cleanupFn1, cleanupFn2],
|
||||
completeOnFirstError: true
|
||||
});
|
||||
|
||||
queueRunner.execute();
|
||||
expect(cleanupFn2.fn).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
describe("with an asynchronous function", function() {
|
||||
beforeEach(function() {
|
||||
jasmine.clock().install();
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
jasmine.clock().uninstall();
|
||||
});
|
||||
|
||||
|
||||
it("skips to cleanup functions on the first exception", function() {
|
||||
var errorListeners = [],
|
||||
queueableFn = { fn: function(done) {} },
|
||||
nextQueueableFn = { fn: jasmine.createSpy('nextFunction') },
|
||||
cleanupFn = { fn: jasmine.createSpy('cleanup') },
|
||||
queueRunner = new jasmineUnderTest.QueueRunner({
|
||||
globalErrors: {
|
||||
pushListener: function(f) { errorListeners.push(f); },
|
||||
popListener: function() { errorListeners.pop(); },
|
||||
},
|
||||
queueableFns: [queueableFn, nextQueueableFn],
|
||||
cleanupFns: [cleanupFn],
|
||||
completeOnFirstError: true,
|
||||
});
|
||||
|
||||
queueRunner.execute();
|
||||
errorListeners[errorListeners.length - 1](new Error('error'));
|
||||
expect(nextQueueableFn.fn).not.toHaveBeenCalled();
|
||||
expect(cleanupFn.fn).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("skips to cleanup functions when next.fail is called", function() {
|
||||
var queueableFn = { fn: function(done) {
|
||||
done.fail('nope');
|
||||
} },
|
||||
nextQueueableFn = { fn: jasmine.createSpy('nextFunction') },
|
||||
cleanupFn = { fn: jasmine.createSpy('cleanup') },
|
||||
queueRunner = new jasmineUnderTest.QueueRunner({
|
||||
queueableFns: [queueableFn, nextQueueableFn],
|
||||
cleanupFns: [cleanupFn],
|
||||
completeOnFirstError: true,
|
||||
});
|
||||
|
||||
queueRunner.execute();
|
||||
jasmine.clock().tick();
|
||||
expect(nextQueueableFn.fn).not.toHaveBeenCalled();
|
||||
expect(cleanupFn.fn).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("skips to cleanup functions when next is called with an Error", function() {
|
||||
var queueableFn = { fn: function(done) {
|
||||
done(new Error('nope'));
|
||||
} },
|
||||
nextQueueableFn = { fn: jasmine.createSpy('nextFunction') },
|
||||
cleanupFn = { fn: jasmine.createSpy('cleanup') },
|
||||
queueRunner = new jasmineUnderTest.QueueRunner({
|
||||
queueableFns: [queueableFn, nextQueueableFn],
|
||||
cleanupFns: [cleanupFn],
|
||||
completeOnFirstError: true,
|
||||
});
|
||||
|
||||
queueRunner.execute();
|
||||
jasmine.clock().tick();
|
||||
expect(nextQueueableFn.fn).not.toHaveBeenCalled();
|
||||
expect(cleanupFn.fn).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it("calls a provided complete callback when done", function() {
|
||||
var fn = jasmine.createSpy('fn'),
|
||||
var queueableFn = { fn: jasmine.createSpy('fn') },
|
||||
completeCallback = jasmine.createSpy('completeCallback'),
|
||||
queueRunner = new j$.QueueRunner({
|
||||
fns: [fn],
|
||||
queueRunner = new jasmineUnderTest.QueueRunner({
|
||||
queueableFns: [queueableFn],
|
||||
onComplete: completeCallback
|
||||
});
|
||||
|
||||
@@ -251,21 +588,83 @@ describe("QueueRunner", function() {
|
||||
expect(completeCallback).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("calls a provided stack clearing function when done", function() {
|
||||
var asyncFn = function(done) { done() },
|
||||
afterFn = jasmine.createSpy('afterFn'),
|
||||
completeCallback = jasmine.createSpy('completeCallback'),
|
||||
clearStack = jasmine.createSpy('clearStack'),
|
||||
queueRunner = new j$.QueueRunner({
|
||||
fns: [asyncFn, afterFn],
|
||||
clearStack: clearStack,
|
||||
onComplete: completeCallback
|
||||
});
|
||||
describe("clearing the stack", function() {
|
||||
beforeEach(function() {
|
||||
jasmine.clock().install();
|
||||
});
|
||||
|
||||
clearStack.and.callFake(function(fn) { fn(); });
|
||||
afterEach(function() {
|
||||
jasmine.clock().uninstall();
|
||||
});
|
||||
|
||||
queueRunner.execute();
|
||||
expect(afterFn).toHaveBeenCalled();
|
||||
expect(clearStack).toHaveBeenCalledWith(completeCallback);
|
||||
it("calls a provided stack clearing function when done", function() {
|
||||
var asyncFn = { fn: function(done) { done() } },
|
||||
afterFn = { fn: jasmine.createSpy('afterFn') },
|
||||
completeCallback = jasmine.createSpy('completeCallback'),
|
||||
clearStack = jasmine.createSpy('clearStack'),
|
||||
queueRunner = new jasmineUnderTest.QueueRunner({
|
||||
queueableFns: [asyncFn, afterFn],
|
||||
clearStack: clearStack,
|
||||
onComplete: completeCallback
|
||||
});
|
||||
|
||||
clearStack.and.callFake(function(fn) { fn(); });
|
||||
|
||||
queueRunner.execute();
|
||||
jasmine.clock().tick();
|
||||
expect(afterFn.fn).toHaveBeenCalled();
|
||||
expect(clearStack).toHaveBeenCalled();
|
||||
clearStack.calls.argsFor(0)[0]();
|
||||
expect(completeCallback).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
describe('when user context has not been defined', function() {
|
||||
beforeEach(function() {
|
||||
var fn;
|
||||
|
||||
this.fn = fn = jasmine.createSpy('fn1');
|
||||
this.queueRunner = new jasmineUnderTest.QueueRunner({
|
||||
queueableFns: [{ fn: fn }]
|
||||
});
|
||||
});
|
||||
|
||||
it('runs the functions on the scope of a UserContext', function() {
|
||||
var calls = [],
|
||||
context;
|
||||
|
||||
this.fn.and.callFake(function() {
|
||||
context = this;
|
||||
});
|
||||
|
||||
this.queueRunner.execute();
|
||||
|
||||
expect(context.constructor).toBe(jasmineUnderTest.UserContext);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when user context has been defined', function() {
|
||||
beforeEach(function() {
|
||||
var fn, context;
|
||||
|
||||
this.fn = fn = jasmine.createSpy('fn1');
|
||||
this.context = context = new jasmineUnderTest.UserContext();
|
||||
this.queueRunner = new jasmineUnderTest.QueueRunner({
|
||||
queueableFns: [{ fn: fn }],
|
||||
userContext: context
|
||||
});
|
||||
});
|
||||
|
||||
it('runs the functions on the scope of a UserContext', function() {
|
||||
var calls = [],
|
||||
context;
|
||||
this.fn.and.callFake(function() {
|
||||
context = this;
|
||||
});
|
||||
|
||||
this.queueRunner.execute();
|
||||
|
||||
expect(context).toBe(this.context);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
describe("ReportDispatcher", function() {
|
||||
|
||||
it("builds an interface of requested methods", function() {
|
||||
var dispatcher = new j$.ReportDispatcher(['foo', 'bar', 'baz']);
|
||||
var dispatcher = new jasmineUnderTest.ReportDispatcher(['foo', 'bar', 'baz']);
|
||||
|
||||
expect(dispatcher.foo).toBeDefined();
|
||||
expect(dispatcher.bar).toBeDefined();
|
||||
@@ -9,32 +9,132 @@ describe("ReportDispatcher", function() {
|
||||
});
|
||||
|
||||
it("dispatches requested methods to added reporters", function() {
|
||||
var dispatcher = new j$.ReportDispatcher(['foo', 'bar']),
|
||||
var queueRunnerFactory = jasmine.createSpy('queueRunner'),
|
||||
dispatcher = new jasmineUnderTest.ReportDispatcher(['foo', 'bar'], queueRunnerFactory),
|
||||
reporter = jasmine.createSpyObj('reporter', ['foo', 'bar']),
|
||||
anotherReporter = jasmine.createSpyObj('reporter', ['foo', 'bar']);
|
||||
anotherReporter = jasmine.createSpyObj('reporter', ['foo', 'bar']),
|
||||
completeCallback = jasmine.createSpy('complete');
|
||||
|
||||
dispatcher.addReporter(reporter);
|
||||
dispatcher.addReporter(anotherReporter);
|
||||
|
||||
dispatcher.foo(123, 456);
|
||||
dispatcher.foo(123, 456, completeCallback);
|
||||
|
||||
expect(queueRunnerFactory).toHaveBeenCalledWith(jasmine.objectContaining({
|
||||
queueableFns: [{fn: jasmine.any(Function)}, {fn: jasmine.any(Function)}],
|
||||
isReporter: true
|
||||
}));
|
||||
|
||||
var fns = queueRunnerFactory.calls.mostRecent().args[0].queueableFns;
|
||||
fns[0].fn();
|
||||
expect(reporter.foo).toHaveBeenCalledWith(123, 456);
|
||||
expect(reporter.foo.calls.mostRecent().object).toBe(reporter);
|
||||
|
||||
fns[1].fn();
|
||||
expect(anotherReporter.foo).toHaveBeenCalledWith(123, 456);
|
||||
expect(anotherReporter.foo.calls.mostRecent().object).toBe(anotherReporter);
|
||||
|
||||
dispatcher.bar('a', 'b');
|
||||
queueRunnerFactory.calls.reset();
|
||||
|
||||
dispatcher.bar('a', 'b', completeCallback);
|
||||
|
||||
expect(queueRunnerFactory).toHaveBeenCalledWith(jasmine.objectContaining({
|
||||
queueableFns: [{fn: jasmine.any(Function)}, {fn: jasmine.any(Function)}],
|
||||
isReporter: true
|
||||
}));
|
||||
|
||||
fns = queueRunnerFactory.calls.mostRecent().args[0].queueableFns;
|
||||
fns[0].fn();
|
||||
expect(reporter.bar).toHaveBeenCalledWith('a', 'b');
|
||||
|
||||
fns[1].fn();
|
||||
expect(anotherReporter.bar).toHaveBeenCalledWith('a', 'b');
|
||||
});
|
||||
|
||||
it("does not dispatch to a reporter if the reporter doesn't accept the method", function() {
|
||||
var dispatcher = new j$.ReportDispatcher(['foo']),
|
||||
var queueRunnerFactory = jasmine.createSpy('queueRunner'),
|
||||
dispatcher = new jasmineUnderTest.ReportDispatcher(['foo'], queueRunnerFactory),
|
||||
reporter = jasmine.createSpyObj('reporter', ['baz']);
|
||||
|
||||
dispatcher.addReporter(reporter);
|
||||
|
||||
expect(function() {
|
||||
dispatcher.foo(123, 456);
|
||||
}).not.toThrow();
|
||||
dispatcher.foo(123, 456);
|
||||
expect(queueRunnerFactory).toHaveBeenCalledWith(jasmine.objectContaining({
|
||||
queueableFns: []
|
||||
}));
|
||||
});
|
||||
|
||||
it("allows providing a fallback reporter in case there's no other reporter", function() {
|
||||
var queueRunnerFactory = jasmine.createSpy('queueRunner'),
|
||||
dispatcher = new jasmineUnderTest.ReportDispatcher(['foo', 'bar'], queueRunnerFactory),
|
||||
reporter = jasmine.createSpyObj('reporter', ['foo', 'bar']),
|
||||
completeCallback = jasmine.createSpy('complete');
|
||||
|
||||
dispatcher.provideFallbackReporter(reporter);
|
||||
dispatcher.foo(123, 456, completeCallback);
|
||||
|
||||
expect(queueRunnerFactory).toHaveBeenCalledWith(jasmine.objectContaining({
|
||||
queueableFns: [{fn: jasmine.any(Function)}],
|
||||
isReporter: true
|
||||
}));
|
||||
|
||||
var fns = queueRunnerFactory.calls.mostRecent().args[0].queueableFns;
|
||||
fns[0].fn();
|
||||
expect(reporter.foo).toHaveBeenCalledWith(123, 456);
|
||||
});
|
||||
|
||||
it("does not call fallback reporting methods when another reporter is provided", function() {
|
||||
var queueRunnerFactory = jasmine.createSpy('queueRunner'),
|
||||
dispatcher = new jasmineUnderTest.ReportDispatcher(['foo', 'bar'], queueRunnerFactory),
|
||||
reporter = jasmine.createSpyObj('reporter', ['foo', 'bar']),
|
||||
fallbackReporter = jasmine.createSpyObj('otherReporter', ['foo', 'bar']),
|
||||
completeCallback = jasmine.createSpy('complete');
|
||||
|
||||
dispatcher.provideFallbackReporter(fallbackReporter);
|
||||
dispatcher.addReporter(reporter);
|
||||
dispatcher.foo(123, 456, completeCallback);
|
||||
|
||||
expect(queueRunnerFactory).toHaveBeenCalledWith(jasmine.objectContaining({
|
||||
queueableFns: [{fn: jasmine.any(Function)}],
|
||||
isReporter: true
|
||||
}));
|
||||
|
||||
var fns = queueRunnerFactory.calls.mostRecent().args[0].queueableFns;
|
||||
fns[0].fn();
|
||||
expect(reporter.foo).toHaveBeenCalledWith(123, 456);
|
||||
expect(fallbackReporter.foo).not.toHaveBeenCalledWith(123, 456);
|
||||
});
|
||||
|
||||
it("allows registered reporters to be cleared", function() {
|
||||
var queueRunnerFactory = jasmine.createSpy('queueRunner'),
|
||||
dispatcher = new jasmineUnderTest.ReportDispatcher(['foo', 'bar'], queueRunnerFactory),
|
||||
reporter1 = jasmine.createSpyObj('reporter1', ['foo', 'bar']),
|
||||
reporter2 = jasmine.createSpyObj('reporter2', ['foo', 'bar']),
|
||||
completeCallback = jasmine.createSpy('complete');
|
||||
|
||||
dispatcher.addReporter(reporter1);
|
||||
dispatcher.foo(123, completeCallback);
|
||||
expect(queueRunnerFactory).toHaveBeenCalledWith(jasmine.objectContaining({
|
||||
queueableFns: [{fn: jasmine.any(Function)}],
|
||||
isReporter: true
|
||||
}));
|
||||
|
||||
var fns = queueRunnerFactory.calls.mostRecent().args[0].queueableFns;
|
||||
fns[0].fn();
|
||||
expect(reporter1.foo).toHaveBeenCalledWith(123);
|
||||
|
||||
dispatcher.clearReporters();
|
||||
dispatcher.addReporter(reporter2);
|
||||
dispatcher.bar(456, completeCallback);
|
||||
|
||||
expect(queueRunnerFactory).toHaveBeenCalledWith(jasmine.objectContaining({
|
||||
queueableFns: [{fn: jasmine.any(Function)}],
|
||||
isReporter: true
|
||||
}));
|
||||
|
||||
fns = queueRunnerFactory.calls.mostRecent().args[0].queueableFns;
|
||||
fns[0].fn();
|
||||
expect(reporter1.bar).not.toHaveBeenCalled();
|
||||
expect(reporter2.bar).toHaveBeenCalledWith(456);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,35 +1,39 @@
|
||||
describe("Spec", function() {
|
||||
|
||||
it("#isPendingSpecException returns true for a pending spec exception", function() {
|
||||
var e = new Error(j$.Spec.pendingSpecExceptionMessage);
|
||||
var e = new Error(jasmineUnderTest.Spec.pendingSpecExceptionMessage);
|
||||
|
||||
expect(j$.Spec.isPendingSpecException(e)).toBe(true);
|
||||
expect(jasmineUnderTest.Spec.isPendingSpecException(e)).toBe(true);
|
||||
});
|
||||
|
||||
it("#isPendingSpecException returns true for a pending spec exception (even when FF bug is present)", function() {
|
||||
var fakeError = {
|
||||
toString: function() { return "Error: " + j$.Spec.pendingSpecExceptionMessage; }
|
||||
toString: function() { return "Error: " + jasmineUnderTest.Spec.pendingSpecExceptionMessage; }
|
||||
};
|
||||
|
||||
expect(j$.Spec.isPendingSpecException(fakeError)).toBe(true);
|
||||
expect(jasmineUnderTest.Spec.isPendingSpecException(fakeError)).toBe(true);
|
||||
});
|
||||
|
||||
it("#isPendingSpecException returns true for a pending spec exception", function() {
|
||||
it("#isPendingSpecException returns true for a pending spec exception with a custom message", function() {
|
||||
expect(jasmineUnderTest.Spec.isPendingSpecException(jasmineUnderTest.Spec.pendingSpecExceptionMessage + 'foo')).toBe(true);
|
||||
});
|
||||
|
||||
it("#isPendingSpecException returns false for not a pending spec exception", function() {
|
||||
var e = new Error("foo");
|
||||
|
||||
expect(j$.Spec.isPendingSpecException(e)).toBe(false);
|
||||
expect(jasmineUnderTest.Spec.isPendingSpecException(e)).toBe(false);
|
||||
});
|
||||
|
||||
it("#isPendingSpecException returns false for thrown values that don't have toString", function() {
|
||||
expect(j$.Spec.isPendingSpecException(void 0)).toBe(false);
|
||||
expect(jasmineUnderTest.Spec.isPendingSpecException(void 0)).toBe(false);
|
||||
});
|
||||
|
||||
it("delegates execution to a QueueRunner", function() {
|
||||
var fakeQueueRunner = jasmine.createSpy('fakeQueueRunner'),
|
||||
spec = new j$.Spec({
|
||||
spec = new jasmineUnderTest.Spec({
|
||||
description: 'my test',
|
||||
id: 'some-id',
|
||||
fn: function() {},
|
||||
queueableFn: { fn: function() {} },
|
||||
queueRunnerFactory: fakeQueueRunner
|
||||
});
|
||||
|
||||
@@ -41,16 +45,17 @@ describe("Spec", function() {
|
||||
it("should call the start callback on execution", function() {
|
||||
var fakeQueueRunner = jasmine.createSpy('fakeQueueRunner'),
|
||||
startCallback = jasmine.createSpy('startCallback'),
|
||||
spec = new j$.Spec({
|
||||
spec = new jasmineUnderTest.Spec({
|
||||
id: 123,
|
||||
description: 'foo bar',
|
||||
fn: function() {},
|
||||
queueableFn: { fn: function() {} },
|
||||
onStart: startCallback,
|
||||
queueRunnerFactory: fakeQueueRunner
|
||||
});
|
||||
|
||||
spec.execute();
|
||||
|
||||
fakeQueueRunner.calls.mostRecent().args[0].queueableFns[0].fn();
|
||||
// TODO: due to some issue with the Pretty Printer, this line fails, but the other two pass.
|
||||
// This means toHaveBeenCalledWith on IE8 will always be broken.
|
||||
|
||||
@@ -65,8 +70,8 @@ describe("Spec", function() {
|
||||
startCallback = jasmine.createSpy('start-callback').and.callFake(function() {
|
||||
expect(beforesWereCalled).toBe(false);
|
||||
}),
|
||||
spec = new j$.Spec({
|
||||
fn: function() {},
|
||||
spec = new jasmineUnderTest.Spec({
|
||||
queueableFn: { fn: function() {} },
|
||||
beforeFns: function() {
|
||||
return [function() {
|
||||
beforesWereCalled = true
|
||||
@@ -78,6 +83,7 @@ describe("Spec", function() {
|
||||
|
||||
spec.execute();
|
||||
|
||||
fakeQueueRunner.calls.mostRecent().args[0].queueableFns[0].fn();
|
||||
expect(startCallback).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
@@ -85,25 +91,40 @@ describe("Spec", function() {
|
||||
var fakeQueueRunner = jasmine.createSpy('fakeQueueRunner'),
|
||||
before = jasmine.createSpy('before'),
|
||||
after = jasmine.createSpy('after'),
|
||||
fn = jasmine.createSpy('test body').and.callFake(function() {
|
||||
queueableFn = { fn: jasmine.createSpy('test body').and.callFake(function() {
|
||||
expect(before).toHaveBeenCalled();
|
||||
expect(after).not.toHaveBeenCalled();
|
||||
}),
|
||||
spec = new j$.Spec({
|
||||
fn: fn,
|
||||
beforeFns: function() {
|
||||
return [before]
|
||||
},
|
||||
afterFns: function() {
|
||||
return [after]
|
||||
}) },
|
||||
spec = new jasmineUnderTest.Spec({
|
||||
queueableFn: queueableFn,
|
||||
beforeAndAfterFns: function() {
|
||||
return {befores: [before], afters: [after]}
|
||||
},
|
||||
queueRunnerFactory: fakeQueueRunner
|
||||
});
|
||||
|
||||
spec.execute();
|
||||
|
||||
var allSpecFns = fakeQueueRunner.calls.mostRecent().args[0].fns;
|
||||
expect(allSpecFns).toEqual([before, fn, after]);
|
||||
var options = fakeQueueRunner.calls.mostRecent().args[0];
|
||||
expect(options.queueableFns).toEqual([{fn: jasmine.any(Function)}, before, queueableFn]);
|
||||
expect(options.cleanupFns).toEqual([after, {fn: jasmine.any(Function)}]);
|
||||
});
|
||||
|
||||
it("tells the queue runner that it's a leaf node", function() {
|
||||
var fakeQueueRunner = jasmine.createSpy('fakeQueueRunner'),
|
||||
spec = new jasmineUnderTest.Spec({
|
||||
queueableFn: { fn: function() {} },
|
||||
beforeAndAfterFns: function() {
|
||||
return {befores: [], afters: []}
|
||||
},
|
||||
queueRunnerFactory: fakeQueueRunner
|
||||
});
|
||||
|
||||
spec.execute();
|
||||
|
||||
expect(fakeQueueRunner).toHaveBeenCalledWith(jasmine.objectContaining({
|
||||
isLeaf: true
|
||||
}));
|
||||
});
|
||||
|
||||
it("is marked pending if created without a function body", function() {
|
||||
@@ -111,54 +132,59 @@ describe("Spec", function() {
|
||||
|
||||
startCallback = jasmine.createSpy('startCallback'),
|
||||
resultCallback = jasmine.createSpy('resultCallback'),
|
||||
spec = new j$.Spec({
|
||||
spec = new jasmineUnderTest.Spec({
|
||||
onStart: startCallback,
|
||||
fn: null,
|
||||
queueableFn: { fn: null },
|
||||
resultCallback: resultCallback,
|
||||
queueRunnerFactory: fakeQueueRunner
|
||||
});
|
||||
|
||||
|
||||
expect(spec.status()).toBe('pending');
|
||||
});
|
||||
|
||||
it("can be disabled, but still calls callbacks", function() {
|
||||
it("can be excluded at execution time by a parent", function() {
|
||||
var fakeQueueRunner = jasmine.createSpy('fakeQueueRunner'),
|
||||
startCallback = jasmine.createSpy('startCallback'),
|
||||
specBody = jasmine.createSpy('specBody'),
|
||||
resultCallback = jasmine.createSpy('resultCallback'),
|
||||
spec = new j$.Spec({
|
||||
spec = new jasmineUnderTest.Spec({
|
||||
onStart:startCallback,
|
||||
fn: specBody,
|
||||
queueableFn: { fn: specBody },
|
||||
resultCallback: resultCallback,
|
||||
queueRunnerFactory: fakeQueueRunner
|
||||
});
|
||||
|
||||
spec.disable();
|
||||
spec.execute('cally-back', true);
|
||||
|
||||
expect(spec.status()).toBe('disabled');
|
||||
|
||||
spec.execute();
|
||||
|
||||
expect(fakeQueueRunner).not.toHaveBeenCalled();
|
||||
expect(fakeQueueRunner).toHaveBeenCalledWith(jasmine.objectContaining({
|
||||
onComplete: jasmine.any(Function),
|
||||
queueableFns: [{fn: jasmine.any(Function)}],
|
||||
cleanupFns: [{fn: jasmine.any(Function)}]
|
||||
}));
|
||||
expect(specBody).not.toHaveBeenCalled();
|
||||
|
||||
var args = fakeQueueRunner.calls.mostRecent().args[0];
|
||||
args.queueableFns[0].fn();
|
||||
expect(startCallback).toHaveBeenCalled();
|
||||
args.cleanupFns[0].fn();
|
||||
expect(resultCallback).toHaveBeenCalled();
|
||||
|
||||
expect(spec.result.status).toBe('excluded');
|
||||
});
|
||||
|
||||
it("can be marked pending, but still calls callbacks when executed", function() {
|
||||
var fakeQueueRunner = jasmine.createSpy('fakeQueueRunner'),
|
||||
startCallback = jasmine.createSpy('startCallback'),
|
||||
resultCallback = jasmine.createSpy('resultCallback'),
|
||||
spec = new j$.Spec({
|
||||
spec = new jasmineUnderTest.Spec({
|
||||
onStart: startCallback,
|
||||
resultCallback: resultCallback,
|
||||
description: "with a spec",
|
||||
getSpecName: function() {
|
||||
return "a suite with a spec"
|
||||
},
|
||||
queueRunnerFactory: fakeQueueRunner
|
||||
queueRunnerFactory: fakeQueueRunner,
|
||||
queueableFn: { fn: null }
|
||||
});
|
||||
|
||||
spec.pend();
|
||||
@@ -167,23 +193,28 @@ describe("Spec", function() {
|
||||
|
||||
spec.execute();
|
||||
|
||||
expect(fakeQueueRunner).not.toHaveBeenCalled();
|
||||
expect(fakeQueueRunner).toHaveBeenCalled();
|
||||
|
||||
var args = fakeQueueRunner.calls.mostRecent().args[0];
|
||||
args.queueableFns[0].fn();
|
||||
expect(startCallback).toHaveBeenCalled();
|
||||
args.cleanupFns[0].fn('things');
|
||||
expect(resultCallback).toHaveBeenCalledWith({
|
||||
id: spec.id,
|
||||
status: 'pending',
|
||||
description: 'with a spec',
|
||||
fullName: 'a suite with a spec',
|
||||
failedExpectations: [],
|
||||
passedExpectations: []
|
||||
});
|
||||
passedExpectations: [],
|
||||
deprecationWarnings: [],
|
||||
pendingReason: ''
|
||||
}, 'things');
|
||||
});
|
||||
|
||||
it("should call the done callback on execution complete", function() {
|
||||
var done = jasmine.createSpy('done callback'),
|
||||
spec = new j$.Spec({
|
||||
fn: function() {},
|
||||
spec = new jasmineUnderTest.Spec({
|
||||
queueableFn: { fn: function() {} },
|
||||
catchExceptions: function() { return false; },
|
||||
resultCallback: function() {},
|
||||
queueRunnerFactory: function(attrs) { attrs.onComplete(); }
|
||||
@@ -194,30 +225,48 @@ describe("Spec", function() {
|
||||
expect(done).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("#status returns passing by default", function(){
|
||||
var spec = new j$.Spec({ fn: function () {} });
|
||||
expect(spec.status()).toBe("passed");
|
||||
it("should call the done callback with an error if the spec is failed", function() {
|
||||
var done = jasmine.createSpy('done callback'),
|
||||
spec = new jasmineUnderTest.Spec({
|
||||
queueableFn: { fn: function() {} },
|
||||
catchExceptions: function() { return false; },
|
||||
resultCallback: function() {},
|
||||
queueRunnerFactory: function(attrs) {
|
||||
spec.result.status = 'failed';
|
||||
attrs.onComplete();
|
||||
}
|
||||
});
|
||||
|
||||
spec.execute(done);
|
||||
|
||||
expect(done).toHaveBeenCalledWith(jasmine.any(jasmineUnderTest.StopExecutionError));
|
||||
});
|
||||
|
||||
it("#status returns passing by default", function() {
|
||||
var spec = new jasmineUnderTest.Spec({queueableFn: { fn: jasmine.createSpy("spec body")} });
|
||||
expect(spec.status()).toBe('passed');
|
||||
});
|
||||
|
||||
it("#status returns passed if all expectations in the spec have passed", function() {
|
||||
var spec = new j$.Spec({fn: jasmine.createSpy("spec body")});
|
||||
var spec = new jasmineUnderTest.Spec({queueableFn: { fn: jasmine.createSpy("spec body")} });
|
||||
spec.addExpectationResult(true);
|
||||
expect(spec.status()).toBe('passed');
|
||||
});
|
||||
|
||||
it("#status returns failed if any expectations in the spec have failed", function() {
|
||||
var spec = new j$.Spec({ fn: jasmine.createSpy("spec body") });
|
||||
var spec = new jasmineUnderTest.Spec({queueableFn: { fn: jasmine.createSpy("spec body") } });
|
||||
spec.addExpectationResult(true);
|
||||
spec.addExpectationResult(false);
|
||||
expect(spec.status()).toBe('failed');
|
||||
});
|
||||
|
||||
it("keeps track of passed and failed expectations", function() {
|
||||
var resultCallback = jasmine.createSpy('resultCallback'),
|
||||
spec = new j$.Spec({
|
||||
fn: jasmine.createSpy("spec body"),
|
||||
var fakeQueueRunner = jasmine.createSpy('queueRunner'),
|
||||
resultCallback = jasmine.createSpy('resultCallback'),
|
||||
spec = new jasmineUnderTest.Spec({
|
||||
queueableFn: { fn: jasmine.createSpy("spec body") },
|
||||
expectationResultFactory: function (data) { return data; },
|
||||
queueRunnerFactory: function(attrs) { attrs.onComplete(); },
|
||||
queueRunnerFactory: fakeQueueRunner,
|
||||
resultCallback: resultCallback
|
||||
});
|
||||
spec.addExpectationResult(true, 'expectation1');
|
||||
@@ -225,36 +274,134 @@ describe("Spec", function() {
|
||||
|
||||
spec.execute();
|
||||
|
||||
fakeQueueRunner.calls.mostRecent().args[0].cleanupFns[0].fn();
|
||||
expect(resultCallback.calls.first().args[0].passedExpectations).toEqual(['expectation1']);
|
||||
expect(resultCallback.calls.first().args[0].failedExpectations).toEqual(['expectation2']);
|
||||
});
|
||||
|
||||
it("throws an ExpectationFailed error upon receiving a failed expectation when 'throwOnExpectationFailure' is set", function() {
|
||||
var fakeQueueRunner = jasmine.createSpy('queueRunner'),
|
||||
resultCallback = jasmine.createSpy('resultCallback'),
|
||||
spec = new jasmineUnderTest.Spec({
|
||||
queueableFn: { fn: function() {} },
|
||||
expectationResultFactory: function(data) { return data; },
|
||||
queueRunnerFactory: fakeQueueRunner,
|
||||
resultCallback: resultCallback,
|
||||
throwOnExpectationFailure: true
|
||||
});
|
||||
|
||||
spec.addExpectationResult(true, 'passed');
|
||||
expect(function() {
|
||||
spec.addExpectationResult(false, 'failed')
|
||||
}).toThrowError(jasmineUnderTest.errors.ExpectationFailed);
|
||||
|
||||
spec.execute();
|
||||
|
||||
fakeQueueRunner.calls.mostRecent().args[0].cleanupFns[0].fn();
|
||||
expect(resultCallback.calls.first().args[0].passedExpectations).toEqual(['passed']);
|
||||
expect(resultCallback.calls.first().args[0].failedExpectations).toEqual(['failed']);
|
||||
});
|
||||
|
||||
it("does not throw an ExpectationFailed error when handling an error", function() {
|
||||
var resultCallback = jasmine.createSpy('resultCallback'),
|
||||
spec = new jasmineUnderTest.Spec({
|
||||
queueableFn: { fn: function() {} },
|
||||
expectationResultFactory: function(data) { return data; },
|
||||
queueRunnerFactory: function(attrs) { attrs.onComplete(); },
|
||||
resultCallback: resultCallback,
|
||||
throwOnExpectationFailure: true
|
||||
});
|
||||
|
||||
spec.onException('failing exception');
|
||||
});
|
||||
|
||||
it("can return its full name", function() {
|
||||
var specNameSpy = jasmine.createSpy('specNameSpy').and.returnValue('expected val');
|
||||
|
||||
var spec = new j$.Spec({
|
||||
getSpecName: specNameSpy
|
||||
var spec = new jasmineUnderTest.Spec({
|
||||
getSpecName: specNameSpy,
|
||||
queueableFn: { fn: null }
|
||||
});
|
||||
|
||||
expect(spec.getFullName()).toBe('expected val');
|
||||
expect(specNameSpy.calls.mostRecent().args[0].id).toEqual(spec.id);
|
||||
});
|
||||
|
||||
describe("when a spec is marked pending during execution", function() {
|
||||
describe("when a spec is marked pending during execution", function() {
|
||||
it("should mark the spec as pending", function() {
|
||||
var fakeQueueRunner = function(opts) {
|
||||
opts.onException(new Error(j$.Spec.pendingSpecExceptionMessage));
|
||||
opts.onException(new Error(jasmineUnderTest.Spec.pendingSpecExceptionMessage));
|
||||
},
|
||||
spec = new j$.Spec({
|
||||
spec = new jasmineUnderTest.Spec({
|
||||
description: 'my test',
|
||||
id: 'some-id',
|
||||
fn: function() { },
|
||||
queueableFn: { fn: function() { } },
|
||||
queueRunnerFactory: fakeQueueRunner
|
||||
});
|
||||
|
||||
spec.execute();
|
||||
|
||||
expect(spec.status()).toEqual("pending");
|
||||
expect(spec.result.pendingReason).toEqual('');
|
||||
});
|
||||
|
||||
it("should set the pendingReason", function() {
|
||||
var fakeQueueRunner = function(opts) {
|
||||
opts.onException(new Error(jasmineUnderTest.Spec.pendingSpecExceptionMessage + 'custom message'));
|
||||
},
|
||||
spec = new jasmineUnderTest.Spec({
|
||||
description: 'my test',
|
||||
id: 'some-id',
|
||||
queueableFn: { fn: function() { } },
|
||||
queueRunnerFactory: fakeQueueRunner
|
||||
});
|
||||
|
||||
spec.execute();
|
||||
|
||||
expect(spec.status()).toEqual("pending");
|
||||
expect(spec.result.pendingReason).toEqual('custom message');
|
||||
});
|
||||
});
|
||||
|
||||
it("should log a failure when handling an exception", function() {
|
||||
var fakeQueueRunner = jasmine.createSpy('queueRunner'),
|
||||
resultCallback = jasmine.createSpy('resultCallback'),
|
||||
spec = new jasmineUnderTest.Spec({
|
||||
queueableFn: { fn: function() {} },
|
||||
expectationResultFactory: function(data) { return data; },
|
||||
queueRunnerFactory: fakeQueueRunner,
|
||||
resultCallback: resultCallback
|
||||
});
|
||||
|
||||
spec.onException('foo');
|
||||
spec.execute();
|
||||
|
||||
var args = fakeQueueRunner.calls.mostRecent().args[0];
|
||||
args.cleanupFns[0].fn();
|
||||
expect(resultCallback.calls.first().args[0].failedExpectations).toEqual([{
|
||||
error: 'foo',
|
||||
matcherName: '',
|
||||
passed: false,
|
||||
expected: '',
|
||||
actual: ''
|
||||
}]);
|
||||
});
|
||||
|
||||
it("should not log an additional failure when handling an ExpectationFailed error", function() {
|
||||
var fakeQueueRunner = jasmine.createSpy('queueRunner'),
|
||||
resultCallback = jasmine.createSpy('resultCallback'),
|
||||
spec = new jasmineUnderTest.Spec({
|
||||
queueableFn: { fn: function() {} },
|
||||
expectationResultFactory: function(data) { return data; },
|
||||
queueRunnerFactory: fakeQueueRunner,
|
||||
resultCallback: resultCallback
|
||||
});
|
||||
|
||||
spec.onException(new jasmineUnderTest.errors.ExpectationFailed());
|
||||
spec.execute();
|
||||
|
||||
var args = fakeQueueRunner.calls.mostRecent().args[0];
|
||||
args.cleanupFns[0].fn();
|
||||
expect(resultCallback.calls.first().args[0].failedExpectations).toEqual([]);
|
||||
});
|
||||
});
|
||||
|
||||
364
spec/core/SpyRegistrySpec.js
Normal file
364
spec/core/SpyRegistrySpec.js
Normal file
@@ -0,0 +1,364 @@
|
||||
describe("SpyRegistry", function() {
|
||||
function createSpy(name, originalFn) {
|
||||
return jasmineUnderTest.Spy(name, originalFn);
|
||||
}
|
||||
|
||||
describe("#spyOn", function() {
|
||||
it("checks for the existence of the object", function() {
|
||||
var spyRegistry = new jasmineUnderTest.SpyRegistry({createSpy: createSpy});
|
||||
expect(function() {
|
||||
spyRegistry.spyOn(void 0, 'pants');
|
||||
}).toThrowError(/could not find an object/);
|
||||
});
|
||||
|
||||
it("checks that a method name was passed", function() {
|
||||
var spyRegistry = new jasmineUnderTest.SpyRegistry(),
|
||||
subject = {};
|
||||
|
||||
expect(function() {
|
||||
spyRegistry.spyOn(subject);
|
||||
}).toThrowError(/No method name supplied/);
|
||||
});
|
||||
|
||||
it("checks that the object is not `null`", function() {
|
||||
var spyRegistry = new jasmineUnderTest.SpyRegistry();
|
||||
expect(function() {
|
||||
spyRegistry.spyOn(null, 'pants');
|
||||
}).toThrowError(/could not find an object/);
|
||||
});
|
||||
|
||||
it("checks that the method name is not `null`", function() {
|
||||
var spyRegistry = new jasmineUnderTest.SpyRegistry(),
|
||||
subject = {};
|
||||
|
||||
expect(function() {
|
||||
spyRegistry.spyOn(subject, null);
|
||||
}).toThrowError(/No method name supplied/);
|
||||
});
|
||||
|
||||
it("checks for the existence of the method", function() {
|
||||
var spyRegistry = new jasmineUnderTest.SpyRegistry(),
|
||||
subject = {};
|
||||
|
||||
expect(function() {
|
||||
spyRegistry.spyOn(subject, 'pants');
|
||||
}).toThrowError(/method does not exist/);
|
||||
});
|
||||
|
||||
it("checks if it has already been spied upon", function() {
|
||||
var spies = [],
|
||||
spyRegistry = new jasmineUnderTest.SpyRegistry({
|
||||
currentSpies: function() { return spies; },
|
||||
createSpy: createSpy
|
||||
}),
|
||||
subject = { spiedFunc: function() {} };
|
||||
|
||||
spyRegistry.spyOn(subject, 'spiedFunc');
|
||||
|
||||
expect(function() {
|
||||
spyRegistry.spyOn(subject, 'spiedFunc');
|
||||
}).toThrowError(/has already been spied upon/);
|
||||
});
|
||||
|
||||
it("checks if it can be spied upon", function() {
|
||||
var scope = {};
|
||||
|
||||
function myFunc() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
Object.defineProperty(scope, 'myFunc', {
|
||||
get: function() {
|
||||
return myFunc;
|
||||
}
|
||||
});
|
||||
|
||||
var spies = [],
|
||||
spyRegistry = new jasmineUnderTest.SpyRegistry({currentSpies: function() { return spies; }}),
|
||||
subject = { spiedFunc: scope.myFunc };
|
||||
|
||||
expect(function() {
|
||||
spyRegistry.spyOn(scope, 'myFunc');
|
||||
}).toThrowError(/is not declared writable or has no setter/);
|
||||
|
||||
expect(function() {
|
||||
spyRegistry.spyOn(subject, 'spiedFunc');
|
||||
}).not.toThrowError(/is not declared writable or has no setter/);
|
||||
});
|
||||
|
||||
it("overrides the method on the object and returns the spy", function() {
|
||||
var originalFunctionWasCalled = false,
|
||||
spyRegistry = new jasmineUnderTest.SpyRegistry({createSpy: createSpy}),
|
||||
subject = { spiedFunc: function() { originalFunctionWasCalled = true; } };
|
||||
|
||||
var spy = spyRegistry.spyOn(subject, 'spiedFunc');
|
||||
|
||||
expect(subject.spiedFunc).toEqual(spy);
|
||||
});
|
||||
});
|
||||
|
||||
describe("#spyOnProperty", function() {
|
||||
it("checks for the existence of the object", function() {
|
||||
var spyRegistry = new jasmineUnderTest.SpyRegistry();
|
||||
expect(function() {
|
||||
spyRegistry.spyOnProperty(void 0, 'pants');
|
||||
}).toThrowError(/could not find an object/);
|
||||
});
|
||||
|
||||
it("checks that a property name was passed", function() {
|
||||
var spyRegistry = new jasmineUnderTest.SpyRegistry(),
|
||||
subject = {};
|
||||
|
||||
expect(function() {
|
||||
spyRegistry.spyOnProperty(subject);
|
||||
}).toThrowError(/No property name supplied/);
|
||||
});
|
||||
|
||||
it("checks for the existence of the method", function() {
|
||||
var spyRegistry = new jasmineUnderTest.SpyRegistry(),
|
||||
subject = {};
|
||||
|
||||
expect(function() {
|
||||
spyRegistry.spyOnProperty(subject, 'pants');
|
||||
}).toThrowError(/property does not exist/);
|
||||
});
|
||||
|
||||
it("checks for the existence of access type", function() {
|
||||
var spyRegistry = new jasmineUnderTest.SpyRegistry(),
|
||||
subject = {};
|
||||
|
||||
Object.defineProperty(subject, 'pants', {
|
||||
get: function() { return 1; },
|
||||
configurable: true
|
||||
});
|
||||
|
||||
expect(function() {
|
||||
spyRegistry.spyOnProperty(subject, 'pants', 'set');
|
||||
}).toThrowError(/does not have access type/);
|
||||
});
|
||||
|
||||
it("checks if it has already been spied upon", function() {
|
||||
var spyRegistry = new jasmineUnderTest.SpyRegistry({createSpy: createSpy}),
|
||||
subject = {};
|
||||
|
||||
Object.defineProperty(subject, 'spiedProp', {
|
||||
get: function() { return 1; },
|
||||
configurable: true
|
||||
});
|
||||
|
||||
spyRegistry.spyOnProperty(subject, 'spiedProp');
|
||||
|
||||
expect(function() {
|
||||
spyRegistry.spyOnProperty(subject, 'spiedProp');
|
||||
}).toThrowError(/has already been spied upon/);
|
||||
});
|
||||
|
||||
it("checks if it can be spied upon", function() {
|
||||
var subject = {};
|
||||
|
||||
Object.defineProperty(subject, 'myProp', {
|
||||
get: function() {}
|
||||
});
|
||||
|
||||
Object.defineProperty(subject, 'spiedProp', {
|
||||
get: function() {},
|
||||
configurable: true
|
||||
});
|
||||
|
||||
var spyRegistry = new jasmineUnderTest.SpyRegistry();
|
||||
|
||||
expect(function() {
|
||||
spyRegistry.spyOnProperty(subject, 'myProp');
|
||||
}).toThrowError(/is not declared configurable/);
|
||||
|
||||
expect(function() {
|
||||
spyRegistry.spyOnProperty(subject, 'spiedProp');
|
||||
}).not.toThrowError(/is not declared configurable/);
|
||||
});
|
||||
|
||||
it("overrides the property getter on the object and returns the spy", function() {
|
||||
var spyRegistry = new jasmineUnderTest.SpyRegistry({createSpy: createSpy}),
|
||||
subject = {},
|
||||
returnValue = 1;
|
||||
|
||||
Object.defineProperty(subject, 'spiedProperty', {
|
||||
get: function() { return returnValue; },
|
||||
configurable: true
|
||||
});
|
||||
|
||||
expect(subject.spiedProperty).toEqual(returnValue);
|
||||
|
||||
var spy = spyRegistry.spyOnProperty(subject, 'spiedProperty');
|
||||
var getter = Object.getOwnPropertyDescriptor(subject, 'spiedProperty').get;
|
||||
|
||||
expect(getter).toEqual(spy);
|
||||
expect(subject.spiedProperty).toBeUndefined();
|
||||
});
|
||||
|
||||
it("overrides the property setter on the object and returns the spy", function() {
|
||||
var spyRegistry = new jasmineUnderTest.SpyRegistry({createSpy: createSpy}),
|
||||
subject = {},
|
||||
returnValue = 1;
|
||||
|
||||
Object.defineProperty(subject, 'spiedProperty', {
|
||||
get: function() { return returnValue; },
|
||||
set: function() {},
|
||||
configurable: true
|
||||
});
|
||||
|
||||
var spy = spyRegistry.spyOnProperty(subject, 'spiedProperty', 'set');
|
||||
var setter = Object.getOwnPropertyDescriptor(subject, 'spiedProperty').set;
|
||||
|
||||
expect(subject.spiedProperty).toEqual(returnValue);
|
||||
expect(setter).toEqual(spy);
|
||||
});
|
||||
});
|
||||
|
||||
describe("#clearSpies", function() {
|
||||
it("restores the original functions on the spied-upon objects", function() {
|
||||
var spies = [],
|
||||
spyRegistry = new jasmineUnderTest.SpyRegistry({
|
||||
currentSpies: function() { return spies; },
|
||||
createSpy: createSpy
|
||||
}),
|
||||
originalFunction = function() {},
|
||||
subject = { spiedFunc: originalFunction };
|
||||
|
||||
spyRegistry.spyOn(subject, 'spiedFunc');
|
||||
spyRegistry.clearSpies();
|
||||
|
||||
expect(subject.spiedFunc).toBe(originalFunction);
|
||||
});
|
||||
|
||||
it("restores the original functions, even when that spy has been replace and re-spied upon", function() {
|
||||
var spies = [],
|
||||
spyRegistry = new jasmineUnderTest.SpyRegistry({
|
||||
currentSpies: function() { return spies; },
|
||||
createSpy: createSpy
|
||||
}),
|
||||
originalFunction = function() {},
|
||||
subject = { spiedFunc: originalFunction };
|
||||
|
||||
spyRegistry.spyOn(subject, 'spiedFunc');
|
||||
|
||||
// replace the original spy with some other function
|
||||
subject.spiedFunc = function() {};
|
||||
|
||||
// spy on the function in that location again
|
||||
spyRegistry.spyOn(subject, 'spiedFunc');
|
||||
|
||||
spyRegistry.clearSpies();
|
||||
|
||||
expect(subject.spiedFunc).toBe(originalFunction);
|
||||
});
|
||||
|
||||
it("does not add a property that the spied-upon object didn't originally have", function() {
|
||||
var spies = [],
|
||||
spyRegistry = new jasmineUnderTest.SpyRegistry({
|
||||
currentSpies: function() { return spies; },
|
||||
createSpy: createSpy
|
||||
}),
|
||||
originalFunction = function() {},
|
||||
subjectParent = {spiedFunc: originalFunction};
|
||||
|
||||
var subject = Object.create(subjectParent);
|
||||
|
||||
expect(subject.hasOwnProperty('spiedFunc')).toBe(false);
|
||||
|
||||
spyRegistry.spyOn(subject, 'spiedFunc');
|
||||
spyRegistry.clearSpies();
|
||||
|
||||
expect(subject.hasOwnProperty('spiedFunc')).toBe(false);
|
||||
expect(subject.spiedFunc).toBe(originalFunction);
|
||||
});
|
||||
|
||||
it("restores the original function when it\'s inherited and cannot be deleted", function() {
|
||||
var spies = [],
|
||||
spyRegistry = new jasmineUnderTest.SpyRegistry({
|
||||
currentSpies: function() { return spies; },
|
||||
createSpy: createSpy
|
||||
}),
|
||||
originalFunction = function() {},
|
||||
subjectParent = {spiedFunc: originalFunction};
|
||||
|
||||
var subject = Object.create(subjectParent);
|
||||
|
||||
spyRegistry.spyOn(subject, 'spiedFunc');
|
||||
|
||||
// simulate a spy that cannot be deleted
|
||||
Object.defineProperty(subject, 'spiedFunc', {
|
||||
configurable: false
|
||||
});
|
||||
|
||||
spyRegistry.clearSpies();
|
||||
|
||||
expect(jasmineUnderTest.isSpy(subject.spiedFunc)).toBe(false);
|
||||
});
|
||||
|
||||
it("restores window.onerror by overwriting, not deleting", function() {
|
||||
function FakeWindow() {
|
||||
}
|
||||
FakeWindow.prototype.onerror = function() {};
|
||||
|
||||
var spies = [],
|
||||
global = new FakeWindow(),
|
||||
spyRegistry = new jasmineUnderTest.SpyRegistry({
|
||||
currentSpies: function() { return spies; },
|
||||
createSpy: createSpy,
|
||||
global: global
|
||||
});
|
||||
|
||||
spyRegistry.spyOn(global, 'onerror');
|
||||
spyRegistry.clearSpies();
|
||||
expect(global.onerror).toBe(FakeWindow.prototype.onerror);
|
||||
expect(global.hasOwnProperty('onerror')).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe('spying on properties', function() {
|
||||
it("restores the original properties on the spied-upon objects", function() {
|
||||
var spies = [],
|
||||
spyRegistry = new jasmineUnderTest.SpyRegistry({
|
||||
currentSpies: function() { return spies; },
|
||||
createSpy: createSpy
|
||||
}),
|
||||
originalReturn = 1,
|
||||
subject = {};
|
||||
|
||||
Object.defineProperty(subject, 'spiedProp', {
|
||||
get: function() { return originalReturn; },
|
||||
configurable: true
|
||||
});
|
||||
|
||||
spyRegistry.spyOnProperty(subject, 'spiedProp');
|
||||
spyRegistry.clearSpies();
|
||||
|
||||
expect(subject.spiedProp).toBe(originalReturn);
|
||||
});
|
||||
|
||||
it("does not add a property that the spied-upon object didn't originally have", function() {
|
||||
var spies = [],
|
||||
spyRegistry = new jasmineUnderTest.SpyRegistry({
|
||||
currentSpies: function() { return spies; },
|
||||
createSpy: createSpy
|
||||
}),
|
||||
originalReturn = 1,
|
||||
subjectParent = {};
|
||||
|
||||
Object.defineProperty(subjectParent, 'spiedProp', {
|
||||
get: function() { return originalReturn; },
|
||||
configurable: true
|
||||
});
|
||||
|
||||
var subject = Object.create(subjectParent);
|
||||
|
||||
expect(subject.hasOwnProperty('spiedProp')).toBe(false);
|
||||
|
||||
spyRegistry.spyOnProperty(subject, 'spiedProp');
|
||||
spyRegistry.clearSpies();
|
||||
|
||||
expect(subject.hasOwnProperty('spiedProp')).toBe(false);
|
||||
expect(subject.spiedProp).toBe(originalReturn);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1,4 +1,10 @@
|
||||
describe('Spies', function () {
|
||||
var env;
|
||||
|
||||
beforeEach(function() {
|
||||
env = new jasmineUnderTest.Env();
|
||||
});
|
||||
|
||||
describe("createSpy", function() {
|
||||
var TestClass;
|
||||
|
||||
@@ -7,9 +13,9 @@ describe('Spies', function () {
|
||||
TestClass.prototype.someFunction = function() {};
|
||||
TestClass.prototype.someFunction.bob = "test";
|
||||
});
|
||||
|
||||
|
||||
it("preserves the properties of the spied function", function() {
|
||||
var spy = j$.createSpy(TestClass.prototype, TestClass.prototype.someFunction);
|
||||
var spy = env.createSpy(TestClass.prototype, TestClass.prototype.someFunction);
|
||||
|
||||
expect(spy.bob).toEqual("test");
|
||||
});
|
||||
@@ -18,19 +24,19 @@ describe('Spies', function () {
|
||||
TestClass.prototype.someFunction.and = "turkey";
|
||||
|
||||
expect(function() {
|
||||
j$.createSpy(TestClass.prototype, TestClass.prototype.someFunction);
|
||||
env.createSpy(TestClass.prototype, TestClass.prototype.someFunction);
|
||||
}).toThrowError("Jasmine spies would overwrite the 'and' and 'calls' properties on the object being spied upon");
|
||||
});
|
||||
|
||||
it("adds a spyStrategy and callTracker to the spy", function() {
|
||||
var spy = j$.createSpy(TestClass.prototype, TestClass.prototype.someFunction);
|
||||
var spy = env.createSpy(TestClass.prototype, TestClass.prototype.someFunction);
|
||||
|
||||
expect(spy.and).toEqual(jasmine.any(j$.SpyStrategy));
|
||||
expect(spy.calls).toEqual(jasmine.any(j$.CallTracker));
|
||||
expect(spy.and).toEqual(jasmine.any(jasmineUnderTest.SpyStrategy));
|
||||
expect(spy.calls).toEqual(jasmine.any(jasmineUnderTest.CallTracker));
|
||||
});
|
||||
|
||||
it("tracks the argument of calls", function () {
|
||||
var spy = j$.createSpy(TestClass.prototype, TestClass.prototype.someFunction);
|
||||
var spy = env.createSpy(TestClass.prototype, TestClass.prototype.someFunction);
|
||||
var trackSpy = spyOn(spy.calls, "track");
|
||||
|
||||
spy("arg");
|
||||
@@ -39,7 +45,7 @@ describe('Spies', function () {
|
||||
});
|
||||
|
||||
it("tracks the context of calls", function () {
|
||||
var spy = j$.createSpy(TestClass.prototype, TestClass.prototype.someFunction);
|
||||
var spy = env.createSpy(TestClass.prototype, TestClass.prototype.someFunction);
|
||||
var trackSpy = spyOn(spy.calls, "track");
|
||||
|
||||
var contextObject = { spyMethod: spy };
|
||||
@@ -47,21 +53,125 @@ describe('Spies', function () {
|
||||
|
||||
expect(trackSpy.calls.mostRecent().args[0].object).toEqual(contextObject);
|
||||
});
|
||||
|
||||
it("tracks the return value of calls", function () {
|
||||
var spy = env.createSpy(TestClass.prototype, TestClass.prototype.someFunction);
|
||||
var trackSpy = spyOn(spy.calls, "track");
|
||||
|
||||
spy.and.returnValue("return value");
|
||||
spy();
|
||||
|
||||
expect(trackSpy.calls.mostRecent().args[0].returnValue).toEqual("return value");
|
||||
});
|
||||
|
||||
it("preserves arity of original function", function () {
|
||||
var functions = [
|
||||
function nullary () {},
|
||||
function unary (arg) {},
|
||||
function binary (arg1, arg2) {},
|
||||
function ternary (arg1, arg2, arg3) {},
|
||||
function quaternary (arg1, arg2, arg3, arg4) {},
|
||||
function quinary (arg1, arg2, arg3, arg4, arg5) {},
|
||||
function senary (arg1, arg2, arg3, arg4, arg5, arg6) {}
|
||||
];
|
||||
|
||||
for (var arity = 0; arity < functions.length; arity++) {
|
||||
var someFunction = functions[arity],
|
||||
spy = env.createSpy(someFunction.name, someFunction);
|
||||
|
||||
expect(spy.length).toEqual(arity);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
describe("createSpyObj", function() {
|
||||
it("should create an object with a bunch of spy methods when you call jasmine.createSpyObj()", function() {
|
||||
var spyObj = j$.createSpyObj('BaseName', ['method1', 'method2']);
|
||||
it("should create an object with spy methods and corresponding return values when you call jasmine.createSpyObj() with an object", function () {
|
||||
var spyObj = env.createSpyObj('BaseName', {'method1': 42, 'method2': 'special sauce' });
|
||||
|
||||
expect(spyObj).toEqual({ method1: jasmine.any(Function), method2: jasmine.any(Function)});
|
||||
expect(spyObj.method1.and.identity()).toEqual('BaseName.method1');
|
||||
expect(spyObj.method2.and.identity()).toEqual('BaseName.method2');
|
||||
expect(spyObj.method1()).toEqual(42);
|
||||
expect(spyObj.method1.and.identity).toEqual('BaseName.method1');
|
||||
|
||||
expect(spyObj.method2()).toEqual('special sauce');
|
||||
expect(spyObj.method2.and.identity).toEqual('BaseName.method2');
|
||||
});
|
||||
|
||||
it("should throw if you do not pass an array argument", function() {
|
||||
|
||||
it("should create an object with a bunch of spy methods when you call jasmine.createSpyObj()", function() {
|
||||
var spyObj = env.createSpyObj('BaseName', ['method1', 'method2']);
|
||||
|
||||
expect(spyObj).toEqual({ method1: jasmine.any(Function), method2: jasmine.any(Function)});
|
||||
expect(spyObj.method1.and.identity).toEqual('BaseName.method1');
|
||||
expect(spyObj.method2.and.identity).toEqual('BaseName.method2');
|
||||
});
|
||||
|
||||
it("should allow you to omit the baseName", function() {
|
||||
var spyObj = env.createSpyObj(['method1', 'method2']);
|
||||
|
||||
expect(spyObj).toEqual({ method1: jasmine.any(Function), method2: jasmine.any(Function)});
|
||||
expect(spyObj.method1.and.identity).toEqual('unknown.method1');
|
||||
expect(spyObj.method2.and.identity).toEqual('unknown.method2');
|
||||
});
|
||||
|
||||
it("should throw if you do not pass an array or object argument", function() {
|
||||
expect(function() {
|
||||
j$.createSpyObj('BaseName');
|
||||
}).toThrow("createSpyObj requires a non-empty array of method names to create spies for");
|
||||
env.createSpyObj('BaseName');
|
||||
}).toThrow("createSpyObj requires a non-empty array or object of method names to create spies for");
|
||||
});
|
||||
|
||||
it("should throw if you pass an empty array argument", function() {
|
||||
expect(function() {
|
||||
env.createSpyObj('BaseName', []);
|
||||
}).toThrow("createSpyObj requires a non-empty array or object of method names to create spies for");
|
||||
});
|
||||
|
||||
it("should throw if you pass an empty object argument", function() {
|
||||
expect(function() {
|
||||
env.createSpyObj('BaseName', {});
|
||||
}).toThrow("createSpyObj requires a non-empty array or object of method names to create spies for");
|
||||
});
|
||||
});
|
||||
|
||||
it("can use different strategies for different arguments", function() {
|
||||
var spy = env.createSpy('foo');
|
||||
spy.and.returnValue(42);
|
||||
spy.withArgs('baz', 'grault').and.returnValue(-1);
|
||||
spy.withArgs('thud').and.returnValue('bob');
|
||||
|
||||
expect(spy('foo')).toEqual(42);
|
||||
expect(spy('baz', 'grault')).toEqual(-1);
|
||||
expect(spy('thud')).toEqual('bob');
|
||||
expect(spy('baz', 'grault', 'waldo')).toEqual(42);
|
||||
});
|
||||
|
||||
it("uses custom equality testers when selecting a strategy", function() {
|
||||
var spy = env.createSpy('foo');
|
||||
spy.and.returnValue(42);
|
||||
spy.withArgs(jasmineUnderTest.any(String)).and.returnValue(-1);
|
||||
|
||||
expect(spy('foo')).toEqual(-1);
|
||||
expect(spy({})).toEqual(42);
|
||||
});
|
||||
|
||||
it("can reconfigure an argument-specific strategy", function() {
|
||||
var spy = env.createSpy('foo');
|
||||
spy.withArgs('foo').and.returnValue(42);
|
||||
spy.withArgs('foo').and.returnValue(17);
|
||||
expect(spy('foo')).toEqual(17);
|
||||
});
|
||||
|
||||
describe("When withArgs is used without a base strategy", function() {
|
||||
it("uses the matching strategy", function() {
|
||||
var spy = env.createSpy('foo');
|
||||
spy.withArgs('baz').and.returnValue(-1);
|
||||
|
||||
expect(spy('baz')).toEqual(-1);
|
||||
});
|
||||
|
||||
it("throws if the args don't match", function() {
|
||||
var spy = env.createSpy('foo');
|
||||
spy.withArgs('bar').and.returnValue(-1);
|
||||
|
||||
expect(function() { spy('baz', {qux: 42}); }).toThrowError('Spy \'foo\' receieved a call with arguments [ \'baz\', Object({ qux: 42 }) ] but all configured strategies specify other arguments.');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
describe("SpyStrategy", function() {
|
||||
|
||||
it("defaults its name to unknown", function() {
|
||||
var spyStrategy = new j$.SpyStrategy();
|
||||
var spyStrategy = new jasmineUnderTest.SpyStrategy();
|
||||
|
||||
expect(spyStrategy.identity()).toEqual("unknown");
|
||||
expect(spyStrategy.identity).toEqual("unknown");
|
||||
});
|
||||
|
||||
it("takes a name", function() {
|
||||
var spyStrategy = new j$.SpyStrategy({name: "foo"});
|
||||
var spyStrategy = new jasmineUnderTest.SpyStrategy({name: "foo"});
|
||||
|
||||
expect(spyStrategy.identity()).toEqual("foo");
|
||||
expect(spyStrategy.identity).toEqual("foo");
|
||||
});
|
||||
|
||||
it("stubs an original function, if provided", function() {
|
||||
var originalFn = jasmine.createSpy("original"),
|
||||
spyStrategy = new j$.SpyStrategy({fn: originalFn});
|
||||
spyStrategy = new jasmineUnderTest.SpyStrategy({fn: originalFn});
|
||||
|
||||
spyStrategy.exec();
|
||||
|
||||
@@ -23,11 +23,11 @@ describe("SpyStrategy", function() {
|
||||
|
||||
it("allows an original function to be called, passed through the params and returns it's value", function() {
|
||||
var originalFn = jasmine.createSpy("original").and.returnValue(42),
|
||||
spyStrategy = new j$.SpyStrategy({fn: originalFn}),
|
||||
spyStrategy = new jasmineUnderTest.SpyStrategy({fn: originalFn}),
|
||||
returnValue;
|
||||
|
||||
spyStrategy.callThrough();
|
||||
returnValue = spyStrategy.exec("foo");
|
||||
returnValue = spyStrategy.exec(null, ["foo"]);
|
||||
|
||||
expect(originalFn).toHaveBeenCalled();
|
||||
expect(originalFn.calls.mostRecent().args).toEqual(["foo"]);
|
||||
@@ -36,7 +36,7 @@ describe("SpyStrategy", function() {
|
||||
|
||||
it("can return a specified value when executed", function() {
|
||||
var originalFn = jasmine.createSpy("original"),
|
||||
spyStrategy = new j$.SpyStrategy({fn: originalFn}),
|
||||
spyStrategy = new jasmineUnderTest.SpyStrategy({fn: originalFn}),
|
||||
returnValue;
|
||||
|
||||
spyStrategy.returnValue(17);
|
||||
@@ -46,9 +46,22 @@ describe("SpyStrategy", function() {
|
||||
expect(returnValue).toEqual(17);
|
||||
});
|
||||
|
||||
it("can return specified values in order specified when executed", function() {
|
||||
var originalFn = jasmine.createSpy("original"),
|
||||
spyStrategy = new jasmineUnderTest.SpyStrategy({fn: originalFn});
|
||||
|
||||
spyStrategy.returnValues('value1', 'value2', 'value3');
|
||||
|
||||
expect(spyStrategy.exec()).toEqual('value1');
|
||||
expect(spyStrategy.exec()).toEqual('value2');
|
||||
expect(spyStrategy.exec()).toBe('value3');
|
||||
expect(spyStrategy.exec()).toBeUndefined();
|
||||
expect(originalFn).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("allows an exception to be thrown when executed", function() {
|
||||
var originalFn = jasmine.createSpy("original"),
|
||||
spyStrategy = new j$.SpyStrategy({fn: originalFn});
|
||||
spyStrategy = new jasmineUnderTest.SpyStrategy({fn: originalFn});
|
||||
|
||||
spyStrategy.throwError(new TypeError("bar"));
|
||||
|
||||
@@ -58,7 +71,7 @@ describe("SpyStrategy", function() {
|
||||
|
||||
it("allows a non-Error to be thrown, wrapping it into an exception when executed", function() {
|
||||
var originalFn = jasmine.createSpy("original"),
|
||||
spyStrategy = new j$.SpyStrategy({fn: originalFn});
|
||||
spyStrategy = new jasmineUnderTest.SpyStrategy({fn: originalFn});
|
||||
|
||||
spyStrategy.throwError("bar");
|
||||
|
||||
@@ -69,7 +82,7 @@ describe("SpyStrategy", function() {
|
||||
it("allows a fake function to be called instead", function() {
|
||||
var originalFn = jasmine.createSpy("original"),
|
||||
fakeFn = jasmine.createSpy("fake").and.returnValue(67),
|
||||
spyStrategy = new j$.SpyStrategy({fn: originalFn}),
|
||||
spyStrategy = new jasmineUnderTest.SpyStrategy({fn: originalFn}),
|
||||
returnValue;
|
||||
|
||||
spyStrategy.callFake(fakeFn);
|
||||
@@ -79,10 +92,88 @@ describe("SpyStrategy", function() {
|
||||
expect(returnValue).toEqual(67);
|
||||
});
|
||||
|
||||
it("allows a fake async function to be called instead", function(done) {
|
||||
jasmine.getEnv().requireAsyncAwait();
|
||||
var originalFn = jasmine.createSpy("original"),
|
||||
fakeFn = jasmine.createSpy("fake").and.callFake(eval("async () => { return 67; }")),
|
||||
spyStrategy = new jasmineUnderTest.SpyStrategy({fn: originalFn}),
|
||||
returnValue;
|
||||
|
||||
spyStrategy.callFake(fakeFn);
|
||||
spyStrategy.exec().then(function (returnValue) {
|
||||
expect(originalFn).not.toHaveBeenCalled();
|
||||
expect(fakeFn).toHaveBeenCalled();
|
||||
expect(returnValue).toEqual(67);
|
||||
done();
|
||||
}).catch(function (err) {
|
||||
done.fail(err);
|
||||
})
|
||||
});
|
||||
|
||||
it("allows a custom strategy to be used", function() {
|
||||
var plan = jasmine.createSpy('custom strategy')
|
||||
.and.returnValue('custom strategy result'),
|
||||
customStrategy = jasmine.createSpy('custom strategy')
|
||||
.and.returnValue(plan),
|
||||
originalFn = jasmine.createSpy('original'),
|
||||
spyStrategy = new jasmineUnderTest.SpyStrategy({
|
||||
fn: originalFn,
|
||||
customStrategies: {
|
||||
doSomething: customStrategy
|
||||
}
|
||||
});
|
||||
|
||||
spyStrategy.doSomething(1, 2, 3);
|
||||
expect(customStrategy).toHaveBeenCalledWith(1, 2, 3);
|
||||
expect(spyStrategy.exec(null, ['some', 'args']))
|
||||
.toEqual('custom strategy result');
|
||||
expect(plan).toHaveBeenCalledWith('some', 'args');
|
||||
});
|
||||
|
||||
it("throws an error if a custom strategy doesn't return a function", function() {
|
||||
var originalFn = jasmine.createSpy('original'),
|
||||
spyStrategy = new jasmineUnderTest.SpyStrategy({
|
||||
fn: originalFn,
|
||||
customStrategies: {
|
||||
doSomething: function() { return 'not a function' }
|
||||
}
|
||||
});
|
||||
|
||||
expect(function() { spyStrategy.doSomething(1, 2, 3) }).toThrowError('Spy strategy must return a function');
|
||||
});
|
||||
|
||||
it("does not allow custom strategies to overwrite existing methods", function() {
|
||||
var spyStrategy = new jasmineUnderTest.SpyStrategy({
|
||||
fn: function() {},
|
||||
customStrategies: {
|
||||
exec: function() {}
|
||||
}
|
||||
});
|
||||
|
||||
expect(spyStrategy.exec).toBe(jasmineUnderTest.SpyStrategy.prototype.exec);
|
||||
});
|
||||
|
||||
it('throws an error when a non-function is passed to callFake strategy', function() {
|
||||
var originalFn = jasmine.createSpy('original'),
|
||||
spyStrategy = new jasmineUnderTest.SpyStrategy({fn: originalFn}),
|
||||
invalidFakes = [5, 'foo', {}, true, false, null, void 0, new Date(), /.*/];
|
||||
|
||||
spyOn(jasmineUnderTest, 'isFunction_').and.returnValue(false);
|
||||
spyOn(jasmineUnderTest, 'isAsyncFunction_').and.returnValue(false);
|
||||
|
||||
expect(function () {
|
||||
spyStrategy.callFake(function() {});
|
||||
}).toThrowError(/^Argument passed to callFake should be a function, got/);
|
||||
|
||||
expect(function () {
|
||||
spyStrategy.callFake(function() {});
|
||||
}).toThrowError(/^Argument passed to callFake should be a function, got/);
|
||||
});
|
||||
|
||||
it("allows a return to plan stubbing after another strategy", function() {
|
||||
var originalFn = jasmine.createSpy("original"),
|
||||
fakeFn = jasmine.createSpy("fake").and.returnValue(67),
|
||||
spyStrategy = new j$.SpyStrategy({fn: originalFn}),
|
||||
spyStrategy = new jasmineUnderTest.SpyStrategy({fn: originalFn}),
|
||||
returnValue;
|
||||
|
||||
spyStrategy.callFake(fakeFn);
|
||||
@@ -90,7 +181,7 @@ describe("SpyStrategy", function() {
|
||||
|
||||
expect(originalFn).not.toHaveBeenCalled();
|
||||
expect(returnValue).toEqual(67);
|
||||
|
||||
|
||||
spyStrategy.stub();
|
||||
returnValue = spyStrategy.exec();
|
||||
|
||||
@@ -100,12 +191,12 @@ describe("SpyStrategy", function() {
|
||||
it("returns the spy after changing the strategy", function(){
|
||||
var spy = {},
|
||||
spyFn = jasmine.createSpy('spyFn').and.returnValue(spy),
|
||||
spyStrategy = new j$.SpyStrategy({getSpy: spyFn});
|
||||
spyStrategy = new jasmineUnderTest.SpyStrategy({getSpy: spyFn});
|
||||
|
||||
expect(spyStrategy.callThrough()).toBe(spy);
|
||||
expect(spyStrategy.returnValue()).toBe(spy);
|
||||
expect(spyStrategy.throwError()).toBe(spy);
|
||||
expect(spyStrategy.callFake()).toBe(spy);
|
||||
expect(spyStrategy.callFake(function() {})).toBe(spy);
|
||||
expect(spyStrategy.stub()).toBe(spy);
|
||||
});
|
||||
});
|
||||
|
||||
166
spec/core/StackTraceSpec.js
Normal file
166
spec/core/StackTraceSpec.js
Normal file
@@ -0,0 +1,166 @@
|
||||
describe("StackTrace", function() {
|
||||
it("understands Chrome/IE/Edge style traces", function() {
|
||||
var raw =
|
||||
'Error: nope\n' +
|
||||
' at UserContext.<anonymous> (http://localhost:8888/__spec__/core/UtilSpec.js:115:19)\n' +
|
||||
' at QueueRunner.run (http://localhost:8888/__jasmine__/jasmine.js:4320:20)';
|
||||
|
||||
var result = new jasmineUnderTest.StackTrace(raw);
|
||||
|
||||
expect(result.message).toEqual('Error: nope');
|
||||
expect(result.style).toEqual('v8');
|
||||
expect(result.frames).toEqual([
|
||||
{
|
||||
raw: ' at UserContext.<anonymous> (http://localhost:8888/__spec__/core/UtilSpec.js:115:19)',
|
||||
func: 'UserContext.<anonymous>',
|
||||
file: 'http://localhost:8888/__spec__/core/UtilSpec.js',
|
||||
line: 115
|
||||
},
|
||||
{
|
||||
raw: ' at QueueRunner.run (http://localhost:8888/__jasmine__/jasmine.js:4320:20)',
|
||||
func: 'QueueRunner.run',
|
||||
file: 'http://localhost:8888/__jasmine__/jasmine.js',
|
||||
line: 4320
|
||||
}
|
||||
]);
|
||||
});
|
||||
|
||||
it("understands Node style traces", function() {
|
||||
var raw = 'Error\n' +
|
||||
' at /somewhere/jasmine/lib/jasmine-core/jasmine.js:4255:9\n' +
|
||||
' at QueueRunner.complete [as onComplete] (/somewhere/jasmine/lib/jasmine-core/jasmine.js:579:9)\n' +
|
||||
' at Immediate.<anonymous> (/somewhere/jasmine/lib/jasmine-core/jasmine.js:4314:12)\n' +
|
||||
' at runCallback (timers.js:672:20)';
|
||||
var result = new jasmineUnderTest.StackTrace(raw);
|
||||
|
||||
expect(result.message).toEqual('Error');
|
||||
expect(result.style).toEqual('v8');
|
||||
expect(result.frames).toEqual([
|
||||
{
|
||||
raw: ' at /somewhere/jasmine/lib/jasmine-core/jasmine.js:4255:9',
|
||||
func: undefined,
|
||||
file: '/somewhere/jasmine/lib/jasmine-core/jasmine.js',
|
||||
line: 4255
|
||||
},
|
||||
{
|
||||
raw: ' at QueueRunner.complete [as onComplete] (/somewhere/jasmine/lib/jasmine-core/jasmine.js:579:9)',
|
||||
func: 'QueueRunner.complete [as onComplete]',
|
||||
file: '/somewhere/jasmine/lib/jasmine-core/jasmine.js',
|
||||
line: 579
|
||||
},
|
||||
{
|
||||
raw: ' at Immediate.<anonymous> (/somewhere/jasmine/lib/jasmine-core/jasmine.js:4314:12)',
|
||||
func: 'Immediate.<anonymous>',
|
||||
file: '/somewhere/jasmine/lib/jasmine-core/jasmine.js',
|
||||
line: 4314
|
||||
},
|
||||
{
|
||||
raw: ' at runCallback (timers.js:672:20)',
|
||||
func: 'runCallback',
|
||||
file: 'timers.js',
|
||||
line: 672
|
||||
}
|
||||
]);
|
||||
});
|
||||
|
||||
it("understands Safari/Firefox/Phantom-OS X style traces", function() {
|
||||
var raw =
|
||||
'http://localhost:8888/__spec__/core/UtilSpec.js:115:28\n' +
|
||||
'run@http://localhost:8888/__jasmine__/jasmine.js:4320:27';
|
||||
var result = new jasmineUnderTest.StackTrace(raw);
|
||||
|
||||
expect(result.message).toBeFalsy();
|
||||
expect(result.style).toEqual('webkit');
|
||||
expect(result.frames).toEqual([
|
||||
{
|
||||
raw: 'http://localhost:8888/__spec__/core/UtilSpec.js:115:28',
|
||||
func: undefined,
|
||||
file: 'http://localhost:8888/__spec__/core/UtilSpec.js',
|
||||
line: 115
|
||||
},
|
||||
{
|
||||
raw: 'run@http://localhost:8888/__jasmine__/jasmine.js:4320:27',
|
||||
func: 'run',
|
||||
file: 'http://localhost:8888/__jasmine__/jasmine.js',
|
||||
line: 4320
|
||||
}
|
||||
]);
|
||||
});
|
||||
|
||||
it("does not mistake gibberish for Safari/Firefox/Phantom-OS X style traces", function() {
|
||||
var raw = 'randomcharsnotincludingwhitespace';
|
||||
var result = new jasmineUnderTest.StackTrace(raw);
|
||||
expect(result.style).toBeNull();
|
||||
expect(result.frames).toEqual([
|
||||
{ raw: raw }
|
||||
]);
|
||||
});
|
||||
|
||||
it("understands Phantom-Linux style traces", function() {
|
||||
var raw =
|
||||
' at UserContext.<anonymous> (http://localhost:8888/__spec__/core/UtilSpec.js:115:19)\n' +
|
||||
' at QueueRunner.run (http://localhost:8888/__jasmine__/jasmine.js:4320:20)';
|
||||
|
||||
var result = new jasmineUnderTest.StackTrace(raw);
|
||||
|
||||
expect(result.message).toBeFalsy();
|
||||
expect(result.style).toEqual('v8');
|
||||
expect(result.frames).toEqual([
|
||||
{
|
||||
raw: ' at UserContext.<anonymous> (http://localhost:8888/__spec__/core/UtilSpec.js:115:19)',
|
||||
func: 'UserContext.<anonymous>',
|
||||
file: 'http://localhost:8888/__spec__/core/UtilSpec.js',
|
||||
line: 115
|
||||
},
|
||||
{
|
||||
raw: ' at QueueRunner.run (http://localhost:8888/__jasmine__/jasmine.js:4320:20)',
|
||||
func: 'QueueRunner.run',
|
||||
file: 'http://localhost:8888/__jasmine__/jasmine.js',
|
||||
line: 4320
|
||||
}
|
||||
]);
|
||||
});
|
||||
|
||||
it("ignores blank lines", function() {
|
||||
var raw =
|
||||
' at UserContext.<anonymous> (http://localhost:8888/__spec__/core/UtilSpec.js:115:19)\n';
|
||||
|
||||
var result = new jasmineUnderTest.StackTrace(raw);
|
||||
|
||||
expect(result.frames).toEqual([
|
||||
{
|
||||
raw: ' at UserContext.<anonymous> (http://localhost:8888/__spec__/core/UtilSpec.js:115:19)',
|
||||
func: 'UserContext.<anonymous>',
|
||||
file: 'http://localhost:8888/__spec__/core/UtilSpec.js',
|
||||
line: 115
|
||||
}
|
||||
]);
|
||||
});
|
||||
|
||||
it("omits properties except 'raw' for frames that are not understood", function() {
|
||||
var raw =
|
||||
' at UserContext.<anonymous> (http://localhost:8888/__spec__/core/UtilSpec.js:115:19)\n' +
|
||||
' but this is quite unexpected\n' +
|
||||
' at QueueRunner.run (http://localhost:8888/__jasmine__/jasmine.js:4320:20)';
|
||||
|
||||
var result = new jasmineUnderTest.StackTrace(raw);
|
||||
expect(result.style).toEqual('v8');
|
||||
expect(result.frames).toEqual([
|
||||
{
|
||||
raw: ' at UserContext.<anonymous> (http://localhost:8888/__spec__/core/UtilSpec.js:115:19)',
|
||||
func: 'UserContext.<anonymous>',
|
||||
file: 'http://localhost:8888/__spec__/core/UtilSpec.js',
|
||||
line: 115
|
||||
},
|
||||
{
|
||||
raw: ' but this is quite unexpected'
|
||||
},
|
||||
{
|
||||
raw: ' at QueueRunner.run (http://localhost:8888/__jasmine__/jasmine.js:4320:20)',
|
||||
func: 'QueueRunner.run',
|
||||
file: 'http://localhost:8888/__jasmine__/jasmine.js',
|
||||
line: 4320
|
||||
}
|
||||
]);
|
||||
});
|
||||
});
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user