vulcan 0.2.5 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (211) hide show
  1. data/README.md +1 -80
  2. data/lib/vulcan/cli.rb +12 -33
  3. data/lib/vulcan/version.rb +1 -1
  4. data/server/bin/make +3 -1
  5. data/server/lib/spawner.js +4 -9
  6. data/server/node_modules/connect-form/node_modules/formidable/Readme.md +2 -13
  7. data/server/node_modules/connect-form/node_modules/formidable/lib/incoming_form.js +7 -19
  8. data/server/node_modules/connect-form/node_modules/formidable/lib/multipart_parser.js +1 -12
  9. data/server/node_modules/connect-form/node_modules/formidable/package.json +1 -1
  10. data/server/node_modules/connect-form/node_modules/formidable/test/fixture/http/special-chars-in-filename/osx-chrome-13.http +10 -0
  11. data/server/node_modules/connect-form/node_modules/formidable/test/fixture/http/special-chars-in-filename/xp-chrome-12.http +9 -0
  12. data/server/node_modules/connect-form/node_modules/formidable/test/legacy/simple/test-multipart-parser.js +1 -1
  13. data/server/node_modules/cradle/lib/cradle.js +1 -0
  14. data/server/node_modules/cradle/node_modules/vows/LICENSE +20 -0
  15. data/server/node_modules/cradle/node_modules/vows/Makefile +7 -0
  16. data/server/node_modules/cradle/node_modules/vows/README.md +39 -0
  17. data/server/node_modules/cradle/node_modules/vows/bin/vows +515 -0
  18. data/server/node_modules/cradle/node_modules/vows/lib/assert/error.js +27 -0
  19. data/server/node_modules/cradle/node_modules/vows/lib/assert/macros.js +215 -0
  20. data/server/node_modules/cradle/node_modules/vows/lib/assert/utils.js +77 -0
  21. data/server/node_modules/cradle/node_modules/vows/lib/vows.js +193 -0
  22. data/server/node_modules/cradle/node_modules/vows/lib/vows/console.js +131 -0
  23. data/server/node_modules/cradle/node_modules/vows/lib/vows/context.js +55 -0
  24. data/server/node_modules/cradle/node_modules/vows/lib/vows/coverage/file.js +29 -0
  25. data/server/node_modules/cradle/node_modules/vows/lib/vows/coverage/fragments/coverage-foot.html +2 -0
  26. data/server/node_modules/cradle/node_modules/vows/lib/vows/coverage/fragments/coverage-head.html +61 -0
  27. data/server/node_modules/cradle/node_modules/vows/lib/vows/coverage/report-html.js +54 -0
  28. data/server/node_modules/cradle/node_modules/vows/lib/vows/coverage/report-json.js +54 -0
  29. data/server/node_modules/cradle/node_modules/vows/lib/vows/coverage/report-plain.js +38 -0
  30. data/server/node_modules/cradle/node_modules/vows/lib/vows/extras.js +28 -0
  31. data/server/node_modules/cradle/node_modules/vows/lib/vows/reporters/dot-matrix.js +67 -0
  32. data/server/node_modules/cradle/node_modules/vows/lib/vows/reporters/json.js +16 -0
  33. data/server/node_modules/cradle/node_modules/vows/lib/vows/reporters/silent.js +8 -0
  34. data/server/node_modules/cradle/node_modules/vows/lib/vows/reporters/spec.js +44 -0
  35. data/server/node_modules/cradle/node_modules/vows/lib/vows/reporters/watch.js +39 -0
  36. data/server/node_modules/cradle/node_modules/vows/lib/vows/reporters/xunit.js +90 -0
  37. data/server/node_modules/cradle/node_modules/vows/lib/vows/suite.js +319 -0
  38. data/server/node_modules/cradle/node_modules/vows/node_modules/eyes/LICENSE +20 -0
  39. data/server/node_modules/cradle/node_modules/vows/node_modules/eyes/Makefile +4 -0
  40. data/server/node_modules/cradle/node_modules/vows/node_modules/eyes/README.md +72 -0
  41. data/server/node_modules/cradle/node_modules/vows/node_modules/eyes/lib/eyes.js +233 -0
  42. data/server/node_modules/cradle/node_modules/vows/node_modules/eyes/package.json +14 -0
  43. data/server/node_modules/cradle/node_modules/vows/node_modules/eyes/test/eyes-test.js +55 -0
  44. data/server/node_modules/cradle/node_modules/vows/package.json +14 -0
  45. data/server/node_modules/cradle/node_modules/vows/test/assert-test.js +135 -0
  46. data/server/node_modules/cradle/node_modules/vows/test/fixtures/isolate/failing.js +18 -0
  47. data/server/node_modules/cradle/node_modules/vows/test/fixtures/isolate/log.js +18 -0
  48. data/server/node_modules/cradle/node_modules/vows/test/fixtures/isolate/passing.js +17 -0
  49. data/server/node_modules/cradle/node_modules/vows/test/fixtures/isolate/stderr.js +18 -0
  50. data/server/node_modules/cradle/node_modules/vows/test/isolate-test.js +140 -0
  51. data/server/node_modules/cradle/node_modules/vows/test/testInherit.js +133 -0
  52. data/server/node_modules/cradle/node_modules/vows/test/vows-error-test.js +51 -0
  53. data/server/node_modules/cradle/node_modules/vows/test/vows-test.js +374 -0
  54. data/server/node_modules/cradle/package.json +3 -3
  55. data/server/node_modules/cradle/test/cache-test.js +7 -6
  56. data/server/node_modules/cradle/test/cradle-test.js +5 -4
  57. data/server/node_modules/cradle/test/response-test.js +6 -5
  58. data/server/node_modules/express/History.md +1 -53
  59. data/server/node_modules/express/Makefile +9 -3
  60. data/server/node_modules/express/Readme.md +1 -3
  61. data/server/node_modules/express/bin/express +66 -65
  62. data/server/node_modules/express/lib/express.js +1 -1
  63. data/server/node_modules/express/lib/request.js +9 -23
  64. data/server/node_modules/express/lib/response.js +2 -3
  65. data/server/node_modules/express/lib/utils.js +0 -13
  66. data/server/node_modules/express/lib/view.js +16 -19
  67. data/server/node_modules/express/lib/view/view.js +1 -2
  68. data/server/node_modules/express/node_modules/connect/lib/connect.js +1 -1
  69. data/server/node_modules/express/node_modules/connect/lib/http.js +0 -2
  70. data/server/node_modules/express/node_modules/connect/lib/middleware/bodyParser.js +31 -135
  71. data/server/node_modules/express/node_modules/connect/lib/middleware/limit.js +1 -5
  72. data/server/node_modules/express/node_modules/connect/lib/middleware/session.js +2 -2
  73. data/server/node_modules/express/node_modules/connect/lib/middleware/static.js +21 -26
  74. data/server/node_modules/express/node_modules/connect/lib/middleware/staticCache.js +38 -91
  75. data/server/node_modules/express/node_modules/connect/lib/middleware/vhost.js +1 -1
  76. data/server/node_modules/express/node_modules/connect/lib/utils.js +4 -11
  77. data/server/node_modules/express/node_modules/connect/package.json +6 -7
  78. data/server/node_modules/express/node_modules/connect/test.js +31 -44
  79. data/server/node_modules/express/node_modules/mime/index.js +1 -0
  80. data/server/node_modules/express/node_modules/mime/mime.js +3 -3
  81. data/server/node_modules/express/node_modules/mime/{types/mime.types → mime.types} +0 -0
  82. data/server/node_modules/express/node_modules/mime/{types/node.types → node.types} +0 -17
  83. data/server/node_modules/express/node_modules/mime/package.json +10 -21
  84. data/server/node_modules/express/node_modules/mime/test.js +3 -2
  85. data/server/node_modules/express/node_modules/qs/History.md +0 -11
  86. data/server/node_modules/express/node_modules/qs/Makefile +3 -1
  87. data/server/node_modules/express/node_modules/qs/Readme.md +4 -2
  88. data/server/node_modules/express/node_modules/qs/lib/querystring.js +74 -100
  89. data/server/node_modules/express/node_modules/qs/package.json +2 -9
  90. data/server/node_modules/express/node_modules/qs/support/expresso/History.md +128 -0
  91. data/server/node_modules/express/node_modules/qs/support/expresso/Makefile +53 -0
  92. data/server/node_modules/express/node_modules/qs/support/expresso/Readme.md +61 -0
  93. data/server/node_modules/express/node_modules/qs/support/expresso/bin/expresso +856 -0
  94. data/server/node_modules/express/node_modules/qs/support/expresso/docs/api.html +1080 -0
  95. data/server/node_modules/express/node_modules/qs/support/expresso/docs/index.html +377 -0
  96. data/server/node_modules/express/node_modules/qs/support/expresso/docs/index.md +290 -0
  97. data/server/node_modules/express/node_modules/qs/support/expresso/docs/layout/foot.html +3 -0
  98. data/server/node_modules/express/node_modules/qs/support/expresso/docs/layout/head.html +42 -0
  99. data/server/node_modules/express/node_modules/qs/support/expresso/lib/bar.js +4 -0
  100. data/server/node_modules/express/node_modules/qs/support/expresso/lib/foo.js +16 -0
  101. data/server/node_modules/express/node_modules/qs/support/expresso/package.json +12 -0
  102. data/server/node_modules/express/node_modules/qs/support/expresso/test/assert.test.js +91 -0
  103. data/server/node_modules/express/node_modules/qs/support/expresso/test/async.test.js +12 -0
  104. data/server/node_modules/express/node_modules/qs/support/expresso/test/bar.test.js +13 -0
  105. data/server/node_modules/express/node_modules/qs/support/expresso/test/foo.test.js +14 -0
  106. data/server/node_modules/express/node_modules/qs/support/expresso/test/http.test.js +146 -0
  107. data/server/node_modules/express/node_modules/qs/support/expresso/test/serial/async.test.js +39 -0
  108. data/server/node_modules/express/node_modules/qs/support/expresso/test/serial/http.test.js +48 -0
  109. data/server/node_modules/express/node_modules/qs/support/should/History.md +22 -0
  110. data/server/node_modules/express/node_modules/qs/support/should/Makefile +6 -0
  111. data/server/node_modules/express/node_modules/qs/support/should/Readme.md +248 -0
  112. data/server/node_modules/express/node_modules/qs/support/should/examples/runner.js +53 -0
  113. data/server/node_modules/express/node_modules/qs/support/should/index.js +2 -0
  114. data/server/node_modules/express/node_modules/qs/support/should/lib/eql.js +91 -0
  115. data/server/node_modules/express/node_modules/qs/support/should/lib/should.js +548 -0
  116. data/server/node_modules/express/node_modules/qs/support/should/package.json +8 -0
  117. data/server/node_modules/express/node_modules/qs/support/should/test/should.test.js +358 -0
  118. data/server/node_modules/express/node_modules/qs/test/{parse.js → parse.test.js} +2 -1
  119. data/server/node_modules/express/node_modules/qs/test/{stringify.js → stringify.test.js} +0 -0
  120. data/server/node_modules/express/package.json +8 -9
  121. data/server/node_modules/node-uuid/README.md +67 -166
  122. data/server/node_modules/node-uuid/package.json +3 -5
  123. data/server/node_modules/node-uuid/{benchmark → test}/benchmark-native.c +0 -0
  124. data/server/node_modules/node-uuid/test/benchmark.js +27 -0
  125. data/server/node_modules/node-uuid/test/test.html +0 -3
  126. data/server/node_modules/node-uuid/test/test.js +57 -214
  127. data/server/node_modules/node-uuid/uuid.js +56 -225
  128. data/server/node_modules/restler/README.md +7 -20
  129. data/server/node_modules/restler/bin/restler +1 -1
  130. data/server/node_modules/restler/lib/multipartform.js +8 -9
  131. data/server/node_modules/restler/lib/restler.js +22 -64
  132. data/server/node_modules/restler/package.json +2 -2
  133. data/server/node_modules/restler/test/restler.js +2 -22
  134. data/server/node_modules/restler/test/test_helper.js +1 -20
  135. data/server/package.json +10 -10
  136. data/server/web.js +7 -30
  137. metadata +96 -89
  138. data/server/node_modules/connect-form/node_modules/formidable/test/fixture/file/plain.txt +0 -1
  139. data/server/node_modules/connect-form/node_modules/formidable/test/fixture/http/no-filename/generic.http +0 -13
  140. data/server/node_modules/connect-form/node_modules/formidable/test/fixture/js/no-filename.js +0 -3
  141. data/server/node_modules/express/node_modules/connect/node_modules/formidable/Makefile +0 -14
  142. data/server/node_modules/express/node_modules/connect/node_modules/formidable/Readme.md +0 -286
  143. data/server/node_modules/express/node_modules/connect/node_modules/formidable/TODO +0 -3
  144. data/server/node_modules/express/node_modules/connect/node_modules/formidable/benchmark/bench-multipart-parser.js +0 -70
  145. data/server/node_modules/express/node_modules/connect/node_modules/formidable/example/post.js +0 -43
  146. data/server/node_modules/express/node_modules/connect/node_modules/formidable/example/upload.js +0 -48
  147. data/server/node_modules/express/node_modules/connect/node_modules/formidable/index.js +0 -1
  148. data/server/node_modules/express/node_modules/connect/node_modules/formidable/lib/file.js +0 -61
  149. data/server/node_modules/express/node_modules/connect/node_modules/formidable/lib/incoming_form.js +0 -377
  150. data/server/node_modules/express/node_modules/connect/node_modules/formidable/lib/index.js +0 -3
  151. data/server/node_modules/express/node_modules/connect/node_modules/formidable/lib/multipart_parser.js +0 -312
  152. data/server/node_modules/express/node_modules/connect/node_modules/formidable/lib/querystring_parser.js +0 -25
  153. data/server/node_modules/express/node_modules/connect/node_modules/formidable/lib/util.js +0 -6
  154. data/server/node_modules/express/node_modules/connect/node_modules/formidable/package.json +0 -22
  155. data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/common.js +0 -19
  156. data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/funkyfilename.txt +0 -1
  157. data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/plain.txt +0 -1
  158. data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/no-filename/generic.http +0 -13
  159. data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/info.md +0 -3
  160. data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/osx-chrome-13.http +0 -26
  161. data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/osx-firefox-3.6.http +0 -24
  162. data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/osx-safari-5.http +0 -23
  163. data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/xp-chrome-12.http +0 -24
  164. data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/xp-ie-7.http +0 -22
  165. data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/xp-ie-8.http +0 -22
  166. data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/xp-safari-5.http +0 -22
  167. data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/no-filename.js +0 -3
  168. data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/special-chars-in-filename.js +0 -21
  169. data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/multi_video.upload +0 -0
  170. data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/multipart.js +0 -72
  171. data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/integration/test-fixtures.js +0 -89
  172. data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/common.js +0 -24
  173. data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/integration/test-multipart-parser.js +0 -80
  174. data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-file.js +0 -104
  175. data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-incoming-form.js +0 -715
  176. data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-multipart-parser.js +0 -50
  177. data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-querystring-parser.js +0 -45
  178. data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/system/test-multi-video-upload.js +0 -72
  179. data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/run.js +0 -2
  180. data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/unit/test-incoming-form.js +0 -63
  181. data/server/node_modules/express/node_modules/connect/node_modules/formidable/tool/record.js +0 -47
  182. data/server/node_modules/express/node_modules/mkdirp/LICENSE +0 -21
  183. data/server/node_modules/express/node_modules/mkdirp/README.markdown +0 -21
  184. data/server/node_modules/express/node_modules/mkdirp/examples/pow.js +0 -6
  185. data/server/node_modules/express/node_modules/mkdirp/examples/pow.js.orig +0 -6
  186. data/server/node_modules/express/node_modules/mkdirp/examples/pow.js.rej +0 -19
  187. data/server/node_modules/express/node_modules/mkdirp/index.js +0 -20
  188. data/server/node_modules/express/node_modules/mkdirp/package.json +0 -23
  189. data/server/node_modules/express/node_modules/mkdirp/test/mkdirp.js +0 -28
  190. data/server/node_modules/express/node_modules/mkdirp/test/race.js +0 -41
  191. data/server/node_modules/express/node_modules/mkdirp/test/rel.js +0 -32
  192. data/server/node_modules/express/node_modules/qs/test/mocha.opts +0 -2
  193. data/server/node_modules/express/testing/foo/app.js +0 -35
  194. data/server/node_modules/express/testing/foo/package.json +0 -9
  195. data/server/node_modules/express/testing/foo/public/stylesheets/style.css +0 -8
  196. data/server/node_modules/express/testing/foo/routes/index.js +0 -10
  197. data/server/node_modules/express/testing/foo/views/index.jade +0 -2
  198. data/server/node_modules/express/testing/foo/views/layout.jade +0 -6
  199. data/server/node_modules/express/testing/index.js +0 -43
  200. data/server/node_modules/express/testing/public/test.txt +0 -2971
  201. data/server/node_modules/express/testing/views/page.html +0 -1
  202. data/server/node_modules/express/testing/views/page.jade +0 -3
  203. data/server/node_modules/express/testing/views/test.md +0 -1
  204. data/server/node_modules/express/testing/views/user/index.jade +0 -1
  205. data/server/node_modules/express/testing/views/user/list.jade +0 -1
  206. data/server/node_modules/node-uuid/benchmark/README.md +0 -53
  207. data/server/node_modules/node-uuid/benchmark/bench.gnu +0 -174
  208. data/server/node_modules/node-uuid/benchmark/bench.sh +0 -34
  209. data/server/node_modules/node-uuid/benchmark/benchmark.js +0 -84
  210. data/server/node_modules/node-uuid/test/benchmark-native +0 -0
  211. data/server/node_modules/node-uuid/test/compare_v1.js +0 -63
