vulcan 0.2.5 → 0.3.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 (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,18 @@
1
+ var vows = require('../../../lib/vows'),
2
+ assert = require('assert');
3
+
4
+ var obvious;
5
+ vows.describe('failing').addBatch({
6
+ 'Obvious test': obvious = {
7
+ topic: function () {
8
+ this.callback(null, false);
9
+ },
10
+ 'should work': function (result) {
11
+ assert.ok(result);
12
+ }
13
+ // but it won't
14
+ },
15
+ 'Obvious test #2': obvious,
16
+ 'Obvious test #3': obvious,
17
+ 'Obvious test #4': obvious
18
+ }).export(module);
@@ -0,0 +1,18 @@
1
+ var vows = require('../../../lib/vows'),
2
+ assert = require('assert');
3
+
4
+ var obvious;
5
+ vows.describe('stderr').addBatch({
6
+ 'Obvious test': obvious = {
7
+ topic: function () {
8
+ this.callback(null, true);
9
+ },
10
+ 'should work': function (result) {
11
+ console.log('oh no!');
12
+ assert.ok(result);
13
+ }
14
+ },
15
+ 'Obvious test #2': obvious,
16
+ 'Obvious test #3': obvious,
17
+ 'Obvious test #4': obvious
18
+ }).export(module);
@@ -0,0 +1,17 @@
1
+ var vows = require('../../../lib/vows'),
2
+ assert = require('assert');
3
+
4
+ var obvious;
5
+ vows.describe('passing').addBatch({
6
+ 'Obvious test': obvious = {
7
+ topic: function () {
8
+ this.callback(null, true);
9
+ },
10
+ 'should work': function (result) {
11
+ assert.ok(result);
12
+ }
13
+ },
14
+ 'Obvious test #2': obvious,
15
+ 'Obvious test #3': obvious,
16
+ 'Obvious test #4': obvious
17
+ }).export(module);
@@ -0,0 +1,18 @@
1
+ var vows = require('../../../lib/vows'),
2
+ assert = require('assert');
3
+
4
+ var obvious;
5
+ vows.describe('stderr').addBatch({
6
+ 'Obvious test': obvious = {
7
+ topic: function () {
8
+ this.callback(null, true);
9
+ },
10
+ 'should work': function (result) {
11
+ console.error('oh no!');
12
+ assert.ok(result);
13
+ }
14
+ },
15
+ 'Obvious test #2': obvious,
16
+ 'Obvious test #3': obvious,
17
+ 'Obvious test #4': obvious
18
+ }).export(module);
@@ -0,0 +1,140 @@
1
+ var vows = require('../lib/vows'),
2
+ assert = require('assert'),
3
+ path = require('path'),
4
+ exec = require('child_process').exec;
5
+
6
+ function generateTopic(args, file) {
7
+ return function () {
8
+ var cmd = './bin/vows' + ' -i ' + (args || '') +
9
+ ' ./test/fixtures/isolate/' + file,
10
+ options = {cwd: path.resolve(__dirname + '/../')},
11
+ callback = this.callback;
12
+
13
+ exec(cmd, options, function (err, stdout, stderr) {
14
+ callback(null, {
15
+ err: err,
16
+ stdout: stdout,
17
+ stderr: stderr
18
+ });
19
+ });
20
+ }
21
+ };
22
+
23
+ function assertExecOk(r) {
24
+ assert.isNull(r.err);
25
+ }
26
+
27
+ function assertExecNotOk(r) {
28
+ assert.isNotNull(r.err);
29
+ }
30
+
31
+ function parseResults(stdout) {
32
+ return stdout.split(/\n/g).map(function (s) {
33
+ if (!s) return;
34
+ return JSON.parse(s);
35
+ }).filter(function (s) {return s});
36
+ }
37
+
38
+ function assertResultTypePresent(results, type) {
39
+ assert.ok(results.some(function (result) {
40
+ return result[0] == type;
41
+ }));
42
+ }
43
+
44
+ function assertResultsFinish(results, expected) {
45
+ var finish = results[results.length - 1];
46
+ assert.equal(finish[0], 'finish');
47
+
48
+ finish = finish[1];
49
+
50
+ Object.keys(expected).forEach(function (key) {
51
+ assert.equal(finish[key], expected[key]);
52
+ });
53
+ }
54
+
55
+ vows.describe('vows/isolate').addBatch({
56
+ 'Running vows with -i flag for test/fixtures/isolate/': {
57
+ 'passing.js': {
58
+ 'with default reporter': {
59
+ topic: generateTopic(null, 'passing.js'),
60
+ 'should be ok': assertExecOk
61
+ },
62
+ 'with json reporter': {
63
+ topic: generateTopic('--json', 'passing.js'),
64
+ 'should be ok': assertExecOk,
65
+ 'should have correct output': function (r) {
66
+ var results = parseResults(r.stdout)
67
+
68
+ assertResultTypePresent(results, 'subject');
69
+ assertResultTypePresent(results, 'end');
70
+
71
+ assertResultsFinish(results, {
72
+ total: 4,
73
+ honored: 4
74
+ });
75
+ }
76
+ }
77
+ },
78
+ 'failing.js': {
79
+ 'with json reporter': {
80
+ topic: generateTopic('--json', 'failing.js'),
81
+ 'should be not ok': assertExecNotOk,
82
+ 'should have correct output though': function (r) {
83
+ var results = parseResults(r.stdout);
84
+
85
+ assertResultsFinish(results, {
86
+ total: 4,
87
+ broken: 4
88
+ });
89
+ }
90
+ }
91
+ },
92
+ 'stderr.js': {
93
+ 'with json reporter': {
94
+ topic: generateTopic('--json', 'stderr.js'),
95
+ 'should be ok': assertExecOk,
96
+ 'should have stderr': function (r) {
97
+ assert.equal(r.stderr,
98
+ ['oh no!', 'oh no!', 'oh no!', 'oh no!', ''].join('\n'));
99
+ },
100
+ 'should have correct output': function (r) {
101
+ var results= parseResults(r.stdout);
102
+
103
+ assertResultsFinish(results, {
104
+ total: 4,
105
+ honored: 4
106
+ });
107
+ }
108
+ }
109
+ },
110
+ 'log.js': {
111
+ 'with json reporter': {
112
+ topic: generateTopic('--json', 'log.js'),
113
+ 'should be ok': assertExecOk,
114
+ 'should have correct output': function (r) {
115
+ var results= parseResults(r.stdout);
116
+
117
+ assertResultsFinish(results, {
118
+ total: 4,
119
+ honored: 4
120
+ });
121
+ }
122
+ }
123
+ },
124
+ 'all tests (*)': {
125
+ 'with json reporter': {
126
+ topic: generateTopic('--json', '*'),
127
+ 'should be not ok': assertExecNotOk,
128
+ 'should have correct output': function (r) {
129
+ var results= parseResults(r.stdout);
130
+
131
+ assertResultsFinish(results, {
132
+ total: 16,
133
+ broken: 4,
134
+ honored: 12
135
+ });
136
+ }
137
+ }
138
+ }
139
+ }
140
+ }).export(module);
@@ -0,0 +1,133 @@
1
+ /*
2
+ * instanceof is a more complete check then .constructor ===
3
+ *
4
+ * It works when using node's built-in util.inherits function
5
+ * and it also honors a class's entire ancestry
6
+ *
7
+ * Here I am only testing the change to vows in suite.js at line 147 to change
8
+ * the check from .constructor === to instanceof. These tests should demonstrate
9
+ * that this change should work both cases. For completness I also check
10
+ * the case when EventEmitter is an ancestor, not the parent Class.
11
+ *
12
+ */
13
+ var EventEmitter = process.EventEmitter,
14
+ util = require('util'),
15
+ vows = require('vows'),
16
+ assert = require('assert');
17
+
18
+ vows.describe('EventEmitters as a return value from a topic').addBatch({
19
+ 'returning an EventEmitter' : {
20
+ topic : function () {
21
+ //Make an event emitter
22
+ var tmp = new EventEmitter();
23
+ //set it to emit success in a bit
24
+ setTimeout(function () {
25
+ //pass a value to make sure this all works
26
+ tmp.emit('success', 'I work');
27
+ }, 10);
28
+
29
+ return tmp;
30
+ },
31
+ 'will catch what I pass to success' : function (ret) {
32
+ assert.strictEqual(ret, 'I work');
33
+ }
34
+ },
35
+ 'returning a class that uses util.inherit to inherit from EventEmitter' : {
36
+ topic : function () {
37
+ //Make a class that will util.inherit from EventEmitter
38
+ var Class = function () {
39
+ EventEmitter.call(this);
40
+ },
41
+ tmp;
42
+
43
+ //inherit from EventEmitter
44
+ util.inherits(Class, EventEmitter);
45
+ //Get a new one
46
+ tmp = new Class();
47
+ //set it to emit success in a bit
48
+ setTimeout(function () {
49
+ //pass a value to make sure this all works
50
+ tmp.emit('success', 'I work');
51
+ }, 10);
52
+
53
+ return tmp;
54
+ },
55
+ 'will catch what I pass to success' : function (ret) {
56
+ assert.strictEqual(ret, 'I work');
57
+ }
58
+ },
59
+ 'returning a class that uses Class.prototype = new EventEmitter()' : {
60
+ topic : function () {
61
+ //Make a class that will inherit from EventEmitter
62
+ var Class = function () {}, tmp;
63
+ //inherit
64
+ Class.prototype = new EventEmitter();
65
+ //Get a new one
66
+ tmp = new Class();
67
+ //set it to emit success in a bit
68
+ setTimeout(function () {
69
+ //pass a value to make sure this all works
70
+ tmp.emit('success', 'I work');
71
+ }, 10);
72
+
73
+ return tmp;
74
+ },
75
+ 'will catch what I pass to success' : function (ret) {
76
+ assert.strictEqual(ret, 'I work');
77
+ }
78
+ },
79
+ 'returning a class that uses util.inherit to inherit from a class that inherits from EventEmitter ' : {
80
+ topic : function () {
81
+ //Class1 inherits from EventEmitter
82
+ var Class1 = function () {
83
+ var self = this;
84
+ EventEmitter.call(self);
85
+ },
86
+ //Class2 inherits from Class1
87
+ Class2 = function () {
88
+ Class1.call(this);
89
+ }, tmp;
90
+ //Inherit
91
+ util.inherits(Class1, EventEmitter);
92
+ util.inherits(Class2, Class1);
93
+ //Get a new one
94
+ tmp = new Class2();
95
+ //set it to emit success in a bit
96
+ setTimeout(function () {
97
+ //pass a value to make sure this all works
98
+ tmp.emit('success', 'I work');
99
+ },10);
100
+
101
+ return tmp;
102
+ },
103
+ 'will catch what I pass to success' : function (ret) {
104
+ assert.strictEqual(ret, 'I work');
105
+ }
106
+ },
107
+ 'returning a class that uses Class2.prototype = new Class1() and Class1.prototype = new EventEmitter()' : {
108
+ topic : function () {
109
+ //Class1 will inherit from EventEmitter
110
+ var Class1 = function () {},
111
+ //Class2 will inherit from Class1
112
+ Class2 = function () {}, tmp;
113
+ //Inherit
114
+ Class1.prototype = new EventEmitter();
115
+ Class2.prototype = new Class1();
116
+ //Get a new one
117
+ tmp = new Class2();
118
+ //seit it to emit success in a bit
119
+ setTimeout(function () {
120
+ //pass a value to make sure this all works
121
+ tmp.emit('success', 'I work');
122
+ },10);
123
+
124
+ return tmp;
125
+ },
126
+ 'will catch what I pass to success' : function (ret) {
127
+ assert.strictEqual(ret, 'I work');
128
+ }
129
+ }
130
+ }).export(module);
131
+
132
+
133
+
@@ -0,0 +1,51 @@
1
+ var path = require('path'),
2
+ events = require('events'),
3
+ assert = require('assert'),
4
+ fs = require('fs'),
5
+ vows = require('../lib/vows');
6
+
7
+ function doSomethingAsync(callback) {
8
+ var err = null;
9
+ var testValue = 'a';
10
+
11
+ process.nextTick(function() {
12
+ callback(err, testValue);
13
+ });
14
+ }
15
+
16
+ function doSomethingAsyncWithError(callback) {
17
+ var err = true;
18
+ var testValue = 'a';
19
+
20
+ process.nextTick(function() {
21
+ callback(err, testValue);
22
+ });
23
+ }
24
+
25
+
26
+ vows.describe('vows/error').addBatch({
27
+ 'Generate success response to async function': {
28
+ topic: function() {
29
+ doSomethingAsync(this.callback)
30
+ },
31
+ 'Validate success': function(err, testValue) {
32
+ assert.ok(!err);
33
+ },
34
+ 'Validate testValue': function(err, testValue) {
35
+ assert.equal(testValue, 'a');
36
+ }
37
+ },
38
+
39
+ 'Generate error response to async function': {
40
+ topic: function() {
41
+ doSomethingAsyncWithError(this.callback)
42
+ },
43
+ 'Validate error': function(err, testValue) {
44
+ assert.ok(err);
45
+ },
46
+ 'Validate testValue': function(err, testValue) {
47
+ // This assertion fails. It shouldn't.
48
+ assert.equal(testValue, 'a');
49
+ }
50
+ }
51
+ }).export(module)
@@ -0,0 +1,374 @@
1
+ var path = require('path'),
2
+ events = require('events'),
3
+ assert = require('assert'),
4
+ fs = require('fs'),
5
+ vows = require('../lib/vows');
6
+
7
+ var api = vows.prepare({
8
+ get: function (id, callback) {
9
+ process.nextTick(function () { callback(null, id) });
10
+ },
11
+ version: function () { return '1.0' }
12
+ }, ['get']);
13
+
14
+ var promiser = function (val) {
15
+ return function () {
16
+ var promise = new(events.EventEmitter);
17
+ process.nextTick(function () { promise.emit('success', val) });
18
+ return promise;
19
+ }
20
+ };
21
+
22
+ vows.describe("Vows").addBatch({
23
+ "A context": {
24
+ topic: promiser("hello world"),
25
+
26
+ "with a nested context": {
27
+ topic: function (parent) {
28
+ this.state = 42;
29
+ return promiser(parent)();
30
+ },
31
+ "has access to the environment": function () {
32
+ assert.equal(this.state, 42);
33
+ },
34
+ "and a sub nested context": {
35
+ topic: function () {
36
+ return this.state;
37
+ },
38
+ "has access to the parent environment": function (r) {
39
+ assert.equal(r, 42);
40
+ assert.equal(this.state, 42);
41
+ },
42
+ "has access to the parent context object": function (r) {
43
+ assert.ok(Array.isArray(this.context.topics));
44
+ assert.include(this.context.topics, "hello world");
45
+ }
46
+ }
47
+ }
48
+ },
49
+ "A nested context": {
50
+ topic: promiser(1),
51
+
52
+ ".": {
53
+ topic: function (a) { return promiser(2)() },
54
+
55
+ ".": {
56
+ topic: function (b, a) { return promiser(3)() },
57
+
58
+ ".": {
59
+ topic: function (c, b, a) { return promiser([4, c, b, a])() },
60
+
61
+ "should have access to the parent topics": function (topics) {
62
+ assert.equal(topics.join(), [4, 3, 2, 1].join());
63
+ }
64
+ },
65
+
66
+ "from": {
67
+ topic: function (c, b, a) { return promiser([4, c, b, a])() },
68
+
69
+ "the parent topics": function(topics) {
70
+ assert.equal(topics.join(), [4, 3, 2, 1].join());
71
+ }
72
+ }
73
+ }
74
+ }
75
+ },
76
+ "Nested contexts with callback-style async": {
77
+ topic: function () {
78
+ fs.stat(__dirname + '/vows-test.js', this.callback);
79
+ },
80
+ 'after a successful `fs.stat`': {
81
+ topic: function (stat) {
82
+ fs.open(__dirname + '/vows-test.js', "r", stat.mode, this.callback);
83
+ },
84
+ 'after a successful `fs.open`': {
85
+ topic: function (fd, stat) {
86
+ fs.read(fd, stat.size, 0, "utf8", this.callback);
87
+ },
88
+ 'after a successful `fs.read`': function (data) {
89
+ assert.match (data, /after a successful `fs.read`/);
90
+ }
91
+ }
92
+ }
93
+ },
94
+ "A nested context with no topics": {
95
+ topic: 45,
96
+ ".": {
97
+ ".": {
98
+ "should pass the value down": function (topic) {
99
+ assert.equal(topic, 45);
100
+ }
101
+ }
102
+ }
103
+ },
104
+ "A Nested context with topic gaps": {
105
+ topic: 45,
106
+ ".": {
107
+ ".": {
108
+ topic: 101,
109
+ ".": {
110
+ ".": {
111
+ topic: function (prev, prev2) {
112
+ return this.context.topics.slice(0);
113
+ },
114
+ "should pass the topics down": function (topics) {
115
+ assert.length(topics, 2);
116
+ assert.equal(topics[0], 101);
117
+ assert.equal(topics[1], 45);
118
+ }
119
+ }
120
+ }
121
+ }
122
+ }
123
+ },
124
+ "A non-promise return value": {
125
+ topic: function () { return 1 },
126
+ "should be converted to a promise": function (val) {
127
+ assert.equal(val, 1);
128
+ }
129
+ },
130
+ "A 'prepared' interface": {
131
+ "with a wrapped function": {
132
+ topic: function () { return api.get(42) },
133
+ "should work as expected": function (val) {
134
+ assert.equal(val, 42);
135
+ }
136
+ },
137
+ "with a non-wrapped function": {
138
+ topic: function () { return api.version() },
139
+ "should work as expected": function (val) {
140
+ assert.equal(val, '1.0');
141
+ }
142
+ }
143
+ },
144
+ "A non-function topic": {
145
+ topic: 45,
146
+
147
+ "should work as expected": function (topic) {
148
+ assert.equal(topic, 45);
149
+ }
150
+ },
151
+ "A non-function topic with a falsy value": {
152
+ topic: 0,
153
+
154
+ "should work as expected": function (topic) {
155
+ assert.equal(topic, 0);
156
+ }
157
+ },
158
+ "A topic returning a function": {
159
+ topic: function () {
160
+ return function () { return 42 };
161
+ },
162
+
163
+ "should work as expected": function (topic) {
164
+ assert.isFunction(topic);
165
+ assert.equal(topic(), 42);
166
+ },
167
+ "in a sub-context": {
168
+ "should work as expected": function (topic) {
169
+ assert.isFunction(topic);
170
+ assert.equal(topic(), 42);
171
+ },
172
+ }
173
+ },
174
+ "A topic emitting an error": {
175
+ topic: function () {
176
+ var promise = new(events.EventEmitter);
177
+ process.nextTick(function () {
178
+ promise.emit("error", 404);
179
+ });
180
+ return promise;
181
+ },
182
+ "shouldn't raise an exception if the test expects it": function (e, res) {
183
+ assert.equal(e, 404);
184
+ assert.ok(! res);
185
+ }
186
+ },
187
+ "A topic not emitting an error": {
188
+ topic: function () {
189
+ var promise = new(events.EventEmitter);
190
+ process.nextTick(function () {
191
+ promise.emit("success", true);
192
+ });
193
+ return promise;
194
+ },
195
+ "should pass `null` as first argument, if the test is expecting an error": function (e, res) {
196
+ assert.strictEqual(e, null);
197
+ assert.equal(res, true);
198
+ },
199
+ "should pass the result as first argument if the test isn't expecting an error": function (res) {
200
+ assert.equal(res, true);
201
+ }
202
+ },
203
+ "A topic with callback-style async": {
204
+ "when successful": {
205
+ topic: function () {
206
+ var that = this;
207
+ process.nextTick(function () {
208
+ that.callback(null, "OK");
209
+ });
210
+ },
211
+ "should work like an event-emitter": function (res) {
212
+ assert.equal(res, "OK");
213
+ },
214
+ "should assign `null` to the error argument": function (e, res) {
215
+ assert.strictEqual(e, null);
216
+ assert.equal(res, "OK");
217
+ }
218
+ },
219
+ "when unsuccessful": {
220
+ topic: function () {
221
+ function async(callback) {
222
+ process.nextTick(function () {
223
+ callback("ERROR");
224
+ });
225
+ }
226
+ async(this.callback);
227
+ },
228
+ "should have a non-null error value": function (e, res) {
229
+ assert.equal(e, "ERROR");
230
+ },
231
+ "should work like an event-emitter": function (e, res) {
232
+ assert.equal(res, undefined);
233
+ }
234
+ },
235
+ "using this.callback synchronously": {
236
+ topic: function () {
237
+ this.callback(null, 'hello');
238
+ },
239
+ "should work the same as returning a value": function (res) {
240
+ assert.equal(res, 'hello');
241
+ }
242
+ },
243
+ "using this.callback with a user context": {
244
+ topic: function () {
245
+ this.callback.call({ boo: true }, null, 'hello');
246
+ },
247
+ "should give access to the user context": function (res) {
248
+ assert.isTrue(this.boo);
249
+ }
250
+ },
251
+ "passing this.callback to a function": {
252
+ topic: function () {
253
+ this.boo = true;
254
+ var async = function (callback) {
255
+ callback(null);
256
+ };
257
+ async(this.callback);
258
+ },
259
+ "should give access to the topic context": function () {
260
+ assert.isTrue(this.boo);
261
+ }
262
+ },
263
+ "with multiple arguments": {
264
+ topic: function () {
265
+ this.callback(null, 1, 2, 3);
266
+ },
267
+ "should pass them to the vow": function (e, a, b, c) {
268
+ assert.strictEqual(e, null);
269
+ assert.strictEqual(a, 1);
270
+ assert.strictEqual(b, 2);
271
+ assert.strictEqual(c, 3);
272
+ },
273
+ "and a sub-topic": {
274
+ topic: function (a, b, c) {
275
+ return [a, b, c];
276
+ },
277
+ "should receive them too": function (val) {
278
+ assert.deepEqual(val, [1, 2, 3]);
279
+ }
280
+ }
281
+ }
282
+ }
283
+ }).addBatch({
284
+ "A Sibling context": {
285
+ "'A', with `this.foo = true`": {
286
+ topic: function () {
287
+ this.foo = true;
288
+ return this;
289
+ },
290
+ "should have `this.foo` set to true": function (res) {
291
+ assert.equal(res.foo, true);
292
+ }
293
+ },
294
+ "'B', with nothing set": {
295
+ topic: function () {
296
+ return this;
297
+ },
298
+ "shouldn't have access to `this.foo`": function (e, res) {
299
+ assert.isUndefined(res.foo);
300
+ }
301
+ }
302
+ }
303
+ }).addBatch({
304
+ "A 2nd batch": {
305
+ topic: function () {
306
+ var p = new(events.EventEmitter);
307
+ setTimeout(function () {
308
+ p.emit("success");
309
+ }, 100);
310
+ return p;
311
+ },
312
+ "should run after the first": function () {}
313
+ }
314
+ }).addBatch({
315
+ "A 3rd batch": {
316
+ topic: true, "should run last": function () {}
317
+ }
318
+ }).addBatch({}).export(module);
319
+
320
+ vows.describe("Vows with a single batch", {
321
+ "This is a batch that's added as the optional parameter to describe()": {
322
+ topic: true,
323
+ "And a vow": function () {}
324
+ }
325
+ }).export(module);
326
+
327
+ vows.describe("Vows with multiple batches added as optional parameters", {
328
+ "First batch": {
329
+ topic: true,
330
+ "should be run first": function () {}
331
+ }
332
+ }, {
333
+ "Second batch": {
334
+ topic: true,
335
+ "should be run second": function () {}
336
+ }
337
+ }).export(module);
338
+
339
+ vows.describe("Vows with teardowns").addBatch({
340
+ "A context": {
341
+ topic: function () {
342
+ return { flag: true };
343
+ },
344
+ "And a vow": function (topic) {
345
+ assert.isTrue(topic.flag);
346
+ },
347
+ "And another vow": function (topic) {
348
+ assert.isTrue(topic.flag);
349
+ },
350
+ "And a final vow": function (topic) {
351
+ assert.isTrue(topic.flag);
352
+ },
353
+ 'subcontext': {
354
+ 'nested': function (_, topic) {
355
+ assert.isTrue(topic.flag);
356
+ }
357
+ },
358
+ teardown: function (topic) {
359
+ topic.flag = false;
360
+ },
361
+ "with a subcontext" : {
362
+ topic: function (topic) {
363
+ var that = this;
364
+ process.nextTick(function () {
365
+ that.callback(null, topic);
366
+ });
367
+ },
368
+ "Waits for the subcontext before teardown" : function(topic) {
369
+ assert.isTrue(topic.flag);
370
+ }
371
+ }
372
+ }
373
+ }).export(module);
374
+