vulcan 0.1.6 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (181) hide show
  1. data/lib/vulcan/cli.rb +3 -0
  2. data/lib/vulcan/version.rb +1 -1
  3. data/server/lib/spawner.js +9 -4
  4. data/server/node_modules/cradle/lib/cradle.js +0 -1
  5. data/server/node_modules/cradle/package.json +3 -3
  6. data/server/node_modules/cradle/test/cache-test.js +6 -7
  7. data/server/node_modules/cradle/test/cradle-test.js +4 -5
  8. data/server/node_modules/cradle/test/response-test.js +5 -6
  9. data/server/node_modules/express/History.md +40 -0
  10. data/server/node_modules/express/Makefile +3 -9
  11. data/server/node_modules/express/Readme.md +3 -1
  12. data/server/node_modules/express/bin/express +61 -63
  13. data/server/node_modules/express/lib/express.js +1 -1
  14. data/server/node_modules/express/lib/request.js +9 -7
  15. data/server/node_modules/express/lib/view.js +19 -16
  16. data/server/node_modules/express/node_modules/connect/lib/connect.js +1 -1
  17. data/server/node_modules/express/node_modules/connect/lib/http.js +2 -0
  18. data/server/node_modules/express/node_modules/connect/lib/middleware/bodyParser.js +135 -31
  19. data/server/node_modules/express/node_modules/connect/lib/middleware/limit.js +5 -1
  20. data/server/node_modules/express/node_modules/connect/lib/middleware/session.js +2 -2
  21. data/server/node_modules/express/node_modules/connect/lib/middleware/static.js +26 -21
  22. data/server/node_modules/express/node_modules/connect/lib/middleware/staticCache.js +91 -38
  23. data/server/node_modules/express/node_modules/connect/lib/middleware/vhost.js +1 -1
  24. data/server/node_modules/express/node_modules/connect/lib/utils.js +11 -4
  25. data/server/node_modules/express/node_modules/connect/node_modules/formidable/Makefile +14 -0
  26. data/server/node_modules/express/node_modules/connect/node_modules/formidable/Readme.md +286 -0
  27. data/server/node_modules/express/node_modules/connect/node_modules/formidable/TODO +3 -0
  28. data/server/node_modules/express/node_modules/connect/node_modules/formidable/benchmark/bench-multipart-parser.js +70 -0
  29. data/server/node_modules/express/node_modules/connect/node_modules/formidable/example/post.js +43 -0
  30. data/server/node_modules/express/node_modules/connect/node_modules/formidable/example/upload.js +48 -0
  31. data/server/node_modules/express/node_modules/connect/node_modules/formidable/index.js +1 -0
  32. data/server/node_modules/express/node_modules/connect/node_modules/formidable/lib/file.js +61 -0
  33. data/server/node_modules/express/node_modules/connect/node_modules/formidable/lib/incoming_form.js +377 -0
  34. data/server/node_modules/express/node_modules/connect/node_modules/formidable/lib/index.js +3 -0
  35. data/server/node_modules/express/node_modules/connect/node_modules/formidable/lib/multipart_parser.js +312 -0
  36. data/server/node_modules/express/node_modules/connect/node_modules/formidable/lib/querystring_parser.js +25 -0
  37. data/server/node_modules/express/node_modules/connect/node_modules/formidable/lib/util.js +6 -0
  38. data/server/node_modules/express/node_modules/connect/node_modules/formidable/package.json +22 -0
  39. data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/common.js +19 -0
  40. data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/funkyfilename.txt +1 -0
  41. data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/plain.txt +1 -0
  42. data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/no-filename/generic.http +13 -0
  43. data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/info.md +3 -0
  44. data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/osx-chrome-13.http +26 -0
  45. data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/osx-firefox-3.6.http +24 -0
  46. data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/osx-safari-5.http +23 -0
  47. data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/xp-chrome-12.http +24 -0
  48. data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/xp-ie-7.http +22 -0
  49. data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/xp-ie-8.http +22 -0
  50. data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/xp-safari-5.http +22 -0
  51. data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/no-filename.js +3 -0
  52. data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/special-chars-in-filename.js +21 -0
  53. data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/multi_video.upload +0 -0
  54. data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/multipart.js +72 -0
  55. data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/integration/test-fixtures.js +89 -0
  56. data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/common.js +24 -0
  57. data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/integration/test-multipart-parser.js +80 -0
  58. data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-file.js +104 -0
  59. data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-incoming-form.js +715 -0
  60. data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-multipart-parser.js +50 -0
  61. data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-querystring-parser.js +45 -0
  62. data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/system/test-multi-video-upload.js +72 -0
  63. data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/run.js +2 -0
  64. data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/unit/test-incoming-form.js +63 -0
  65. data/server/node_modules/express/node_modules/connect/node_modules/formidable/tool/record.js +47 -0
  66. data/server/node_modules/express/node_modules/connect/package.json +7 -6
  67. data/server/node_modules/express/node_modules/connect/test.js +44 -31
  68. data/server/node_modules/express/node_modules/qs/History.md +11 -0
  69. data/server/node_modules/express/node_modules/qs/Makefile +1 -3
  70. data/server/node_modules/express/node_modules/qs/Readme.md +2 -4
  71. data/server/node_modules/express/node_modules/qs/lib/querystring.js +100 -74
  72. data/server/node_modules/express/node_modules/qs/package.json +9 -2
  73. data/server/node_modules/express/node_modules/qs/test/mocha.opts +2 -0
  74. data/server/node_modules/express/node_modules/qs/test/{parse.test.js → parse.js} +1 -2
  75. data/server/node_modules/express/node_modules/qs/test/{stringify.test.js → stringify.js} +0 -0
  76. data/server/node_modules/express/package.json +7 -7
  77. data/server/node_modules/express/testing/foo/app.js +35 -0
  78. data/server/node_modules/express/testing/foo/package.json +9 -0
  79. data/server/node_modules/express/testing/foo/public/stylesheets/style.css +8 -0
  80. data/server/node_modules/express/testing/foo/routes/index.js +10 -0
  81. data/server/node_modules/express/testing/foo/views/index.jade +2 -0
  82. data/server/node_modules/express/testing/foo/views/layout.jade +6 -0
  83. data/server/node_modules/express/testing/index.js +31 -5
  84. data/server/node_modules/express/testing/public/test.txt +2971 -0
  85. data/server/node_modules/express/testing/views/page.html +1 -0
  86. data/server/node_modules/express/testing/views/page.jade +3 -0
  87. data/server/node_modules/express/testing/views/test.md +1 -0
  88. data/server/node_modules/express/testing/views/user/index.jade +1 -0
  89. data/server/node_modules/express/testing/views/user/list.jade +1 -0
  90. data/server/node_modules/node-uuid/README.md +166 -67
  91. data/server/node_modules/node-uuid/benchmark/README.md +53 -0
  92. data/server/node_modules/node-uuid/benchmark/bench.gnu +174 -0
  93. data/server/node_modules/node-uuid/benchmark/bench.sh +34 -0
  94. data/server/node_modules/node-uuid/{test → benchmark}/benchmark-native.c +0 -0
  95. data/server/node_modules/node-uuid/benchmark/benchmark.js +84 -0
  96. data/server/node_modules/node-uuid/package.json +5 -3
  97. data/server/node_modules/node-uuid/test/benchmark-native +0 -0
  98. data/server/node_modules/node-uuid/test/compare_v1.js +63 -0
  99. data/server/node_modules/node-uuid/test/test.html +3 -0
  100. data/server/node_modules/node-uuid/test/test.js +214 -57
  101. data/server/node_modules/node-uuid/uuid.js +225 -56
  102. data/server/node_modules/restler/README.md +20 -7
  103. data/server/node_modules/restler/bin/restler +1 -1
  104. data/server/node_modules/restler/lib/multipartform.js +9 -8
  105. data/server/node_modules/restler/lib/restler.js +64 -22
  106. data/server/node_modules/restler/package.json +2 -2
  107. data/server/node_modules/restler/test/restler.js +22 -2
  108. data/server/node_modules/restler/test/test_helper.js +20 -1
  109. data/server/package.json +8 -8
  110. data/server/web.js +22 -6
  111. metadata +72 -82
  112. data/server/node_modules/cradle/node_modules/vows/LICENSE +0 -20
  113. data/server/node_modules/cradle/node_modules/vows/Makefile +0 -7
  114. data/server/node_modules/cradle/node_modules/vows/README.md +0 -39
  115. data/server/node_modules/cradle/node_modules/vows/bin/vows +0 -515
  116. data/server/node_modules/cradle/node_modules/vows/lib/assert/error.js +0 -27
  117. data/server/node_modules/cradle/node_modules/vows/lib/assert/macros.js +0 -215
  118. data/server/node_modules/cradle/node_modules/vows/lib/assert/utils.js +0 -77
  119. data/server/node_modules/cradle/node_modules/vows/lib/vows.js +0 -193
  120. data/server/node_modules/cradle/node_modules/vows/lib/vows/console.js +0 -131
  121. data/server/node_modules/cradle/node_modules/vows/lib/vows/context.js +0 -55
  122. data/server/node_modules/cradle/node_modules/vows/lib/vows/coverage/file.js +0 -29
  123. data/server/node_modules/cradle/node_modules/vows/lib/vows/coverage/fragments/coverage-foot.html +0 -2
  124. data/server/node_modules/cradle/node_modules/vows/lib/vows/coverage/fragments/coverage-head.html +0 -61
  125. data/server/node_modules/cradle/node_modules/vows/lib/vows/coverage/report-html.js +0 -54
  126. data/server/node_modules/cradle/node_modules/vows/lib/vows/coverage/report-json.js +0 -54
  127. data/server/node_modules/cradle/node_modules/vows/lib/vows/coverage/report-plain.js +0 -38
  128. data/server/node_modules/cradle/node_modules/vows/lib/vows/extras.js +0 -28
  129. data/server/node_modules/cradle/node_modules/vows/lib/vows/reporters/dot-matrix.js +0 -67
  130. data/server/node_modules/cradle/node_modules/vows/lib/vows/reporters/json.js +0 -16
  131. data/server/node_modules/cradle/node_modules/vows/lib/vows/reporters/silent.js +0 -8
  132. data/server/node_modules/cradle/node_modules/vows/lib/vows/reporters/spec.js +0 -44
  133. data/server/node_modules/cradle/node_modules/vows/lib/vows/reporters/watch.js +0 -39
  134. data/server/node_modules/cradle/node_modules/vows/lib/vows/reporters/xunit.js +0 -90
  135. data/server/node_modules/cradle/node_modules/vows/lib/vows/suite.js +0 -319
  136. data/server/node_modules/cradle/node_modules/vows/node_modules/eyes/LICENSE +0 -20
  137. data/server/node_modules/cradle/node_modules/vows/node_modules/eyes/Makefile +0 -4
  138. data/server/node_modules/cradle/node_modules/vows/node_modules/eyes/README.md +0 -72
  139. data/server/node_modules/cradle/node_modules/vows/node_modules/eyes/lib/eyes.js +0 -233
  140. data/server/node_modules/cradle/node_modules/vows/node_modules/eyes/package.json +0 -14
  141. data/server/node_modules/cradle/node_modules/vows/node_modules/eyes/test/eyes-test.js +0 -55
  142. data/server/node_modules/cradle/node_modules/vows/package.json +0 -14
  143. data/server/node_modules/cradle/node_modules/vows/test/assert-test.js +0 -135
  144. data/server/node_modules/cradle/node_modules/vows/test/fixtures/isolate/failing.js +0 -18
  145. data/server/node_modules/cradle/node_modules/vows/test/fixtures/isolate/log.js +0 -18
  146. data/server/node_modules/cradle/node_modules/vows/test/fixtures/isolate/passing.js +0 -17
  147. data/server/node_modules/cradle/node_modules/vows/test/fixtures/isolate/stderr.js +0 -18
  148. data/server/node_modules/cradle/node_modules/vows/test/isolate-test.js +0 -140
  149. data/server/node_modules/cradle/node_modules/vows/test/testInherit.js +0 -133
  150. data/server/node_modules/cradle/node_modules/vows/test/vows-error-test.js +0 -51
  151. data/server/node_modules/cradle/node_modules/vows/test/vows-test.js +0 -374
  152. data/server/node_modules/express/node_modules/qs/support/expresso/History.md +0 -128
  153. data/server/node_modules/express/node_modules/qs/support/expresso/Makefile +0 -53
  154. data/server/node_modules/express/node_modules/qs/support/expresso/Readme.md +0 -61
  155. data/server/node_modules/express/node_modules/qs/support/expresso/bin/expresso +0 -856
  156. data/server/node_modules/express/node_modules/qs/support/expresso/docs/api.html +0 -1080
  157. data/server/node_modules/express/node_modules/qs/support/expresso/docs/index.html +0 -377
  158. data/server/node_modules/express/node_modules/qs/support/expresso/docs/index.md +0 -290
  159. data/server/node_modules/express/node_modules/qs/support/expresso/docs/layout/foot.html +0 -3
  160. data/server/node_modules/express/node_modules/qs/support/expresso/docs/layout/head.html +0 -42
  161. data/server/node_modules/express/node_modules/qs/support/expresso/lib/bar.js +0 -4
  162. data/server/node_modules/express/node_modules/qs/support/expresso/lib/foo.js +0 -16
  163. data/server/node_modules/express/node_modules/qs/support/expresso/package.json +0 -12
  164. data/server/node_modules/express/node_modules/qs/support/expresso/test/assert.test.js +0 -91
  165. data/server/node_modules/express/node_modules/qs/support/expresso/test/async.test.js +0 -12
  166. data/server/node_modules/express/node_modules/qs/support/expresso/test/bar.test.js +0 -13
  167. data/server/node_modules/express/node_modules/qs/support/expresso/test/foo.test.js +0 -14
  168. data/server/node_modules/express/node_modules/qs/support/expresso/test/http.test.js +0 -146
  169. data/server/node_modules/express/node_modules/qs/support/expresso/test/serial/async.test.js +0 -39
  170. data/server/node_modules/express/node_modules/qs/support/expresso/test/serial/http.test.js +0 -48
  171. data/server/node_modules/express/node_modules/qs/support/should/History.md +0 -22
  172. data/server/node_modules/express/node_modules/qs/support/should/Makefile +0 -6
  173. data/server/node_modules/express/node_modules/qs/support/should/Readme.md +0 -248
  174. data/server/node_modules/express/node_modules/qs/support/should/examples/runner.js +0 -53
  175. data/server/node_modules/express/node_modules/qs/support/should/index.js +0 -2
  176. data/server/node_modules/express/node_modules/qs/support/should/lib/eql.js +0 -91
  177. data/server/node_modules/express/node_modules/qs/support/should/lib/should.js +0 -548
  178. data/server/node_modules/express/node_modules/qs/support/should/package.json +0 -8
  179. data/server/node_modules/express/node_modules/qs/support/should/test/should.test.js +0 -358
  180. data/server/node_modules/express/testing/views/users.jade +0 -1
  181. data/server/node_modules/node-uuid/test/benchmark.js +0 -27