@@ -0,0 +1,131 @@
1
+ var eyes = require('eyes').inspector({ stream: null, styles: false });
2
+
3
+ // Stylize a string
4
+ this.stylize = function stylize(str, style) {
5
+ var styles = {
6
+ 'bold' : [1, 22],
7
+ 'italic' : [3, 23],
8
+ 'underline' : [4, 24],
9
+ 'cyan' : [96, 39],
10
+ 'yellow' : [33, 39],
11
+ 'green' : [32, 39],
12
+ 'red' : [31, 39],
13
+ 'grey' : [90, 39],
14
+ 'green-hi' : [92, 32],
15
+ };
16
+ return '\033[' + styles[style][0] + 'm' + str +
17
+ '\033[' + styles[style][1] + 'm';
18
+ };
19
+
20
+ var $ = this.$ = function (str) {
21
+ str = new(String)(str);
22
+
23
+ ['bold', 'grey', 'yellow', 'red', 'green', 'white', 'cyan', 'italic'].forEach(function (style) {
24
+ Object.defineProperty(str, style, {
25
+ get: function () {
26
+ return exports.$(exports.stylize(this, style));
27
+ }
28
+ });
29
+ });
30
+ return str;
31
+ };
32
+
33
+ this.puts = function (options) {
34
+ var stylize = exports.stylize;
35
+ options.stream || (options.stream = process.stdout);
36
+ options.tail = options.tail || '';
37
+
38
+ return function (args) {
39
+ args = Array.prototype.slice.call(arguments);
40
+ if (!options.raw) {
41
+ args = args.map(function (a) {
42
+ return a.replace(/`([^`]+)`/g, function (_, capture) { return stylize(capture, 'italic') })
43
+ .replace(/\*([^*]+)\*/g, function (_, capture) { return stylize(capture, 'bold') });
44
+ });
45
+ }
46
+ return options.stream.write(args.join('\n') + options.tail);
47
+ };
48
+ };
49
+
50
+ this.result = function (event) {
51
+ var result = [], buffer = [], time = '', header;
52
+ var complete = event.honored + event.pending + event.errored + event.broken;
53
+ var status = (event.errored && 'errored') || (event.broken && 'broken') ||
54
+ (event.honored && 'honored') || (event.pending && 'pending');
55
+
56
+ if (event.total === 0) {
57
+ return [$("Could not find any tests to run.").bold.red];
58
+ }
59
+
60
+ event.honored && result.push($(event.honored).bold + " honored");
61
+ event.broken && result.push($(event.broken).bold + " broken");
62
+ event.errored && result.push($(event.errored).bold + " errored");
63
+ event.pending && result.push($(event.pending).bold + " pending");
64
+
65
+ if (complete < event.total) {
66
+ result.push($(event.total - complete).bold + " dropped");
67
+ }
68
+
69
+ result = result.join(' ∙ ');
70
+
71
+ header = {
72
+ honored: '✓ ' + $('OK').bold.green,
73
+ broken: '✗ ' + $('Broken').bold.yellow,
74
+ errored: '✗ ' + $('Errored').bold.red,
75
+ pending: '- ' + $('Pending').bold.cyan
76
+ }[status] + ' » ';
77
+
78
+ if (typeof(event.time) === 'number') {
79
+ time = ' (' + event.time.toFixed(3) + 's)';
80
+ time = this.stylize(time, 'grey');
81
+ }
82
+ buffer.push(header + result + time + '\n');
83
+
84
+ return buffer;
85
+ };
86
+
87
+ this.inspect = function inspect(val) {
88
+ return '\033[1m' + eyes(val) + '\033[22m';
89
+ };
90
+
91
+ this.error = function (obj) {
92
+ var string = '✗ ' + $('Errored ').red + '» ';
93
+ string += $(obj.error).red.bold + '\n';
94
+ string += (obj.context ? ' in ' + $(obj.context).red + '\n': '');
95
+ string += ' in ' + $(obj.suite.subject).red + '\n';
96
+ string += ' in ' + $(obj.suite._filename).red;
97
+
98
+ return string;
99
+ };
100
+
101
+ this.contextText = function (event) {
102
+ return ' ' + event;
103
+ };
104
+
105
+ this.vowText = function (event) {
106
+ var buffer = [];
107
+
108
+ buffer.push(' ' + {
109
+ honored: ' ✓ ',
110
+ broken: ' ✗ ',
111
+ errored: ' ✗ ',
112
+ pending: ' - '
113
+ }[event.status] + this.stylize(event.title, ({
114
+ honored: 'green',
115
+ broken: 'yellow',
116
+ errored: 'red',
117
+ pending: 'cyan'
118
+ })[event.status]));
119
+
120
+ if (event.status === 'broken') {
121
+ buffer.push(' » ' + event.exception);
122
+ } else if (event.status === 'errored') {
123
+ if (event.exception.type === 'promise') {
124
+ buffer.push(' » ' + this.stylize("An unexpected error was caught: " +
125
+ this.stylize(event.exception.error, 'bold'), 'red'));
126
+ } else {
127
+ buffer.push(' ' + this.stylize(event.exception, 'red'));
128
+ }
129
+ }
130
+ return buffer.join('\n');
131
+ };
@@ -0,0 +1,55 @@
1
+
2
+ this.Context = function (vow, ctx, env) {
3
+ var that = this;
4
+
5
+ this.tests = vow.callback;
6
+ this.topics = (ctx.topics || []).slice(0);
7
+ this.emitter = null;
8
+ this.env = env || {};
9
+ this.env.context = this;
10
+
11
+ this.env.callback = function (/* arguments */) {
12
+ var ctx = this;
13
+ var args = Array.prototype.slice.call(arguments);
14
+
15
+ var emit = (function (args) {
16
+ //
17
+ // Convert callback-style results into events.
18
+ //
19
+ if (vow.batch.suite.options.error) {
20
+ return function () {
21
+ var e = args.shift();
22
+ that.emitter.ctx = ctx;
23
+ // We handle a special case, where the first argument is a
24
+ // boolean, in which case we treat it as a result, and not
25
+ // an error. This is useful for `path.exists` and other
26
+ // functions like it, which only pass a single boolean
27
+ // parameter instead of the more common (error, result) pair.
28
+ if (typeof(e) === 'boolean' && args.length === 0) {
29
+ that.emitter.emit.call(that.emitter, 'success', e);
30
+ } else {
31
+ if (e) { that.emitter.emit.apply(that.emitter, ['error', e].concat(args)) }
32
+ else { that.emitter.emit.apply(that.emitter, ['success'].concat(args)) }
33
+ }
34
+ };
35
+ } else {
36
+ return function () {
37
+ that.emitter.ctx = ctx;
38
+ that.emitter.emit.apply(that.emitter, ['success'].concat(args));
39
+ };
40
+ }
41
+ })(args.slice(0));
42
+ // If `this.callback` is called synchronously,
43
+ // the emitter will not have been set yet,
44
+ // so we defer the emition, that way it'll behave
45
+ // asynchronously.
46
+ if (that.emitter) { emit() }
47
+ else { process.nextTick(emit) }
48
+ };
49
+ this.name = vow.description;
50
+ this.title = [
51
+ ctx.title || '',
52
+ vow.description || ''
53
+ ].join(/^[#.:]/.test(vow.description) ? '' : ' ').trim();
54
+ };
55
+
@@ -0,0 +1,29 @@
1
+
2
+ exports.coverage = function (filename, data) {
3
+ var ret = {
4
+ filename: filename,
5
+ coverage: 0,
6
+ hits: 0,
7
+ misses: 0,
8
+ sloc : 0
9
+ };
10
+
11
+ var source = data.source;
12
+ ret.source = source.map(function (line, num) {
13
+ num++;
14
+
15
+ if (data[num] === 0) {
16
+ ret.misses++;
17
+ ret.sloc++;
18
+ } else if (data[num] !== undefined) {
19
+ ret.hits++;
20
+ ret.sloc++;
21
+ }
22
+
23
+ return { line: line, coverage: (data[num] === undefined ? '' : data[num]) };
24
+ });
25
+
26
+ ret.coverage = (ret.hits / ret.sloc) * 100;
27
+
28
+ return ret;
29
+ };
@@ -0,0 +1,61 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <style type="text/css">
5
+ .covered {
6
+ background-color: green;
7
+ }
8
+ .uncovered {
9
+ background-color: red;
10
+ }
11
+ .coverage {
12
+ font-size: 0.8em;
13
+ color: #333;
14
+ }
15
+ .coverage.fullCoverage {
16
+ background-color:#0f0;
17
+ color: #111;
18
+ }
19
+ .coverage.okCoverage {
20
+ background-color: orange;
21
+ }
22
+ .coverage.poorCoverage {
23
+ background-color: red;
24
+ }
25
+ .code {
26
+ font-family: "Consolas", "Courier New", Courier, mono;
27
+ white-space: pre;
28
+ line-height: 16px;
29
+ }
30
+ .collapsed {
31
+ display: none;
32
+ }
33
+ body {
34
+ margin-left: 20px;
35
+ margin-top: 8px;
36
+ background-color: white;
37
+ color: black;
38
+ font-size: 16px;
39
+ }
40
+ ol {
41
+ margin-left: 20px;
42
+ margin-bottom: 40px;
43
+ width: 800px;
44
+ line-height: 18px;
45
+ -moz-box-shadow: 10px 10px 5px #888;
46
+ -webkit-box-shadow: 10px 10px 5px #888;
47
+ box-shadow: 10px 10px 5px #888;
48
+ }
49
+ </style>
50
+ <script type="text/javascript">
51
+ function expando(elem) {
52
+ // We're skipping the '/n' text element sibling.
53
+ var olElement= elem.nextSibling.nextSibling;
54
+ var currentState= olElement.className;
55
+ if( currentState == "collapsed" ) currentState= "";
56
+ else currentState= "collapsed";
57
+ olElement.className= currentState;
58
+ }
59
+ </script>
60
+ </head>
61
+ <body>
@@ -0,0 +1,54 @@
1
+ var sys = require('sys'),
2
+ fs = require('fs'),
3
+ file = require('./file');
4
+
5
+ this.name = 'coverage-report-html';
6
+
7
+ function getCoverageClass( data ) {
8
+ var fullCoverage= (data.coverage == 100);
9
+ var okCoverage= (!fullCoverage && data.coverage >=60);
10
+ var coverageClass= '';
11
+ if( fullCoverage ) coverageClass= 'fullCoverage';
12
+ else if( okCoverage) coverageClass= 'okCoverage';
13
+ else coverageClass= 'poorCoverage';
14
+ return coverageClass;
15
+ }
16
+ this.report = function (coverageMap) {
17
+ var out, head, foot;
18
+
19
+ try {
20
+ out = fs.openSync("coverage.html", "w");
21
+ head = fs.readFileSync(__dirname + "/fragments/coverage-head.html", "utf8");
22
+ foot = fs.readFileSync(__dirname + "/fragments/coverage-foot.html", "utf8");
23
+ } catch (error) {
24
+ sys.print("Error: Unable to write to file coverage.html\n");
25
+ return;
26
+ }
27
+
28
+ fs.writeSync(out, head);
29
+
30
+ for (var filename in coverageMap) {
31
+ if (coverageMap.hasOwnProperty(filename)) {
32
+ var data = file.coverage(filename, coverageMap[filename]);
33
+ var coverageClass= getCoverageClass( data );
34
+ fs.writeSync(out, "<h2>" + filename + "</h2>\n");
35
+ fs.writeSync(out, '<span class="coverage '+ coverageClass+'">' + "[ hits: " + data.hits);
36
+ fs.writeSync(out, ", misses: " + data.misses + ", sloc: " + data.sloc);
37
+ fs.writeSync(out, ", coverage: " + data.coverage.toFixed(2) + "% ]" + "</span> <a href='#' onclick='expando(this)'>[+]</a>\n");
38
+ fs.writeSync(out, "<ol class='collapsed'>\n");
39
+
40
+ for (var i = 0; i < data.source.length; i++) {
41
+ fs.writeSync(out, ' <li class="code ');
42
+ fs.writeSync(out, (data.source[i].coverage === 0 ? 'uncovered' : 'covered'));
43
+ fs.writeSync(out, '" coverage="' + data.source[i].coverage + '">');
44
+ fs.writeSync(out, data.source[i].line + "</li>\n");
45
+ }
46
+
47
+ fs.writeSync(out, "</ol>\n");
48
+ fs.writeSync(out, "<hr/>\n");
49
+ }
50
+ }
51
+
52
+ fs.writeSync(out, foot);
53
+ fs.close(out);
54
+ };
@@ -0,0 +1,54 @@
1
+ var sys = require('sys'),
2
+ fs = require('fs'),
3
+ file = require('./file');
4
+
5
+ this.name = 'coverage-report-json';
6
+
7
+ this.report = function (coverageMap) {
8
+ var output = {
9
+ meta: {
10
+ "generator": "vowsjs",
11
+ "generated": new Date().toString(),
12
+ "instrumentation": "node-jscoverage",
13
+ "file-version": "1.0"
14
+ },
15
+ files: [ ],
16
+ coverage: [ ]
17
+ };
18
+
19
+
20
+ for (var filename in coverageMap) {
21
+ if (coverageMap.hasOwnProperty(filename)) {
22
+ var data = file.coverage(filename, coverageMap[filename]);
23
+
24
+ var coverage = {
25
+ file: filename,
26
+ coverage: data.coverage.toFixed(2),
27
+ hits: data.hits,
28
+ misses: data.misses,
29
+ sloc: data.sloc,
30
+ source: { }
31
+ };
32
+
33
+ for (var i = 0; i < data.source.length; i++) {
34
+ coverage.source[i + 1] = {
35
+ line: data.source[i].line,
36
+ coverage: data.source[i].coverage
37
+ };
38
+ }
39
+
40
+ output.coverage.push(coverage);
41
+
42
+ output.files.push(filename);
43
+ }
44
+ }
45
+
46
+ try {
47
+ out = fs.openSync("coverage.json", "w");
48
+ fs.writeSync(out, JSON.stringify(output));
49
+ fs.close(out);
50
+ } catch (error) {
51
+ sys.print("Error: Unable to write to file coverage.json\n");
52
+ return;
53
+ }
54
+ };
@@ -0,0 +1,38 @@
1
+ var sys = require('sys'),
2
+ file = require('./file');
3
+
4
+ this.name = 'coverage-report-plain';
5
+
6
+ function lpad(str, width) {
7
+ str = String(str);
8
+ var n = width - str.length;
9
+
10
+ if (n < 1) {
11
+ return str;
12
+ }
13
+
14
+ while (n--) {
15
+ str = ' ' + str;
16
+ }
17
+
18
+ return str;
19
+ }
20
+
21
+
22
+ this.report = function (coverageMap) {
23
+ for (var filename in coverageMap) {
24
+ if (coverageMap.hasOwnProperty(filename)) {
25
+ var data = file.coverage(filename, coverageMap[filename]);
26
+
27
+ sys.print(filename + ":\n");
28
+ sys.print("[ hits: " + data.hits + ", misses: " + data.misses);
29
+ sys.print(", sloc: " + data.sloc + ", coverage: " + data.coverage.toFixed(2) + "% ]\n");
30
+
31
+ for (var i = 0; i < data.source.length; i++) {
32
+ sys.print(lpad(data.source[i].coverage, 5) + " | " + data.source[i].line + "\n");
33
+ }
34
+
35
+ sys.print("\n");
36
+ }
37
+ }
38
+ };
@@ -0,0 +1,28 @@
1
+ var events = require('events');
2
+ //
3
+ // Wrap a Node.js style async function into an EventEmmitter
4
+ //
5
+ this.prepare = function (obj, targets) {
6
+ targets.forEach(function (target) {
7
+ if (target in obj) {
8
+ obj[target] = (function (fun) {
9
+ return function () {
10
+ var args = Array.prototype.slice.call(arguments);
11
+ var ee = new(events.EventEmitter);
12
+
13
+ args.push(function (err /* [, data] */) {
14
+ var args = Array.prototype.slice.call(arguments, 1);
15
+
16
+ if (err) { ee.emit.apply(ee, ['error', err].concat(args)) }
17
+ else { ee.emit.apply(ee, ['success'].concat(args)) }
18
+ });
19
+ fun.apply(obj, args);
20
+
21
+ return ee;
22
+ };
23
+ })(obj[target]);
24
+ }
25
+ });
26
+ return obj;
27
+ };
28
+