@@ -1,67 +0,0 @@
1
- var options = { tail: '' },
2
- console = require('../../vows/console'),
3
- stylize = console.stylize,
4
- puts = console.puts(options);
5
- //
6
- // Console reporter
7
- //
8
- var messages = [], lastContext;
9
-
10
- this.name = 'dot-matrix';
11
- this.setStream = function (s) {
12
- options.stream = s;
13
- };
14
-
15
- this.reset = function () {
16
- messages = [];
17
- lastContext = null;
18
- };
19
- this.report = function (data) {
20
- var event = data[1];
21
-
22
- switch (data[0]) {
23
- case 'subject':
24
- // messages.push(stylize(event, 'underline') + '\n');
25
- break;
26
- case 'context':
27
- break;
28
- case 'vow':
29
- if (event.status === 'honored') {
30
- puts(stylize('·', 'green'));
31
- } else if (event.status === 'pending') {
32
- puts(stylize('-', 'cyan'));
33
- } else {
34
- if (lastContext !== event.context) {
35
- lastContext = event.context;
36
- messages.push(' ' + event.context);
37
- }
38
- if (event.status === 'broken') {
39
- puts(stylize('✗', 'yellow'));
40
- messages.push(console.vowText(event));
41
- } else if (event.status === 'errored') {
42
- puts(stylize('✗', 'red'));
43
- messages.push(console.vowText(event));
44
- }
45
- messages.push('');
46
- }
47
- break;
48
- case 'end':
49
- puts(' ');
50
- break;
51
- case 'finish':
52
- if (messages.length) {
53
- puts('\n\n' + messages.join('\n'));
54
- } else {
55
- puts('');
56
- }
57
- puts(console.result(event).join('\n'));
58
- break;
59
- case 'error':
60
- puts(console.error(event));
61
- break;
62
- }
63
- };
64
-
65
- this.print = function (str) {
66
- puts(str);
67
- };
@@ -1,16 +0,0 @@
1
- var options = { tail: '\n', raw: true };
2
- var console = require('../../vows/console');
3
- var puts = console.puts(options);
4
-
5
- //
6
- // Console JSON reporter
7
- //
8
- this.name = 'json';
9
- this.setStream = function (s) {
10
- options.stream = s;
11
- };
12
- this.report = function (obj) {
13
- puts(JSON.stringify(obj));
14
- };
15
-
16
- this.print = function (str) {};
@@ -1,8 +0,0 @@
1
- //
2
- // Silent reporter - "Shhh"
3
- //
4
- this.name = 'silent';
5
- this.reset = function () {};
6
- this.report = function () {};
7
- this.print = function () {};
8
-
@@ -1,44 +0,0 @@
1
- var sys = require('sys');
2
-
3
- var options = { tail: '\n' };
4
- var console = require('../../vows/console');
5
- var stylize = console.stylize,
6
- puts = console.puts(options);
7
- //
8
- // Console reporter
9
- //
10
-
11
- this.name = 'spec';
12
- this.setStream = function (s) {
13
- options.stream = s;
14
- };
15
- this.report = function (data) {
16
- var event = data[1];
17
-
18
- buffer = [];
19
-
20
- switch (data[0]) {
21
- case 'subject':
22
- puts('\n♢ ' + stylize(event, 'bold') + '\n');
23
- break;
24
- case 'context':
25
- puts(console.contextText(event));
26
- break;
27
- case 'vow':
28
- puts(console.vowText(event));
29
- break;
30
- case 'end':
31
- sys.print('\n');
32
- break;
33
- case 'finish':
34
- puts(console.result(event).join('\n'));
35
- break;
36
- case 'error':
37
- puts(console.error(event));
38
- break;
39
- }
40
- };
41
-
42
- this.print = function (str) {
43
- sys.print(str);
44
- };
@@ -1,39 +0,0 @@
1
- var sys = require('sys');
2
-
3
- var options = {};
4
- var console = require('../../vows/console');
5
- var spec = require('../../vows/reporters/spec');
6
- var stylize = console.stylize,
7
- puts = console.puts(options);
8
- //
9
- // Console reporter
10
- //
11
- var lastContext;
12
-
13
- this.name = 'watch';
14
- this.setStream = function (s) {
15
- options.stream = s;
16
- };
17
- this.reset = function () {
18
- lastContext = null;
19
- };
20
- this.report = function (data) {
21
- var event = data[1];
22
-
23
- switch (data[0]) {
24
- case 'vow':
25
- if (['honored', 'pending'].indexOf(event.status) === -1) {
26
- if (lastContext !== event.context) {
27
- lastContext = event.context;
28
- puts(console.contextText(event.context));
29
- }
30
- puts(console.vowText(event));
31
- puts('');
32
- }
33
- break;
34
- case 'error':
35
- puts(console.error(event));
36
- break;
37
- }
38
- };
39
- this.print = function (str) {};
@@ -1,90 +0,0 @@
1
- // xunit outoput for vows, so we can run things under hudson
2
- //
3
- // The translation to xunit is simple. Most likely more tags/attributes can be
4
- // added, see: http://ant.1045680.n5.nabble.com/schema-for-junit-xml-output-td1375274.html
5
- //
6
-
7
- var puts = require('util').puts;
8
-
9
- var buffer = [],
10
- curSubject = null;
11
-
12
- function xmlEnc(value) {
13
- return !value ? value : String(value).replace(/&/g, "&")
14
- .replace(/>/g, ">")
15
- .replace(/</g, "&lt;")
16
- .replace(/"/g, "&quot;")
17
- .replace(/\u001b\[\d{1,2}m/g, '');
18
- }
19
-
20
- function tag(name, attribs, single, content) {
21
- var strAttr = [], t, end = '>';
22
- for (var attr in attribs) {
23
- if (attribs.hasOwnProperty(attr)) {
24
- strAttr.push(attr + '="' + xmlEnc(attribs[attr]) + '"');
25
- }
26
- }
27
- if (single) {
28
- end = ' />';
29
- }
30
- if (strAttr.length) {
31
- t = '<' + name + ' ' + strAttr.join(' ') + end;
32
- } else {
33
- t = '<' + name + end;
34
- }
35
- if (typeof content !== 'undefined') {
36
- return t + content + '</' + name + end;
37
- }
38
- return t;
39
- }
40
-
41
- function end(name) {
42
- return '</' + name + '>';
43
- }
44
-
45
- function cdata(data) {
46
- return '<![CDATA[' + xmlEnc(data) + ']]>';
47
- }
48
-
49
- this.name = 'xunit';
50
- this.report = function (data) {
51
- var event = data[1];
52
-
53
- switch (data[0]) {
54
- case 'subject':
55
- curSubject = event;
56
- break;
57
- case 'context':
58
- break;
59
- case 'vow':
60
- switch (event.status) {
61
- case 'honored':
62
- buffer.push(tag('testcase', {classname: curSubject, name: event.context + ': ' + event.title}, true));
63
- break;
64
- case 'broken':
65
- var err = tag('error', {type: 'vows.event.broken', message: 'Broken test'}, false, cdata(event.exception));
66
- buffer.push(tag('testcase', {classname: curSubject, name: event.context + ': ' + event.title}, false, err));
67
- break;
68
- case 'errored':
69
- var skip = tag('skipped', {type: 'vows.event.errored', message: 'Errored test'}, false, cdata(event.exception));
70
- buffer.push(tag('testcase', {classname: curSubject, name: event.context + ': ' + event.title}, false, skip));
71
- break;
72
- case 'pending':
73
- // nop
74
- break;
75
- }
76
- break;
77
- case 'end':
78
- buffer.push(end('testcase'));
79
- break;
80
- case 'finish':
81
- buffer.unshift(tag('testsuite', {name: 'Vows test', tests: event.total, timestamp: (new Date()).toUTCString(), errors: event.errored, failures: event.broken, skip: event.pending, time: event.time}));
82
- buffer.push(end('testsuite'));
83
- puts(buffer.join('\n'));
84
- break;
85
- case 'error':
86
- break;
87
- }
88
- };
89
-
90
- this.print = function (str) { };
@@ -1,319 +0,0 @@
1
- var events = require('events'),
2
- path = require('path');
3
-
4
- var vows = require('../vows');
5
- var Context = require('../vows/context').Context;
6
-
7
- this.Suite = function (subject) {
8
- this.subject = subject;
9
- this.matcher = /.*/;
10
- this.reporter = require('./reporters/dot-matrix');
11
- this.batches = [];
12
- this.options = { error: true };
13
- this.reset();
14
- };
15
-
16
- this.Suite.prototype = new(function () {
17
- this.reset = function () {
18
- this.results = {
19
- honored: 0,
20
- broken: 0,
21
- errored: 0,
22
- pending: 0,
23
- total: 0,
24
- time: null
25
- };
26
- this.batches.forEach(function (b) {
27
- b.lastContext = null;
28
- b.remaining = b._remaining;
29
- b.honored = b.broken = b.errored = b.total = b.pending = 0;
30
- b.vows.forEach(function (vow) { vow.status = null });
31
- b.teardowns = [];
32
- });
33
- };
34
-
35
- this.addBatch = function (tests) {
36
- this.batches.push({
37
- tests: tests,
38
- suite: this,
39
- vows: [],
40
- remaining: 0,
41
- _remaining: 0,
42
- honored: 0,
43
- broken: 0,
44
- errored: 0,
45
- pending: 0,
46
- total: 0,
47
- teardowns: []
48
- });
49
- return this;
50
- };
51
- this.addVows = this.addBatch;
52
-
53
- this.parseBatch = function (batch, matcher) {
54
- var tests = batch.tests;
55
-
56
- if ('topic' in tests) {
57
- throw new(Error)("missing top-level context.");
58
- }
59
- // Count the number of vows/promises expected to fire,
60
- // so we know when the tests are over.
61
- // We match the keys against `matcher`, to decide
62
- // whether or not they should be included in the test.
63
- // Any key, including assertion function keys can be matched.
64
- // If a child matches, then the n parent topics must not be skipped.
65
- (function count(tests, _match) {
66
- var match = false;
67
-
68
- var keys = Object.keys(tests).filter(function (k) {
69
- return k !== 'topic' && k !== 'teardown';
70
- });
71
-
72
- for (var i = 0, key; i < keys.length; i++) {
73
- key = keys[i];
74
-
75
- // If the parent node, or this one matches.
76
- match = _match || matcher.test(key);
77
-
78
- if (typeof(tests[key]) === 'object') {
79
- match = count(tests[key], match);
80
- } else {
81
- if (typeof(tests[key]) === 'string') {
82
- tests[key] = new(String)(tests[key]);
83
- }
84
- if (! match) {
85
- tests[key]._skip = true;
86
- }
87
- }
88
- }
89
-
90
- // If any of the children matched,
91
- // don't skip this node.
92
- for (var i = 0; i < keys.length; i++) {
93
- if (! tests[keys[i]]._skip) { match = true }
94
- }
95
-
96
- if (match) { batch.remaining ++ }
97
- else { tests._skip = true }
98
-
99
- return match;
100
- })(tests, false);
101
-
102
- batch._remaining = batch.remaining;
103
- };
104
-
105
- this.runBatch = function (batch) {
106
- var topic,
107
- tests = batch.tests,
108
- promise = batch.promise = new(events.EventEmitter);
109
-
110
- var that = this;
111
-
112
- batch.status = 'begin';
113
-
114
- // The test runner, it calls itself recursively, passing the
115
- // previous context to the inner contexts. This is so the `topic`
116
- // functions have access to all the previous context topics in their
117
- // arguments list.
118
- // It is defined and invoked at the same time.
119
- // If it encounters a `topic` function, it waits for the returned
120
- // promise to emit (the topic), at which point it runs the functions under it,
121
- // passing the topic as an argument.
122
- (function run(ctx, lastTopic) {
123
- var old = false;
124
- topic = ctx.tests.topic;
125
-
126
- if (typeof(topic) === 'function') {
127
- // Run the topic, passing the previous context topics
128
- topic = topic.apply(ctx.env, ctx.topics);
129
-
130
- if (typeof(topic) === 'undefined') { ctx._callback = true }
131
- }
132
-
133
- // If this context has a topic, store it in `lastTopic`,
134
- // if not, use the last topic, passed down by a parent
135
- // context.
136
- if (typeof(topic) !== 'undefined' || ctx._callback) {
137
- lastTopic = topic;
138
- } else {
139
- old = true;
140
- topic = lastTopic;
141
- }
142
-
143
- // If the topic doesn't return an event emitter (such as a promise),
144
- // we create it ourselves, and emit the value on the next tick.
145
- if (! (topic && topic.constructor === events.EventEmitter)) {
146
- ctx.emitter = new(events.EventEmitter);
147
-
148
- if (! ctx._callback) {
149
- process.nextTick(function (val) {
150
- return function () { ctx.emitter.emit("success", val) };
151
- }(topic));
152
- }
153
- topic = ctx.emitter;
154
- }
155
-
156
- topic.on('success', function (val) {
157
- // Once the topic fires, add the return value
158
- // to the beginning of the topics list, so it
159
- // becomes the first argument for the next topic.
160
- // If we're using the parent topic, no need to
161
- // prepend it to the topics list, or we'll get
162
- // duplicates.
163
- if (! old) Array.prototype.unshift.apply(ctx.topics, arguments);
164
- });
165
- if (topic.setMaxListeners) { topic.setMaxListeners(Infinity) }
166
-
167
- // Now run the tests, or sub-contexts
168
- Object.keys(ctx.tests).filter(function (k) {
169
- return ctx.tests[k] && k !== 'topic' &&
170
- k !== 'teardown' && !ctx.tests[k]._skip;
171
- }).forEach(function (item) {
172
- // Create a new evaluation context,
173
- // inheriting from the parent one.
174
- var env = Object.create(ctx.env);
175
- env.suite = that;
176
-
177
- // Holds the current test or context
178
- var vow = Object.create({
179
- callback: ctx.tests[item],
180
- context: ctx.title,
181
- description: item,
182
- binding: ctx.env,
183
- status: null,
184
- batch: batch
185
- });
186
-
187
- // If we encounter a function, add it to the callbacks
188
- // of the `topic` function, so it'll get called once the
189
- // topic fires.
190
- // If we encounter an object literal, we recurse, sending it
191
- // our current context.
192
- if ((typeof(vow.callback) === 'function') || (vow.callback instanceof String)) {
193
- topic.addVow(vow);
194
- } else if (typeof(vow.callback) === 'object') {
195
- // If there's a setup stage, we have to wait for it to fire,
196
- // before calling the inner context. Else, just run the inner context
197
- // synchronously.
198
- if (topic) {
199
- topic.on("success", function (ctx) {
200
- return function (val) {
201
- return run(new(Context)(vow, ctx, env), lastTopic);
202
- };
203
- }(ctx));
204
- } else {
205
- run(new(Context)(vow, ctx, env), lastTopic);
206
- }
207
- }
208
- });
209
- // Teardown
210
- if (ctx.tests.teardown) {
211
- batch.teardowns.push(ctx);
212
- }
213
- if (! ctx.tests._skip) {
214
- batch.remaining --;
215
- }
216
- // Check if we're done running the tests
217
- exports.tryEnd(batch);
218
- // This is our initial, empty context
219
- })(new(Context)({ callback: tests, context: null, description: null }, {}));
220
- return promise;
221
- };
222
-
223
- this.report = function () {
224
- return this.reporter.report.apply(this.reporter, arguments);
225
- };
226
-
227
- this.run = function (options, callback) {
228
- var that = this, start;
229
-
230
- options = options || {};
231
-
232
- for (var k in options) { this.options[k] = options[k] }
233
-
234
- this.matcher = this.options.matcher || this.matcher;
235
- this.reporter = this.options.reporter || this.reporter;
236
-
237
- this.batches.forEach(function (batch) {
238
- that.parseBatch(batch, that.matcher);
239
- });
240
-
241
- this.reset();
242
-
243
- start = new(Date);
244
-
245
- if (this.batches.filter(function (b) { return b.remaining > 0 }).length) {
246
- this.report(['subject', this.subject]);
247
- }
248
-
249
- return (function run(batches) {
250
- var batch = batches.shift();
251
-
252
- if (batch) {
253
- // If the batch has no vows to run,
254
- // go to the next one.
255
- if (batch.remaining === 0) {
256
- run(batches);
257
- } else {
258
- that.runBatch(batch).on('end', function () {
259
- run(batches);
260
- });
261
- }
262
- } else {
263
- that.results.time = (new(Date) - start) / 1000;
264
- that.report(['finish', that.results]);
265
-
266
- if (callback) { callback(that.results) }
267
-
268
- if (that.results.honored + that.results.pending === that.results.total) {
269
- return 0;
270
- } else {
271
- return 1;
272
- }
273
- }
274
- })(this.batches.slice(0));
275
- };
276
-
277
- this.runParallel = function () {};
278
-
279
- this.export = function (module, options) {
280
- for (var k in (options || {})) { this.options[k] = options[k] }
281
-
282
- if (require.main === module) {
283
- return this.run();
284
- } else {
285
- return module.exports[this.subject] = this;
286
- }
287
- };
288
- this.exportTo = function (module, options) { // Alias, for JSLint
289
- return this.export(module, options);
290
- };
291
- });
292
-
293
- //
294
- // Checks if all the tests in the batch have been run,
295
- // and triggers the next batch (if any), by emitting the 'end' event.
296
- //
297
- this.tryEnd = function (batch) {
298
- var result, style, time;
299
-
300
- if (batch.honored + batch.broken + batch.errored + batch.pending === batch.total &&
301
- batch.remaining === 0) {
302
-
303
- Object.keys(batch).forEach(function (k) {
304
- (k in batch.suite.results) && (batch.suite.results[k] += batch[k]);
305
- });
306
-
307
- // Run teardowns
308
- if (batch.teardowns) {
309
- for (var i = batch.teardowns.length - 1, ctx; i >= 0; i--) {
310
- ctx = batch.teardowns[i];
311
- ctx.tests.teardown.apply(ctx.env, ctx.topics);
312
- }
313
- }
314
-
315
- batch.status = 'end';
316
- batch.suite.report(['end']);
317
- batch.promise.emit('end', batch.honored, batch.broken, batch.errored, batch.pending);
318
- }
319
- };