Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

updated jasmine-node

  • Loading branch information...
commit 37716ad6c7858409dd6bbd38c2125489b53d7d8a 1 parent 074a61d
Colin MacKenzie IV sinisterchipmunk authored
Showing with 23,565 additions and 13,440 deletions.
  1. +1 −0  .gitignore
  2. +1 −6 Rakefile
  3. +2 −0  node_modules/jasmine-node/{.gitignore → .npmignore}
  4. +6 −0 node_modules/jasmine-node/.travis.yml
  5. +51 −3 node_modules/jasmine-node/README.md
  6. +54 −0 node_modules/jasmine-node/lib/jasmine-node/async-callback.js
  7. +90 −0 node_modules/jasmine-node/lib/jasmine-node/autotest.js
  8. +83 −17 node_modules/jasmine-node/lib/jasmine-node/cli.js
  9. +53 −76 node_modules/jasmine-node/lib/jasmine-node/index.js
  10. +3 −3 node_modules/jasmine-node/lib/jasmine-node/jasmine-2.0.0.rc1.js
  11. +258 −160 node_modules/jasmine-node/lib/jasmine-node/reporter.js
  12. +80 −0 node_modules/jasmine-node/lib/jasmine-node/requirejs-runner.js
  13. +48 −0 node_modules/jasmine-node/lib/jasmine-node/requirejs-spec-loader.js
  14. +65 −0 node_modules/jasmine-node/lib/jasmine-node/requirejs-wrapper-template.js
  15. +35 −0 node_modules/jasmine-node/lib/jasmine-node/spec-collection.js
  16. +1 −0  node_modules/jasmine-node/node_modules/.bin/r.js
  17. +1 −0  node_modules/jasmine-node/node_modules/coffee-script/CNAME
  18. +1 −1  node_modules/jasmine-node/node_modules/coffee-script/LICENSE
  19. +5 −2 node_modules/jasmine-node/node_modules/coffee-script/README
  20. +1 −1  node_modules/jasmine-node/node_modules/coffee-script/bin/cake
  21. +1 −1  node_modules/jasmine-node/node_modules/coffee-script/bin/coffee
  22. +0 −76 node_modules/jasmine-node/node_modules/coffee-script/lib/cake.js
  23. +17 −1 node_modules/jasmine-node/node_modules/coffee-script/lib/{ → coffee-script}/browser.js
  24. +111 −0 node_modules/jasmine-node/node_modules/coffee-script/lib/coffee-script/cake.js
  25. +62 −30 node_modules/jasmine-node/node_modules/coffee-script/lib/{ → coffee-script}/coffee-script.js
  26. +502 −0 node_modules/jasmine-node/node_modules/coffee-script/lib/coffee-script/command.js
  27. +28 −16 node_modules/jasmine-node/node_modules/coffee-script/lib/{ → coffee-script}/grammar.js
  28. +11 −0 node_modules/jasmine-node/node_modules/coffee-script/lib/{ → coffee-script}/helpers.js
  29. +3 −0  node_modules/jasmine-node/node_modules/coffee-script/lib/{ → coffee-script}/index.js
  30. +187 −51 node_modules/jasmine-node/node_modules/coffee-script/lib/{ → coffee-script}/lexer.js
  31. +1,041 −358 node_modules/jasmine-node/node_modules/coffee-script/lib/{ → coffee-script}/nodes.js
  32. +53 −24 node_modules/jasmine-node/node_modules/coffee-script/lib/{ → coffee-script}/optparse.js
  33. +592 −0 node_modules/jasmine-node/node_modules/coffee-script/lib/coffee-script/parser.js
  34. +235 −0 node_modules/jasmine-node/node_modules/coffee-script/lib/coffee-script/repl.js
  35. +120 −134 node_modules/jasmine-node/node_modules/coffee-script/lib/{ → coffee-script}/rewriter.js
  36. +47 −22 node_modules/jasmine-node/node_modules/coffee-script/lib/{ → coffee-script}/scope.js
  37. +0 −301 node_modules/jasmine-node/node_modules/coffee-script/lib/command.js
  38. +0 −676 node_modules/jasmine-node/node_modules/coffee-script/lib/parser.js
  39. +0 −123 node_modules/jasmine-node/node_modules/coffee-script/lib/repl.js
  40. +8 −4 node_modules/jasmine-node/node_modules/coffee-script/package.json
  41. +0 −3  node_modules/jasmine-node/node_modules/jasmine-reporters/.gitmodules
  42. +1 −0  node_modules/jasmine-node/node_modules/jasmine-reporters/{.gitignore → .npmignore}
  43. +5 −5 node_modules/jasmine-node/node_modules/jasmine-reporters/README.markdown
  44. +0 −10 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/.gitignore
  45. +0 −57 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/ChangeLog
  46. +0 −22 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/LICENSE.BSD
  47. +0 −28 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/README.md
  48. +0 −6 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/examples/arguments.coffee
  49. +0 −8 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/examples/arguments.js
  50. +0 −45 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/examples/colorwheel.coffee
  51. +0 −52 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/examples/colorwheel.js
  52. +0 −8 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/examples/countdown.coffee
  53. +0 −8 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/examples/countdown.js
  54. +0 −64 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/examples/cycle_multiple_urls.js
  55. +0 −28 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/examples/direction.coffee
  56. +0 −34 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/examples/direction.js
  57. +0 −81 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/examples/extract-text.coffee
  58. +0 −121 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/examples/extract-text.js
  59. +0 −8 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/examples/fibo.coffee
  60. +0 −9 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/examples/fibo.js
  61. +0 −36 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/examples/follow.coffee
  62. +0 −37 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/examples/follow.js
  63. +0 −2  node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/examples/hello.coffee
  64. +0 −2  node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/examples/hello.js
  65. +0 −13 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/examples/ipgeocode.coffee
  66. +0 −14 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/examples/ipgeocode.js
  67. +0 −17 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/examples/loadspeed.coffee
  68. +0 −20 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/examples/loadspeed.js
  69. +0 −13 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/examples/movies.coffee
  70. +0 −14 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/examples/movies.js
  71. +0 −10 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/examples/pizza.coffee
  72. +0 −12 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/examples/pizza.js
  73. +0 −21 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/examples/rasterize.coffee
  74. +0 −22 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/examples/rasterize.js
  75. +0 −26 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/examples/run-jasmine.js
  76. +0 −24 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/examples/run-qunit.js
  77. +0 −17 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/examples/seasonfood.coffee
  78. +0 −19 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/examples/seasonfood.js
  79. +0 −13 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/examples/technews.coffee
  80. +0 −14 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/examples/technews.js
  81. +0 −8 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/examples/tweets.coffee
  82. +0 −12 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/examples/tweets.js
  83. +0 −7 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/examples/useragent.coffee
  84. +0 −8 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/examples/useragent.js
  85. +0 −5 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/examples/version.coffee
  86. +0 −5 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/examples/version.js
  87. +0 −40 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/examples/waitfor.coffee
  88. +0 −43 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/examples/waitfor.js
  89. +0 −35 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/examples/weather.coffee
  90. +0 −42 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/examples/weather.js
  91. +0 −3  node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/phantomjs.pro
  92. +0 −20 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/python/INSTALL
  93. +0 −674 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/python/LICENSE
  94. +0 −56 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/python/README
  95. +0 −41 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/python/csconverter.py
  96. +0 −84 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/python/networkaccessmanager.py
  97. +0 −384 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/python/phantom.py
  98. +0 −98 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/python/plugincontroller.py
  99. +0 −1  node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/python/plugins/__init__.py
  100. +0 −154 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/python/pyphantomjs.py
  101. +0 −4,160 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/python/resources.py
  102. +0 −6 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/python/resources.qrc
  103. +0 −8 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/python/resources/coffee-script.js
  104. BIN  node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/python/resources/pyphantomjs-icon.ico
  105. BIN  node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/python/resources/pyphantomjs-icon.png
  106. +0 −14 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/python/tools/build_resources.sh
  107. +0 −52 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/python/tools/setup.py
  108. +0 −126 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/python/utils.py
  109. +0 −67 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/python/webpage.py
  110. +0 −8 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/src/coffee-script.js
  111. +0 −39 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/src/consts.h
  112. +0 −61 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/src/csconverter.cpp
  113. +0 −47 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/src/csconverter.h
  114. +0 −1  node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/src/gif/config.h
  115. +0 −1,111 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/src/gif/egif_lib.c
  116. +0 −20 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/src/gif/gif.pri
  117. +0 −120 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/src/gif/gif_err.c
  118. +0 −160 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/src/gif/gif_hash.c
  119. +0 −59 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/src/gif/gif_hash.h
  120. +0 −336 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/src/gif/gif_lib.h
  121. +0 −59 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/src/gif/gif_lib_private.h
  122. +0 −443 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/src/gif/gifalloc.c
  123. +0 −126 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/src/gif/gifwriter.cpp
  124. +0 −38 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/src/gif/gifwriter.h
  125. +0 −330 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/src/gif/quantize.c
  126. +0 −64 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/src/main.cpp
  127. +0 −119 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/src/networkaccessmanager.cpp
  128. +0 −53 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/src/networkaccessmanager.h
  129. +0 −494 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/src/phantom.cpp
  130. +0 −117 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/src/phantom.h
  131. BIN  node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/src/phantomjs-icon.png
  132. +0 −32 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/src/phantomjs.pro
  133. +0 −7 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/src/phantomjs.qrc
  134. BIN  node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/src/phantomjs_os2.ico
  135. +0 −1  node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/src/phantomjs_os2.rc
  136. BIN  node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/src/phantomjs_win.ico
  137. +0 −1  node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/src/phantomjs_win.rc
  138. +0 −11 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/src/usage.txt
  139. +0 −74 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/src/utils.cpp
  140. +0 −50 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/src/utils.h
  141. +0 −87 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/src/webpage.cpp
  142. +0 −61 node_modules/jasmine-node/node_modules/jasmine-reporters/ext/phantomjs/src/webpage.h
  143. +1 −1  node_modules/jasmine-node/node_modules/jasmine-reporters/package.json
  144. +19 −9 node_modules/jasmine-node/node_modules/jasmine-reporters/src/jasmine.console_reporter.js
  145. +14 −13 node_modules/jasmine-node/node_modules/jasmine-reporters/src/jasmine.junit_reporter.js
  146. +139 −0 node_modules/jasmine-node/node_modules/jasmine-reporters/src/jasmine.teamcity_reporter.js
  147. +2 −1  node_modules/jasmine-node/node_modules/jasmine-reporters/src/load_reporters.js
  148. +172 −28 node_modules/jasmine-node/node_modules/jasmine-reporters/test/phantomjs-testrunner.js
  149. +16 −10 node_modules/jasmine-node/node_modules/jasmine-reporters/test/phantomjs.runner.sh
  150. +0 −1  node_modules/jasmine-node/node_modules/jasmine-reporters/test/pyphantomjs-plugins/saveToFile/__init__.py
  151. +0 −46 node_modules/jasmine-node/node_modules/jasmine-reporters/test/pyphantomjs-plugins/saveToFile/saveToFile.py
  152. +36 −0 node_modules/jasmine-node/node_modules/jasmine-reporters/test/teamcity_reporter.html
  153. +1 −0  node_modules/jasmine-node/node_modules/requirejs/.npmignore
  154. +12,558 −0 node_modules/jasmine-node/node_modules/requirejs/bin/r.js
  155. +24 −0 node_modules/jasmine-node/node_modules/requirejs/package.json
  156. +2,063 −0 node_modules/jasmine-node/node_modules/requirejs/require.js
  157. +3 −0  node_modules/jasmine-node/node_modules/underscore/.npmignore
  158. +1 −0  node_modules/jasmine-node/node_modules/underscore/CNAME
  159. +22 −0 node_modules/jasmine-node/node_modules/underscore/LICENSE
  160. +19 −0 node_modules/jasmine-node/node_modules/underscore/README.md
  161. BIN  node_modules/jasmine-node/node_modules/underscore/favicon.ico
  162. +2,109 −0 node_modules/jasmine-node/node_modules/underscore/index.html
  163. +1 −0  node_modules/jasmine-node/node_modules/underscore/index.js
  164. +10 −0 node_modules/jasmine-node/node_modules/underscore/package.json
  165. BIN  node_modules/jasmine-node/node_modules/underscore/raw/underscore.psd
  166. +32 −0 node_modules/jasmine-node/node_modules/underscore/underscore-min.js
  167. +1,059 −0 node_modules/jasmine-node/node_modules/underscore/underscore.js
  168. +3 −0  node_modules/jasmine-node/node_modules/walkdir/.jshintignore
  169. +2 −0  node_modules/jasmine-node/node_modules/walkdir/.npmignore
  170. +3 −0  node_modules/jasmine-node/node_modules/walkdir/.travis.yml
  171. +29 −0 node_modules/jasmine-node/node_modules/walkdir/package.json
  172. +136 −0 node_modules/jasmine-node/node_modules/walkdir/readme.md
  173. +19 −0 node_modules/jasmine-node/node_modules/walkdir/test.sh
  174. +62 −0 node_modules/jasmine-node/node_modules/walkdir/test/async.js
  175. +33 −0 node_modules/jasmine-node/node_modules/walkdir/test/comparison/find.js
  176. +26 −0 node_modules/jasmine-node/node_modules/walkdir/test/comparison/find.py
  177. +15 −0 node_modules/jasmine-node/node_modules/walkdir/test/comparison/finditsynctest.js
  178. +14 −0 node_modules/jasmine-node/node_modules/walkdir/test/comparison/findittest.js
  179. +24 −0 node_modules/jasmine-node/node_modules/walkdir/test/comparison/fstream.js
  180. +1 −0  node_modules/jasmine-node/node_modules/walkdir/test/comparison/install_test_deps.sh
  181. +18 −0 node_modules/jasmine-node/node_modules/walkdir/test/comparison/lsr.js
  182. +10 −0 node_modules/jasmine-node/node_modules/walkdir/test/comparison/package.json
  183. 0  node_modules/jasmine-node/node_modules/walkdir/test/dir/foo/a/b/c/w
  184. 0  node_modules/jasmine-node/node_modules/walkdir/test/dir/foo/a/b/z
  185. 0  node_modules/jasmine-node/node_modules/walkdir/test/dir/foo/a/y
  186. 0  node_modules/jasmine-node/node_modules/walkdir/test/dir/foo/x
  187. 0  node_modules/jasmine-node/node_modules/walkdir/test/dir/symlinks/dir1/file1
  188. 0  node_modules/jasmine-node/node_modules/walkdir/test/dir/symlinks/dir2/file2
  189. 0  node_modules/jasmine-node/node_modules/walkdir/test/dir/symlinks/file
  190. +19 −0 node_modules/jasmine-node/node_modules/walkdir/test/endearly.js
  191. +37 −0 node_modules/jasmine-node/node_modules/walkdir/test/symlink.js
  192. +50 −0 node_modules/jasmine-node/node_modules/walkdir/test/sync.js
  193. +185 −0 node_modules/jasmine-node/node_modules/walkdir/walkdir.js
  194. +9 −2 node_modules/jasmine-node/package.json
  195. +37 −0 node_modules/jasmine-node/scripts/specs
  196. +8 −0 node_modules/jasmine-node/spec-requirejs/requirejs.spec.js
  197. +8 −0 node_modules/jasmine-node/spec-requirejs/requirejs.sut.js
  198. +7 −0 node_modules/jasmine-node/spec/AsyncSpec.coffee
  199. +22 −0 node_modules/jasmine-node/spec/GrammarHelper.coffee
  200. +6 −0 node_modules/jasmine-node/spec/HelperSpec.coffee
  201. +10 −0 node_modules/jasmine-node/spec/SampleSpecs.js
  202. +150 −0 node_modules/jasmine-node/spec/async-callback_spec.js
  203. +0 −7 node_modules/jasmine-node/spec/include/include_spec.js
  204. +0 −3  node_modules/jasmine-node/spec/include/lib/test.js
  205. +432 −0 node_modules/jasmine-node/spec/reporter_spec.js
  206. +24 −2 node_modules/jasmine-node/specs.sh
  207. +2 −6 spec/node_helper.js
1  .gitignore
View
@@ -0,0 +1 @@
+.rvmrc
7 Rakefile
View
@@ -14,15 +14,10 @@ end
desc "Run Jasmine unit tests under node.js"
task :node do
- # Note that we run node_helper instead of the entire suite.
- # This is because we want the individual specs to be environment
- # agnostic, and if they have to require(glMatrix) they will break
- # in web browsers. The helper takes care of bootstrapping glMatrix
- # and loading the suite.
base = File.dirname(__FILE__)
if system("NODE_PATH=$NODE_PATH:#{base} " \
"node_modules/jasmine-node/bin/jasmine-node " \
- "spec/node_helper.js")
+ "spec")
puts green("Jasmine completed successfully under node")
else
raise red("Jasmine failed under node")
2  node_modules/jasmine-node/.gitignore → node_modules/jasmine-node/.npmignore
View
@@ -8,3 +8,5 @@
.settings
.externalToolBuilders
*.swp
+node_modules
+*~
6 node_modules/jasmine-node/.travis.yml
View
@@ -0,0 +1,6 @@
+language: node_js
+node_js:
+ - 0.6
+branches:
+ only:
+ - travis
54 node_modules/jasmine-node/README.md
View
@@ -1,16 +1,22 @@
jasmine-node
======
+[![Build Status](https://secure.travis-ci.org/spaghetticode/jasmine-node.png)](http://travis-ci.org/spaghetticode/jasmine-node)
+
This node.js module makes the wonderful Pivotal Lab's jasmine
(http://github.com/pivotal/jasmine) spec framework available in
node.js.
+install
+------
+ npm install jasmine-node -g
+
usage
------
-Write the specifications for your code in *.js and *.coffee files in the
-spec/ directory (note: your specification files must end with either
-.spec.js or .spec.coffee; otherwise jasmine-node won't find them!). You
+Write the specifications for your code in *.js and *.coffee files in the
+spec/ directory (note: your specification files must end with either
+.spec.js or .spec.coffee; otherwise jasmine-node won't find them!). You
can use sub-directories to better organise your specs.
If you have installed the npm package, you can run it with:
@@ -25,6 +31,8 @@ environment variable, then run:
You can supply the following arguments:
+ * <code>--autotest</code>, provides automatic execution of specs after
+ each changes
* <code>--coffee</code>, allow execution of .coffee specs
* <code>--color</code>, indicates spec output should uses color to
indicates passing (green) or failing (red) specs
@@ -33,3 +41,43 @@ indicates passing (green) or failing (red) specs
* <code>--junitreport</code>, export tests results as junitreport xml format'
Checkout spec/SampleSpecs.js to see how to use it.
+
+async tests
+-----------
+
+jasmine-node includes an alternate syntax for writing asynchronous tests. Accepting
+a done callback in the specification will trigger jasmine-node to run the test
+asynchronously waiting until the done() callback is called.
+
+```javascript
+ it("should respond with hello world", function(done) {
+ request("http://localhost:3000/hello", function(error, response, body){
+ expect(body).toEqual("hello world");
+ done();
+ });
+ });
+```
+
+An asynchronous test will fail after 5000 ms if done() is not called. This timeout
+can be changed by setting jasmine.DEFAULT_TIMEOUT_INTERVAL or by passing a timeout
+interval in the specification.
+
+ it("should respond with hello world", function(done) {
+ request("http://localhost:3000/hello", function(error, response, body){
+ done();
+ }, 250); // timeout after 250 ms
+ });
+
+development
+-----------
+Install the dependent packages by running:
+
+ npm install
+
+Run the specs before you send your pull request:
+
+ scripts/specs
+
+or
+
+ scripts/specs --verbose
54 node_modules/jasmine-node/lib/jasmine-node/async-callback.js
View
@@ -0,0 +1,54 @@
+(function() {
+ var withoutAsync = {};
+
+ ["it", "beforeEach", "afterEach"].forEach(function(jasmineFunction) {
+ withoutAsync[jasmineFunction] = jasmine.Env.prototype[jasmineFunction];
+ return jasmine.Env.prototype[jasmineFunction] = function() {
+ var args = Array.prototype.slice.call(arguments, 0);
+ var timeout = null;
+ if (isLastArgumentATimeout(args)) {
+ timeout = args.pop();
+ }
+ if (isLastArgumentAnAsyncSpecFunction(args))
+ {
+ var specFunction = args.pop();
+ args.push(function() {
+ return asyncSpec(specFunction, this, timeout);
+ });
+ }
+ return withoutAsync[jasmineFunction].apply(this, args);
+ };
+ });
+
+ function isLastArgumentATimeout(args)
+ {
+ return args.length > 0 && (typeof args[args.length-1]) === "number";
+ }
+
+ function isLastArgumentAnAsyncSpecFunction(args)
+ {
+ return args.length > 0 && (typeof args[args.length-1]) === "function" && args[args.length-1].length > 0;
+ }
+
+ function asyncSpec(specFunction, spec, timeout) {
+ if (timeout == null) timeout = jasmine.DEFAULT_TIMEOUT_INTERVAL || 1000;
+ var done = false;
+ spec.runs(function() {
+ try {
+ return specFunction(function(error) {
+ done = true;
+ if (error != null) return spec.fail(error);
+ });
+ } catch (e) {
+ done = true;
+ throw e;
+ }
+ });
+ return spec.waitsFor(function() {
+ if (done === true) {
+ return true;
+ }
+ }, "spec to complete", timeout);
+ };
+
+}).call(this);
90 node_modules/jasmine-node/lib/jasmine-node/autotest.js
View
@@ -0,0 +1,90 @@
+var walkdir = require('walkdir');
+var collection = require('./spec-collection');
+var path = require('path');
+var fs = require('fs');
+var child_process = require('child_process');
+
+var baseArgv = [];
+
+for(var i = 0; i < process.argv.length; i++) {
+ if(process.argv[i] !== '--autotest') {
+ baseArgv.push(process.argv[i]);
+ }
+}
+
+var run_external = function(command, args, callback) {
+ var child = child_process.spawn(command, args);
+ child.stdout.on('data', function(data) {
+ process.stdout.write(data);
+ });
+ child.stderr.on('data', function(data) {
+ process.stderr.write(data);
+ });
+ if(typeof callback == 'function') {
+ child.on('exit', callback);
+ }
+}
+
+var run_everything = function() {
+ // run the suite when it starts
+ var argv = [].concat(baseArgv);
+ run_external(argv.shift(), argv, function() { console.log(arguments) });
+}
+
+var last_run_succesful = true;
+
+var watchFile = function(file, stat) {
+
+ var file = path.normalize(file)
+
+ var prevStats = stat;
+
+ var watcher = fs.watch(file, function(ev) {
+
+ if(!path.existsSync(file)) {
+ watcher.close();
+ return;
+ }
+
+ var currStats = fs.statSync( file );
+
+ if(prevStats.mtime.getTime() != currStats.mtime.getTime()) {
+ prevStats = currStats;
+
+ // narrow down a pattern to reduce the specs runned
+ var match = path.basename(file, path.extname(file)) + ".*";
+ match = match.replace(new RegExp("spec", "i"), "");
+
+ // so we need to rerun the jasmine suite
+ var argv = [].concat(baseArgv, ["--match", match]);
+ run_external(argv.shift(), argv, function(code) {
+ // run everything if we fixed some bugs
+ if(code == 0) {
+ if(!last_run_succesful) {
+ run_everything();
+ }
+ last_run_succesful = true;
+ } else {
+ last_run_succesful = false;
+ }
+ });
+ }
+ });
+}
+
+
+exports.start = function(loadpath, pattern) {
+
+ var finder = walkdir.find(loadpath);
+
+ finder.on('file', function(file, stat) {
+ var basename = path.basename(file);
+
+ if(pattern.test(basename)) {
+ watchFile(file,stat);
+ }
+
+ });
+
+ run_everything();
+}
100 node_modules/jasmine-node/lib/jasmine-node/cli.js
View
@@ -1,6 +1,13 @@
var jasmine = require('./index');
-var sys = require('sys'),
+var util,
Path= require('path');
+try {
+ util = require('util')
+} catch(e) {
+ util = require('sys')
+}
+
+var helperCollection = require('./spec-collection');
var specFolder = null;
@@ -10,8 +17,13 @@ for (var key in jasmine)
var isVerbose = false;
var showColors = true;
var teamcity = process.env.TEAMCITY_PROJECT_NAME || false;
+var useRequireJs = false;
var extentions = "js";
-var match = '.'
+var match = '.';
+var matchall = false;
+var autotest = false;
+var useHelpers = true;
+var forceExit = false;
var junitreport = {
report: false,
@@ -45,24 +57,47 @@ while(args.length) {
case '--match':
match = args.shift();
break;
- case '-i':
- case '--include':
- var dir = args.shift();
-
- if(!Path.existsSync(dir))
- throw new Error("Include path '" + dir + "' doesn't exist!");
-
- require.paths.unshift(dir);
+ case '--matchall':
+ matchall = true;
break;
case '--junitreport':
junitreport.report = true;
break;
+ case '--output':
+ junitreport.savePath = args.shift();
+ break;
case '--teamcity':
teamcity = true;
break;
+ case '--runWithRequireJs':
+ useRequireJs = true;
+ break;
+ case '--nohelpers':
+ useHelpers = false;
+ break;
+ case '--test-dir':
+ var dir = args.shift();
+
+ if(!Path.existsSync(dir))
+ throw new Error("Test root path '" + dir + "' doesn't exist!");
+
+ specFolder = dir; // NOTE: Does not look from current working directory.
+ break;
+ case '--autotest':
+ autotest = true;
+ break;
+ case '--forceexit':
+ forceExit = true;
+ break;
+ case '-h':
+ help();
default:
if (arg.match(/^--/)) help();
- specFolder = Path.join(process.cwd(), arg);
+ if (arg.match(/^\/.*/)) {
+ specFolder = arg;
+ } else {
+ specFolder = Path.join(process.cwd(), arg);
+ }
break;
}
}
@@ -71,6 +106,12 @@ if (!specFolder) {
help();
}
+if (autotest) {
+ require('./autotest').start(specFolder,
+ new RegExp(".+\\.(" + extentions + ")$", "i"));
+ return;
+}
+
var exitCode = 0;
process.on("exit", onExit);
@@ -80,29 +121,54 @@ function onExit() {
process.exit(exitCode);
}
-jasmine.loadHelpersInFolder(specFolder, new RegExp("[-_]helper\\.(" + extentions + ")$"));
-jasmine.executeSpecsInFolder(specFolder, function(runner, log){
- sys.print('\n');
+var onComplete = function(runner, log) {
+ util.print('\n');
if (runner.results().failedCount == 0) {
exitCode = 0;
} else {
exitCode = 1;
}
-}, isVerbose, showColors, teamcity, new RegExp(match + "spec\\.(" + extentions + ")$", 'i'), junitreport);
+ if (forceExit) {
+ process.exit(exitCode);
+ }
+};
+
+if(useHelpers){
+ jasmine.loadHelpersInFolder(specFolder,
+ new RegExp("helpers?\\.(" + extentions + ")$", 'i'));
+}
+
+var regExpSpec = new RegExp(match + (matchall ? "" : "spec\\.") + "(" + extentions + ")$", 'i')
+
+jasmine.executeSpecsInFolder(specFolder,
+ onComplete,
+ isVerbose,
+ showColors,
+ teamcity,
+ useRequireJs,
+ regExpSpec,
+ junitreport);
function help(){
- sys.print([
+ util.print([
'USAGE: jasmine-node [--color|--noColor] [--verbose] [--coffee] directory'
, ''
, 'Options:'
+ , ' --autotest - rerun automatically the specs when a file changes'
, ' --color - use color coding for output'
, ' --noColor - do not use color coding for output'
, ' -m, --match REGEXP - load only specs containing "REGEXPspec"'
- , ' -i, --include DIR - add given directory to node include paths'
+ , ' --matchall - relax requirement of "spec" in spec file names'
, ' --verbose - print extra information per each test run'
, ' --coffee - load coffee-script which allows execution .coffee files'
, ' --junitreport - export tests results as junitreport xml format'
+ , ' --output - defines the output folder for junitreport files'
, ' --teamcity - converts all console output to teamcity custom test runner commands. (Normally auto detected.)'
+ , ' --runWithRequireJs - loads all specs using requirejs instead of node\'s native require method'
+ , ' --test-dir - the absolute root directory path where tests are located'
+ , ' --nohelpers - does not load helpers.'
+ , ' --forceexit - force exit once tests complete.'
+ , ' -h, --help - display this help and exit'
, ''
].join("\n"));
129 node_modules/jasmine-node/lib/jasmine-node/index.js
View
@@ -1,5 +1,11 @@
var fs = require('fs');
-var sys = require('sys');
+var util;
+try {
+ util = require('util')
+} catch(e) {
+ util = require('sys')
+}
+
var path = require('path');
var filename = __dirname + '/jasmine-2.0.0.rc1.js';
@@ -23,25 +29,23 @@ switch (minorVersion) {
}
delete global.window;
+require("./async-callback");
require("jasmine-reporters");
-var TerminalReporter = require('./reporter').TerminalReporter;
+var jasmineNode = require('./reporter').jasmineNode;
jasmine.loadHelpersInFolder=function(folder, matcher)
{
- var helpers = [];
+ var helpers = [],
+ helperCollection = require('./spec-collection');
- if(fs.statSync(folder).isDirectory()) {
- helpers = jasmine.getAllSpecFiles(folder, matcher);
- } else {
- folder = path.dirname(folder);
- helpers = jasmine.getAllSpecFiles(folder, matcher);
- }
+ helperCollection.load(folder, matcher);
+ helpers = helperCollection.getSpecs();
for (var i = 0, len = helpers.length; i < len; ++i)
{
- var filename = helpers[i];
- var helper= require(filename.replace(/\.*$/, ""));
+ var file = helpers[i].path();
+ var helper= require(file.replace(/\.*$/, ""));
for (var key in helper)
global[key]= helper[key];
}
@@ -57,87 +61,60 @@ function removeJasmineFrames(text) {
return lines.join('\n');
}
-jasmine.executeSpecsInFolder = function(folder, done, isVerbose, showColors, teamcity, matcher, junitreport){
- var fileMatcher = matcher || new RegExp(".(js)$", "i");
- var colors = showColors || false;
- var specs = [];
-
- if (fs.statSync(folder).isDirectory()) {
- specs = jasmine.getAllSpecFiles(folder, fileMatcher);
- } else {
- specs.push(folder);
- }
-
- for (var i = 0, len = specs.length; i < len; ++i){
- var filename = specs[i];
- require(filename.replace(/\.\w+$/, ""));
- }
-
- var jasmineEnv = jasmine.getEnv();
- if(junitreport.report) {
+jasmine.executeSpecsInFolder = function(folder,
+ done,
+ isVerbose,
+ showColors,
+ teamcity,
+ useRequireJs,
+ matcher,
+ junitreport){
+ var fileMatcher = matcher || new RegExp(".(js)$", "i"),
+ colors = showColors || false,
+ specs = require('./spec-collection'),
+ jasmineEnv = jasmine.getEnv();
+
+ specs.load(folder, fileMatcher);
+
+ if(junitreport && junitreport.report) {
if(!path.existsSync(junitreport.savePath)) {
- sys.puts('creating junit xml report save path: ' + junitreport.savePath);
+ util.puts('creating junit xml report save path: ' + junitreport.savePath);
fs.mkdirSync(junitreport.savePath, "0755");
}
- jasmineEnv.addReporter(new jasmine.JUnitXmlReporter(junitreport.savePath, junitreport.consolidate, junitreport.useDotNotation));
+ jasmineEnv.addReporter(new jasmine.JUnitXmlReporter(junitreport.savePath,
+ junitreport.consolidate,
+ junitreport.useDotNotation));
}
if(teamcity){
- jasmineEnv.addReporter(new jasmine.TeamcityReporter());
+ jasmineEnv.addReporter(new jasmineNode.TerminalReporter({print: util.print,
+ color: false,
+ onComplete: done,
+ stackFilter: removeJasmineFrames}));
+ } else if(isVerbose) {
+ jasmineEnv.addReporter(new jasmineNode.TerminalVerboseReporter({ print: util.print,
+ color: showColors,
+ onComplete: done,
+ stackFilter: removeJasmineFrames}));
} else {
- jasmineEnv.addReporter(new TerminalReporter({print: sys.print,
- verbose: isVerbose,
+ jasmineEnv.addReporter(new jasmineNode.TerminalReporter({print: util.print,
color: showColors,
onComplete: done,
stackFilter: removeJasmineFrames}));
}
- jasmineEnv.execute();
-};
-
-jasmine.getAllSpecFiles = function(dir, matcher){
- var specs = [];
- if (fs.statSync(dir).isFile() && dir.match(matcher)) {
- specs.push(dir);
+ if (useRequireJs) {
+ require('./requirejs-runner').executeJsRunner(specs, done, jasmineEnv);
} else {
- var files = fs.readdirSync(dir);
- for (var i = 0, len = files.length; i < len; ++i){
- var filename = dir + '/' + files[i];
- // fs.fstatSync will pass ENOENT from stat(2) up
- // the stack. That's not particularly useful right now,
- // so try and continue...
- try{
- isFile = fs.statSync(filename).isFile();
- }catch (err){
- if(err.code === 'ENOENT'){
- isFile = false;
- }else{
- throw err;
- }
- }
- if (filename.match(matcher) && isFile){
- specs.push(filename);
- }else{
- try{
- isDir = fs.statSync(filename).isDirectory();
- } catch (err) {
- if(err.code === 'ENOENT'){
- isDir = false;
- }else{
- throw err;
- }
- }
- if (isDir){
- var subfiles = this.getAllSpecFiles(filename, matcher);
- subfiles.forEach(function(result){
- specs.push(result);
- });
- }
- }
+ var specsList = specs.getSpecs();
+ for (var i = 0, len = specsList.length; i < len; ++i) {
+ var filename = specsList[i];
+ require(filename.path().replace(/\.\w+$/, ""));
}
+
+ jasmineEnv.execute();
}
- return specs;
};
function now(){
6 node_modules/jasmine-node/lib/jasmine-node/jasmine-2.0.0.rc1.js
View
@@ -1755,7 +1755,7 @@ jasmine.Queue.prototype.next_ = function() {
while (goAgain) {
goAgain = false;
-
+
if (self.index < self.blocks.length && !this.abort) {
var calledSynchronously = true;
var completedSynchronously = false;
@@ -1766,7 +1766,7 @@ jasmine.Queue.prototype.next_ = function() {
return;
}
- if (self.blocks[self.index].abort) {
+ if (self.blocks[self.index] && self.blocks[self.index].abort) {
self.abort = true;
}
@@ -1793,7 +1793,7 @@ jasmine.Queue.prototype.next_ = function() {
if (completedSynchronously) {
onComplete();
}
-
+
} else {
self.running = false;
if (self.onComplete) {
418 node_modules/jasmine-node/lib/jasmine-node/reporter.js
View
@@ -1,177 +1,275 @@
-//
-// Imports
-//
-var sys = require('sys');
-
-
-//
-// Helpers
-//
-function noop() {}
-
-printRunnerResults = function(runner){
- var results = runner.results();
- var suites = runner.suites();
- var msg = '';
- msg += suites.length + ' test' + ((suites.length === 1) ? '' : 's') + ', ';
- msg += results.totalCount + ' assertion' + ((results.totalCount === 1) ? '' : 's') + ', ';
- msg += results.failedCount + ' failure' + ((results.failedCount === 1) ? '' : 's') + '\n';
- return msg;
-};
-
-escapeTeamcityString = function(message) {
- return message.replace(/\|/g, "||")
- .replace(/\'/g, "|'")
- .replace(/\n/g, "|n")
- .replace(/\r/g, "|r")
- .replace(/\u0085/g, "|x")
- .replace(/\u2028/g, "|l")
- .replace(/\u2029/g, "|p")
- .replace(/\[/g, "|[")
- .replace(/]/g, "|]");
-};
-
-ANSIColors = {
- pass: function() { return '\033[32m'; }, // Green
- fail: function() { return '\033[31m'; }, // Red
- neutral: function() { return '\033[0m'; } // Normal
-};
-
-NoColors = {
- pass: function() { return ''; },
- fail: function() { return ''; },
- neutral: function() { return ''; }
-};
-
-//
-// Reporter implementation
-//
-TerminalReporter = function(config) {
- this.print_ = config.print || sys.print;
- this.isVerbose_ = config.verbose || false;
- this.onComplete_ = config.onComplete || noop;
- this.color_ = config.color? ANSIColors: NoColors;
- this.teamcity_ = config.teamcity;
- this.stackFilter = config.stackFilter || function(t) { return t; }
-
- this.columnCounter_ = 0;
- this.log_ = [];
- this.start_ = 0;
-};
-
-TerminalReporter.prototype = {
- // Public Methods //
- log: noop,
-
- reportSpecStarting: noop,
-
- reportRunnerStarting: function(runner) {
- this.printLine_('Started');
- this.start_ = Number(new Date);
- },
-
- reportSuiteResults: function(suite) {
- var specResults = suite.results();
- var path = [];
- while(suite) {
- path.unshift(suite.description);
- suite = suite.parentSuite;
- }
- var description = path.join(' ');
+(function() {
+ //
+ // Imports
+ //
+ var util;
+ try {
+ util = require('util')
+ } catch(e) {
+ util = require('sys')
+ }
- if (this.isVerbose_ && !this.teamcity_)
- this.log_.push('Spec ' + description);
+ if (! jasmineNode) {
+ var jasmineNode = {};
+ }
- if (this.teamcity_)
- this.log_.push("##teamcity[testSuiteStarted name='" + escapeTeamcityString(description) + "]");
+ //
+ // Helpers
+ //
+ function noop() {}
- outerThis = this;
- specResults.items_.forEach(function(spec){
- if (spec.failedCount > 0 && spec.description) {
- if (!outerThis.isVerbose_ && !outerThis.teamcity_)
- outerThis.log_.push(description);
+ jasmineNode.ANSIColors = {
+ pass: function() { return '\033[32m'; }, // Green
+ fail: function() { return '\033[31m'; }, // Red
+ neutral: function() { return '\033[0m'; } // Normal
+ };
- if (outerThis.teamcity_) {
- outerThis.log_.push("##teamcity[testStarted name='" + escapeTeamcityString(spec.description) + "' captureStandardOutput='true']");
- } else {
- outerThis.log_.push(' it ' + spec.description);
- }
+ jasmineNode.NoColors = {
+ pass: function() { return ''; },
+ fail: function() { return ''; },
+ neutral: function() { return ''; }
+ };
- spec.items_.forEach(function(result){
- if (!result.passed_) {
- var errorMessage = result.trace.stack || result.message;
- if(outerThis.teamcity_) {
- outerThis.log_.push("##teamcity[testFailed name='" + escapeTeamcityString(spec.description) + "' message='[FAILED]' details='" + escapeTeamcityString(outerThis.stackFilter(outerThis.stackFilter(errorMessage))) + "']");
- } else {
- outerThis.log_.push(' ' + outerThis.stackFilter(errorMessage) + '\n');
- }
+ jasmineNode.TerminalReporter = function(config) {
+ this.print_ = config.print || util.print;
+ this.color_ = config.color ? jasmineNode.ANSIColors : jasmineNode.NoColors;
+
+ this.started_ = false;
+ this.finished_ = false;
+
+ this.callback_ = config.onComplete || false
+
+ this.suites_ = [];
+ this.specResults_ = {};
+ this.failures_ = [];
+ }
+
+ jasmineNode.TerminalReporter.prototype = {
+ reportRunnerStarting: function(runner) {
+ this.started_ = true;
+ this.startedAt = new Date();
+ var suites = runner.topLevelSuites();
+ for (var i = 0; i < suites.length; i++) {
+ var suite = suites[i];
+ this.suites_.push(this.summarize_(suite));
+ }
+ },
+
+ summarize_: function(suiteOrSpec) {
+ var isSuite = suiteOrSpec instanceof jasmine.Suite;
+
+ // We could use a separate object for suite and spec
+ var summary = {
+ id: suiteOrSpec.id,
+ name: suiteOrSpec.description,
+ type: isSuite? 'suite' : 'spec',
+ suiteNestingLevel: 0,
+ children: []
+ };
+
+ if (isSuite) {
+ var calculateNestingLevel = function(examinedSuite) {
+ var nestingLevel = 0;
+ while (examinedSuite.parentSuite !== null) {
+ nestingLevel += 1;
+ examinedSuite = examinedSuite.parentSuite;
}
- });
+ return nestingLevel;
+ };
+
+ summary.suiteNestingLevel = calculateNestingLevel(suiteOrSpec);
- if (outerThis.teamcity_)
- outerThis.log_.push("##teamcity[testFinished name='" + escapeTeamcityString(spec.description) + "']");
+ var children = suiteOrSpec.children();
+ for (var i = 0; i < children.length; i++) {
+ summary.children.push(this.summarize_(children[i]));
+ }
+ }
+ return summary;
+ },
+
+ // This is heavily influenced by Jasmine's Html/Trivial Reporter
+ reportRunnerResults: function(runner) {
+ this.reportFailures_();
+
+ var results = runner.results();
+ var resultColor = (results.failedCount > 0) ? this.color_.fail() : this.color_.pass();
+
+ var specs = runner.specs();
+ var specCount = specs.length;
+
+ var message = "\n\nFinished in " + ((new Date().getTime() - this.startedAt.getTime()) / 1000) + " seconds";
+ this.printLine_(message);
+
+ // This is what jasmine-html.js has
+ //message = "" + specCount + " spec" + ( specCount === 1 ? "" : "s" ) + ", " + results.failedCount + " failure" + ((results.failedCount === 1) ? "" : "s");
+
+ this.printLine_(this.stringWithColor_(this.printRunnerResults_(runner), resultColor));
+
+ this.finished_ = true;
+ if(this.callback_) { this.callback_(runner); }
+ },
+
+ reportFailures_: function() {
+ if (this.failures_.length === 0) {
+ return;
+ }
+
+ var indent = ' ', failure;
+ this.printLine_('\n');
+
+ this.print_('Failures:');
+
+ for (var i = 0; i < this.failures_.length; i++) {
+ failure = this.failures_[i];
+ this.printLine_('\n');
+ this.printLine_(' ' + (i + 1) + ') ' + failure.spec);
+ this.printLine_(' Message:');
+ this.printLine_(' ' + this.stringWithColor_(failure.message, this.color_.fail()));
+ this.printLine_(' Stacktrace:');
+ this.print_(' ' + failure.stackTrace);
+ }
+ },
+
+ reportSuiteResults: function(suite) {
+ // Not used in this context
+ },
+
+ reportSpecResults: function(spec) {
+ var result = spec.results();
+ var msg = '';
+ if (result.passed()) {
+ msg = this.stringWithColor_('.', this.color_.pass());
+ // } else if (result.skipped) { TODO: Research why "result.skipped" returns false when "xit" is called on a spec?
+ // msg = (colors) ? (ansi.yellow + '*' + ansi.none) : '*';
} else {
- if (outerThis.isVerbose_ && !outerThis.teamcity_)
- outerThis.log_.push(' it ' + spec.description);
+ msg = this.stringWithColor_('F', this.color_.fail());
+ this.addFailureToFailures_(spec);
}
- });
-
- if (this.teamcity_)
- this.log_.push("##teamcity[testSuiteFinished name='" + escapeTeamcityString(description) + "]");
- },
-
- reportSpecResults: function(spec) {
- var result = spec.results();
- var msg = '';
- if (result.passed()) {
- msg = this.stringWithColor_('.', this.color_.pass());
- // } else if (result.skipped) { TODO: Research why "result.skipped" returns false when "xit" is called on a spec?
- // msg = (colors) ? (ansi.yellow + '*' + ansi.none) : '*';
- } else {
- msg = this.stringWithColor_('F', this.color_.fail());
- }
- this.print_(msg);
- if (this.columnCounter_++ < 50) return;
- this.columnCounter_ = 0;
- this.print_('\n');
- },
-
- reportRunnerResults: function(runner) {
- var elapsed = (Number(new Date) - this.start_) / 1000;
- var owner = this;
-
- this.printLine_('\n');
- this.log_.forEach(function(entry) {
- owner.printLine_(entry);
- });
- this.printLine_('Finished in ' + elapsed + ' seconds');
-
- var summary = printRunnerResults(runner);
- if(runner.results().failedCount === 0 ) {
- this.printLine_(this.stringWithColor_(summary, this.color_.pass()));
- }
- else {
- this.printLine_(this.stringWithColor_(summary, this.color_.fail()));
- }
+ this.spec_results += msg;
+ this.print_(msg);
+ },
+
+ addFailureToFailures_: function(spec) {
+ var result = spec.results();
+ var failureItem = null;
+
+ var items_length = result.items_.length;
+ for (var i = 0; i < items_length; i++) {
+ if (result.items_[i].passed_ === false) {
+ failureItem = result.items_[i];
+ var failure = {
+ spec: spec.description,
+ message: failureItem.message,
+ stackTrace: failureItem.trace.stack
+ }
+
+ this.failures_.push(failure);
+ }
+ }
+ },
- this.onComplete_(runner, this.log_);
- },
+ printRunnerResults_: function(runner){
+ var results = runner.results();
+ var specs = runner.specs();
+ var msg = '';
+ msg += specs.length + ' test' + ((specs.length === 1) ? '' : 's') + ', ';
+ msg += results.totalCount + ' assertion' + ((results.totalCount === 1) ? '' : 's') + ', ';
+ msg += results.failedCount + ' failure' + ((results.failedCount === 1) ? '' : 's') + '\n';
+ return msg;
+ },
- // Helper Methods //
- stringWithColor_: function(str, color) {
- return (color || this.color_.neutral()) + str + this.color_.neutral();
- },
+ // Helper Methods //
+ stringWithColor_: function(stringValue, color) {
+ return (color || this.color_.neutral()) + stringValue + this.color_.neutral();
+ },
- printLine_: function(str) {
- this.print_(str);
- this.print_('\n');
+ printLine_: function(stringValue) {
+ this.print_(stringValue);
+ this.print_('\n');
+ }
+ };
+
+ // ***************************************************************
+ // TerminalVerboseReporter uses the TerminalReporter's constructor
+ // ***************************************************************
+ jasmineNode.TerminalVerboseReporter = function(config) {
+ jasmineNode.TerminalReporter.call(this, config);
+ // The extra field in this object
+ this.indent_ = 0;
}
-};
+ jasmineNode.TerminalVerboseReporter.prototype = {
+ reportSpecResults: function(spec) {
+ if (spec.results().failedCount > 0) {
+ this.addFailureToFailures_(spec);
+ }
+
+ this.specResults_[spec.id] = {
+ messages: spec.results().getItems(),
+ result: spec.results().failedCount > 0 ? 'failed' : 'passed'
+ };
+ },
+
+ reportRunnerResults: function(runner) {
+ var messages = new Array();
+ this.buildMessagesFromResults_(messages, this.suites_);
+
+ var messages_length = messages.length;
+ for (var i = 0; i < messages_length-1; i++) {
+ this.printLine_(messages[i]);
+ }
+
+ this.print_(messages[messages_length-1]);
+
+ // Call the parent object's method
+ jasmineNode.TerminalReporter.prototype.reportRunnerResults.call(this, runner);
+ },
+
+ buildMessagesFromResults_: function(messages, results) {
+ var element, specResult, specIndentSpaces, msg = '';
+
+ var results_length = results.length;
+ for (var i = 0; i < results_length; i++) {
+ element = results[i];
+
+ if (element.type === 'spec') {
+ specResult = this.specResults_[element.id.toString()];
+
+ specIndentSpaces = this.indent_ + 2;
+ if (specResult.result === 'passed') {
+ msg = this.stringWithColor_(this.indentMessage_(element.name, specIndentSpaces), this.color_.pass());
+ } else {
+ msg = this.stringWithColor_(this.indentMessage_(element.name, specIndentSpaces), this.color_.fail());
+ }
+
+ messages.push(msg);
+ } else {
+ this.indent_ = element.suiteNestingLevel * 2;
+
+ messages.push('');
+ messages.push(this.indentMessage_(element.name, this.indent_));
+ }
+
+ this.buildMessagesFromResults_(messages, element.children);
+ }
+ },
+
+ indentMessage_: function(message, indentCount) {
+ var _indent = '';
+ for (var i = 0; i < indentCount; i++) {
+ _indent += ' ';
+ }
+ return (_indent + message);
+ }
+ };
+
+ // Inherit from TerminalReporter
+ jasmineNode.TerminalVerboseReporter.prototype.__proto__ = jasmineNode.TerminalReporter.prototype;
-//
-// Exports
-//
-exports.TerminalReporter = TerminalReporter;
+ //
+ // Exports
+ //
+ exports.jasmineNode = jasmineNode;
+})();
80 node_modules/jasmine-node/lib/jasmine-node/requirejs-runner.js
View
@@ -0,0 +1,80 @@
+exports.executeJsRunner = function(specCollection, done, jasmineEnv) {
+ var specs,
+ specLoader = require('./requirejs-spec-loader'),
+ requirejs = require('requirejs'),
+ vm = require('vm'),
+ fs = require('fs'),
+ template = fs.readFileSync(__dirname + '/requirejs-wrapper-template.js', 'utf8'),
+ buildNewContext = function(spec){
+ var context = {
+ describe: describe,
+ it: it,
+ xdescribe: xdescribe,
+ xit: xit,
+ beforeEach: beforeEach,
+ spyOn: spyOn,
+ waitsFor: waitsFor,
+ runs: runs,
+ jasmine: jasmine,
+ expect: expect,
+ require: require,
+ console: console,
+ process: process,
+ module: module,
+ specLoader: specLoader,
+ __dirname: spec.directory(),
+ __filename: spec.path()
+ };
+
+ context.global = context;
+
+ return context;
+ },
+ buildRelativeDirName = function(dir){
+ var retVal = "",
+ thisDir = process.cwd(),
+ toDir = dir.split('/'),
+ index = 0,
+ colonMatches = __dirname.match(/^.:/);
+
+ for(var i = 0; i < (colonMatches && colonMatches.length) || 0; i++){
+ thisDir = thisDir.replace(colonMatches[i], '\\' + colonMatches[i].substring(0,1));
+ }
+
+ thisDir = thisDir.replace(/\\/g, '/').split('/');
+
+ for(; index < thisDir.length || index < toDir.length; index++) {
+ if(thisDir[index] != toDir[index]){
+ for(var i = index; i < thisDir.length-1; i++){
+ retVal += '../';
+ }
+
+ for(var i = index; i < toDir.length; i++){
+ retVal += toDir[i] + '/';
+ }
+
+ break;
+ }
+ }
+
+ return retVal.trim('/');
+ };
+
+ specCollection.getSpecs().forEach(function(s){
+ var script = fs.readFileSync(s.path(), 'utf8'),
+ dir = s.directory(),
+ colonMatches = dir.match(/.:/),
+ wrappedScript;
+
+ for(var i = 0; i < (colonMatches && colonMatches.length) || 0; i++){
+ dir = dir.replace(colonMatches[i], '/' + colonMatches[i].substring(0,1));
+ }
+
+ wrappedScript = template.replace(/#REPLACE URL#/, buildRelativeDirName(dir))
+ .replace(/#REPLACE TEST SCRIPT#/, script);
+
+ vm.runInNewContext(wrappedScript, buildNewContext(s), s.path());
+ });
+
+ specLoader.executeWhenAllSpecsAreComplete(jasmineEnv);
+};
48 node_modules/jasmine-node/lib/jasmine-node/requirejs-spec-loader.js
View
@@ -0,0 +1,48 @@
+var _ = require('underscore'),
+ registry = {},
+ timeout = 120000,
+ now = function() {
+ return new Date().getTime();
+ },
+ loader = {
+ register: function(name) {
+ registry[name] = false;
+ },
+ completed: function(name){
+ registry[name] = true;
+ }
+ },
+ specLoader = {
+ defineLoader: function(requirejs) {
+ requirejs.define('jasmine-spec-loader', function() {
+ return loader;
+ });
+ },
+ executeWhenAllSpecsAreComplete: function(jasmineEnv) {
+ var allComplete = false,
+ wait = now(),
+ timeoutCallback = function() {
+ allComplete = _.all(registry, function(value) {
+ return value;
+ });
+
+ if(!allComplete && wait + timeout > now()) {
+ setTimeout(timeoutCallback, 100);
+ } else if (!allComplete) {
+ console.log('Failed to load all specs within timeout window.');
+ process.exit(-1);
+ } else {
+ jasmineEnv.execute();
+ }
+ };
+
+ setTimeout(timeoutCallback, 100);
+ },
+ setTimeoutInterval: function(value) {
+ timeout = value;
+ },
+ };
+
+for(var key in specLoader) {
+ exports[key] = specLoader[key];
+}
65 node_modules/jasmine-node/lib/jasmine-node/requirejs-wrapper-template.js
View
@@ -0,0 +1,65 @@
+var test = function(require, define, undefined) { #REPLACE TEST SCRIPT#
+};
+
+var requirejsOrig = require('requirejs'),
+ ostring = Object.prototype.toString,
+ path = require('path'),
+ baseUrl = '#REPLACE URL#',
+ isArray = function(it){
+ return ostring.call(it) === '[object Array]';
+ },
+ isFunction = function(it){
+ return ostring.call(it) === '[object Function]';
+ },
+ requirejs = function(deps, callback){
+ var retVal;
+
+ if(!isArray(deps) && typeof deps !== 'string'){
+ if(isArray(callback)){
+ retVal = requirejsOrig(deps, callback, arguments[2]);
+ } else {
+ retVal = requirejsOrig(deps, [], callback);
+ }
+ } else {
+ retVal = requirejsOrig(deps, callback);
+ }
+
+ return retVal;
+ };
+
+requirejsOrig.config({
+ baseUrl: baseUrl,
+ nodeRequire: require
+});
+
+for(var key in requirejsOrig) {
+ requirejs[key] = requirejsOrig[key];
+}
+
+requirejs.config = function(config){
+ var alteredConfig = {};
+
+ for(var key in config) {
+ alteredConfig[key] = config[key];
+ }
+
+ if(alteredConfig.baseUrl){
+ var base = baseUrl.replace(/\\/g, '/'),
+ splitUrl = alteredConfig.baseUrl.replace(/\\/g, '/').split('/'),
+ index = 0;
+
+ for(; index < splitUrl.length; index++){
+ if(splitUrl[index] === '..'){
+ base = path.dirname(base);
+ } else {
+ base += '/' + splitUrl[index];
+ }
+ }
+
+ alteredConfig.baseUrl = base;
+ }
+
+ return requirejsOrig.config(alteredConfig);
+};
+
+test(requirejs, requirejs.define);
35 node_modules/jasmine-node/lib/jasmine-node/spec-collection.js
View
@@ -0,0 +1,35 @@
+var walkdir = require('walkdir');
+var path = require('path');
+var fs = require('fs');
+var specs = [];
+
+var createSpecObj = function(path, root) {
+ return {
+ path: function() { return path; },
+ relativePath: function() { return path.replace(root, '').replace(/^[\/\\]/, '').replace(/\\/g, '/'); },
+ directory: function() { return path.replace(/[\/\\][\s\w\.-]*$/, "").replace(/\\/g, '/'); },
+ relativeDirectory: function() { return relativePath().replace(/[\/\\][\s\w\.-]*$/, "").replace(/\\/g, '/'); },
+ filename: function() { return path.replace(/^.*[\\\/]/, ''); }
+ };
+};
+
+exports.load = function(loadpath, matcher) {
+ var wannaBeSpecs = walkdir.sync(loadpath)
+
+ for (var i = 0; i < wannaBeSpecs.length; i++) {
+ var file = wannaBeSpecs[i];
+ try {
+ if (fs.statSync(file).isFile()) {
+ if (!/.*node_modules.*/.test(file) && matcher.test(path.basename(file))) {
+ specs.push(createSpecObj(file));
+ }
+ }
+ } catch(e) {
+ // nothing to do here
+ }
+ }
+};
+
+exports.getSpecs = function() {
+ return specs;
+};
1  node_modules/jasmine-node/node_modules/.bin/r.js
View
1  node_modules/jasmine-node/node_modules/coffee-script/CNAME
View
@@ -0,0 +1 @@
+coffeescript.org
2  node_modules/jasmine-node/node_modules/coffee-script/LICENSE
View
@@ -1,4 +1,4 @@
-Copyright (c) 2011 Jeremy Ashkenas
+Copyright (c) 2009-2012 Jeremy Ashkenas
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
7 node_modules/jasmine-node/node_modules/coffee-script/README
View
@@ -1,4 +1,4 @@
-=
+
{
} } {
{ { } }
@@ -29,9 +29,12 @@
npm install -g coffee-script
(Leave off the -g if you don't wish to install globally.)
- Compile a script:
+ Execute a script:
coffee /path/to/script.coffee
+ Compile a script:
+ coffee -c /path/to/script.coffee
+
For documentation, usage, and examples, see:
http://coffeescript.org/
2  node_modules/jasmine-node/node_modules/coffee-script/bin/cake
View
@@ -4,4 +4,4 @@ var path = require('path');
var fs = require('fs');
var lib = path.join(path.dirname(fs.realpathSync(__filename)), '../lib');
-require(lib + '/cake').run();
+require(lib + '/coffee-script/cake').run();
2  node_modules/jasmine-node/node_modules/coffee-script/bin/coffee
View
@@ -4,4 +4,4 @@ var path = require('path');
var fs = require('fs');
var lib = path.join(path.dirname(fs.realpathSync(__filename)), '../lib');
-require(lib + '/command').run();
+require(lib + '/coffee-script/command').run();
76 node_modules/jasmine-node/node_modules/coffee-script/lib/cake.js
View
@@ -1,76 +0,0 @@
-(function() {
- var CoffeeScript, fs, helpers, missingTask, oparse, options, optparse, path, printTasks, switches, tasks;
- fs = require('fs');
- path = require('path');
- helpers = require('./helpers');
- optparse = require('./optparse');
- CoffeeScript = require('./coffee-script');
- tasks = {};
- options = {};
- switches = [];
- oparse = null;
- helpers.extend(global, {
- task: function(name, description, action) {
- var _ref;
- if (!action) {
- _ref = [description, action], action = _ref[0], description = _ref[1];
- }
- return tasks[name] = {
- name: name,
- description: description,
- action: action
- };
- },
- option: function(letter, flag, description) {
- return switches.push([letter, flag, description]);
- },
- invoke: function(name) {
- if (!tasks[name]) {
- missingTask(name);
- }
- return tasks[name].action(options);
- }
- });
- exports.run = function() {
- return path.exists('Cakefile', function(exists) {
- var arg, args, _i, _len, _ref, _results;
- if (!exists) {
- throw new Error("Cakefile not found in " + (process.cwd()));
- }
- args = process.argv.slice(2);
- CoffeeScript.run(fs.readFileSync('Cakefile').toString(), {
- filename: 'Cakefile'
- });
- oparse = new optparse.OptionParser(switches);
- if (!args.length) {
- return printTasks();
- }
- options = oparse.parse(args);
- _ref = options.arguments;
- _results = [];
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
- arg = _ref[_i];
- _results.push(invoke(arg));
- }
- return _results;
- });
- };
- printTasks = function() {
- var desc, name, spaces, task;
- console.log('');
- for (name in tasks) {
- task = tasks[name];
- spaces = 20 - name.length;
- spaces = spaces > 0 ? Array(spaces + 1).join(' ') : '';
- desc = task.description ? "# " + task.description : '';
- console.log("cake " + name + spaces + " " + desc);
- }
- if (switches.length) {
- return console.log(oparse.help());
- }
- };
- missingTask = function(task) {
- console.log("No such task: \"" + task + "\"");
- return process.exit(1);
- };
-}).call(this);
18 ...ne-node/node_modules/coffee-script/lib/browser.js → ...odules/coffee-script/lib/coffee-script/browser.js
View
@@ -1,10 +1,21 @@
+// Generated by CoffeeScript 1.3.1
(function() {
var CoffeeScript, runScripts;
+
CoffeeScript = require('./coffee-script');
+
CoffeeScript.require = require;
- CoffeeScript.eval = function(code, options) {
+
+ CoffeeScript["eval"] = function(code, options) {
+ if (options == null) {
+ options = {};
+ }
+ if (options.bare == null) {
+ options.bare = true;
+ }
return eval(CoffeeScript.compile(code, options));
};
+
CoffeeScript.run = function(code, options) {
if (options == null) {
options = {};
@@ -12,9 +23,11 @@
options.bare = true;
return Function(CoffeeScript.compile(code, options))();
};
+
if (typeof window === "undefined" || window === null) {
return;
}
+
CoffeeScript.load = function(url, callback) {
var xhr;
xhr = new (window.ActiveXObject || XMLHttpRequest)('Microsoft.XMLHTTP');
@@ -37,6 +50,7 @@
};
return xhr.send(null);
};
+
runScripts = function() {
var coffees, execute, index, length, s, scripts;
scripts = document.getElementsByTagName('script');
@@ -67,9 +81,11 @@
})();
return null;
};
+
if (window.addEventListener) {
addEventListener('DOMContentLoaded', runScripts, false);
} else {
attachEvent('onload', runScripts);
}
+
}).call(this);
111 node_modules/jasmine-node/node_modules/coffee-script/lib/coffee-script/cake.js
View
@@ -0,0 +1,111 @@
+// Generated by CoffeeScript 1.3.1
+(function() {
+ var CoffeeScript, cakefileDirectory, fatalError, fs, helpers, missingTask, oparse, options, optparse, path, printTasks, switches, tasks;
+
+ fs = require('fs');
+
+ path = require('path');
+
+ helpers = require('./helpers');
+
+ optparse = require('./optparse');
+
+ CoffeeScript = require('./coffee-script');
+
+ tasks = {};
+
+ options = {};
+
+ switches = [];
+
+ oparse = null;
+
+ helpers.extend(global, {
+ task: function(name, description, action) {
+ var _ref;
+ if (!action) {
+ _ref = [description, action], action = _ref[0], description = _ref[1];
+ }
+ return tasks[name] = {
+ name: name,
+ description: description,
+ action: action
+ };
+ },
+ option: function(letter, flag, description) {
+ return switches.push([letter, flag, description]);
+ },
+ invoke: function(name) {
+ if (!tasks[name]) {
+ missingTask(name);
+ }
+ return tasks[name].action(options);
+ }
+ });
+
+ exports.run = function() {
+ var arg, args, _i, _len, _ref, _results;
+ global.__originalDirname = fs.realpathSync('.');
+ process.chdir(cakefileDirectory(__originalDirname));
+ args = process.argv.slice(2);
+ CoffeeScript.run(fs.readFileSync('Cakefile').toString(), {
+ filename: 'Cakefile'
+ });
+ oparse = new optparse.OptionParser(switches);
+ if (!args.length) {
+ return printTasks();
+ }
+ try {
+ options = oparse.parse(args);
+ } catch (e) {
+ return fatalError("" + e);
+ }
+ _ref = options["arguments"];
+ _results = [];
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ arg = _ref[_i];
+ _results.push(invoke(arg));
+ }
+ return _results;
+ };
+
+ printTasks = function() {
+ var cakefilePath, desc, name, relative, spaces, task;
+ relative = path.relative || path.resolve;
+ cakefilePath = path.join(relative(__originalDirname, process.cwd()), 'Cakefile');
+ console.log("" + cakefilePath + " defines the following tasks:\n");
+ for (name in tasks) {
+ task = tasks[name];
+ spaces = 20 - name.length;
+ spaces = spaces > 0 ? Array(spaces + 1).join(' ') : '';
+ desc = task.description ? "# " + task.description : '';
+ console.log("cake " + name + spaces + " " + desc);
+ }
+ if (switches.length) {
+ return console.log(oparse.help());
+ }
+ };
+
+ fatalError = function(message) {
+ console.error(message + '\n');
+ console.log('To see a list of all tasks/options, run "cake"');
+ return process.exit(1);
+ };
+
+ missingTask = function(task) {
+ return fatalError("No such task: " + task);
+ };
+
+ cakefileDirectory = function(dir) {
+ var parent;
+ if (path.existsSync(path.join(dir, 'Cakefile'))) {
+ return dir;
+ }
+ parent = path.normalize(path.join(dir, '..'));
+ if (parent !== dir) {
+ return cakefileDirectory(parent);
+ }
+ throw new Error("Cakefile not found in " + (process.cwd()));
+ };
+
+}).call(this);
92 ...e/node_modules/coffee-script/lib/coffee-script.js → .../coffee-script/lib/coffee-script/coffee-script.js 100755 → 100644
View
@@ -1,10 +1,18 @@
+// Generated by CoffeeScript 1.3.1
(function() {
- var Lexer, RESERVED, compile, fs, lexer, parser, path, _ref;
- var __hasProp = Object.prototype.hasOwnProperty;
+ var Lexer, RESERVED, compile, fs, lexer, parser, path, vm, _ref,
+ __hasProp = {}.hasOwnProperty;
+
fs = require('fs');
+
path = require('path');
+
_ref = require('./lexer'), Lexer = _ref.Lexer, RESERVED = _ref.RESERVED;
+
parser = require('./parser').parser;
+
+ vm = require('vm');
+
if (require.extensions) {
require.extensions['.coffee'] = function(module, filename) {
var content;
@@ -18,25 +26,38 @@
return compile(content);
});
}
- exports.VERSION = '1.1.2';
+
+ exports.VERSION = '1.3.1';
+
exports.RESERVED = RESERVED;
+
exports.helpers = require('./helpers');
+
exports.compile = compile = function(code, options) {
+ var header, js, merge;
if (options == null) {
options = {};
}
+ merge = exports.helpers.merge;
try {
- return (parser.parse(lexer.tokenize(code))).compile(options);
+ js = (parser.parse(lexer.tokenize(code))).compile(options);
+ if (!options.header) {
+ return js;
+ }
} catch (err) {
if (options.filename) {
err.message = "In " + options.filename + ", " + err.message;
}
throw err;
}
+ header = "Generated by CoffeeScript " + this.VERSION;
+ return "// " + header + "\n" + js;
};
+
exports.tokens = function(code, options) {
return lexer.tokenize(code, options);
};
+
exports.nodes = function(source, options) {
if (typeof source === 'string') {
return parser.parse(lexer.tokenize(source, options));
@@ -44,57 +65,64 @@
return parser.parse(source);
}
};
+
exports.run = function(code, options) {
- var Module, mainModule;
+ var mainModule;
+ if (options == null) {
+ options = {};
+ }
mainModule = require.main;
mainModule.filename = process.argv[1] = options.filename ? fs.realpathSync(options.filename) : '.';
mainModule.moduleCache && (mainModule.moduleCache = {});
- if (process.binding('natives').module) {
- Module = require('module').Module;
- mainModule.paths = Module._nodeModulePaths(path.dirname(options.filename));
- }
+ mainModule.paths = require('module')._nodeModulePaths(path.dirname(fs.realpathSync(options.filename)));
if (path.extname(mainModule.filename) !== '.coffee' || require.extensions) {
return mainModule._compile(compile(code, options), mainModule.filename);
} else {
return mainModule._compile(code, mainModule.filename);
}
};
- exports.eval = function(code, options) {
- var Module, Script, js, k, o, r, sandbox, v, _i, _len, _module, _ref2, _ref3, _ref4, _require;
+
+ exports["eval"] = function(code, options) {
+ var Module, Script, js, k, o, r, sandbox, v, _i, _len, _module, _ref1, _ref2, _require;
if (options == null) {
options = {};
}
if (!(code = code.trim())) {
return;
}
- if (_ref2 = require('vm'), Script = _ref2.Script, _ref2) {
- sandbox = Script.createContext();
- sandbox.global = sandbox.root = sandbox.GLOBAL = sandbox;
+ Script = vm.Script;
+ if (Script) {
if (options.sandbox != null) {
- if (options.sandbox instanceof sandbox.constructor) {
+ if (options.sandbox instanceof Script.createContext().constructor) {
sandbox = options.sandbox;
} else {
- _ref3 = options.sandbox;
- for (k in _ref3) {
- if (!__hasProp.call(_ref3, k)) continue;
- v = _ref3[k];
+ sandbox = Script.createContext();
+ _ref1 = options.sandbox;
+ for (k in _ref1) {
+ if (!__hasProp.call(_ref1, k)) continue;
+ v = _ref1[k];
sandbox[k] = v;
}
}
+ sandbox.global = sandbox.root = sandbox.GLOBAL = sandbox;
+ } else {
+ sandbox = global;
}
sandbox.__filename = options.filename || 'eval';
sandbox.__dirname = path.dirname(sandbox.__filename);
- if (!(sandbox.module || sandbox.require)) {
+ if (!(sandbox !== global || sandbox.module || sandbox.require)) {
Module = require('module');
sandbox.module = _module = new Module(options.modulename || 'eval');
sandbox.require = _require = function(path) {
- return Module._load(path, _module);
+ return Module._load(path, _module, true);
};
_module.filename = sandbox.__filename;
- _ref4 = Object.getOwnPropertyNames(require);
- for (_i = 0, _len = _ref4.length; _i < _len; _i++) {
- r = _ref4[_i];
- _require[r] = require[r];
+ _ref2 = Object.getOwnPropertyNames(require);
+ for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
+ r = _ref2[_i];
+ if (r !== 'paths') {
+ _require[r] = require[r];
+ }
}
_require.paths = _module.paths = Module._nodeModulePaths(process.cwd());
_require.resolve = function(request) {
@@ -110,17 +138,19 @@
}
o.bare = true;
js = compile(code, o);
- if (Script) {
- return Script.runInContext(js, sandbox);
+ if (sandbox === global) {
+ return vm.runInThisContext(js);
} else {
- return eval(js);
+ return vm.runInContext(js, sandbox);
}
};
+
lexer = new Lexer;
+
parser.lexer = {
lex: function() {
- var tag, _ref2;
- _ref2 = this.tokens[this.pos++] || [''], tag = _ref2[0], this.yytext = _ref2[1], this.yylineno = _ref2[2];
+ var tag, _ref1;
+ _ref1 = this.tokens[this.pos++] || [''], tag = _ref1[0], this.yytext = _ref1[1], this.yylineno = _ref1[2];
return tag;
},
setInput: function(tokens) {
@@ -131,5 +161,7 @@
return "";
}
};
+
parser.yy = require('./nodes');
+
}).call(this);
502 node_modules/jasmine-node/node_modules/coffee-script/lib/coffee-script/command.js
View
@@ -0,0 +1,502 @@
+// Generated by CoffeeScript 1.3.1
+(function() {
+ var BANNER, CoffeeScript, EventEmitter, SWITCHES, compileJoin, compileOptions, compilePath, compileScript, compileStdio, exec, forkNode, fs, helpers, hidden, joinTimeout, lint, loadRequires, notSources, optionParser, optparse, opts, outputPath, parseOptions, path, printLine, printTokens, printWarn, removeSource, sourceCode, sources, spawn, timeLog, unwatchDir, usage, version, wait, watch, watchDir, watchers, writeJs, _ref;
+
+ fs = require('fs');
+
+ path = require('path');
+
+ helpers = require('./helpers');
+
+ optparse = require('./optparse');
+
+ CoffeeScript = require('./coffee-script');
+
+ _ref = require('child_process'), spawn = _ref.spawn, exec = _ref.exec;
+
+ EventEmitter = require('events').EventEmitter;
+
+ helpers.extend(CoffeeScript, new EventEmitter);
+
+ printLine = function(line) {
+ return process.stdout.write(line + '\n');
+ };
+
+ printWarn = function(line) {
+ return process.stderr.write(line + '\n');
+ };
+
+ hidden = function(file) {
+ return /^\.|~$/.test(file);
+ };
+
+ BANNER = 'Usage: coffee [options] path/to/script.coffee -- [args]\n\nIf called without options, `coffee` will run your script.';
+
+ SWITCHES = [['-b', '--bare', 'compile without a top-level function wrapper'], ['-c', '--compile', 'compile to JavaScript and save as .js files'], ['-e', '--eval', 'pass a string from the command line as input'], ['-h', '--help', 'display this help message'], ['-i', '--interactive', 'run an interactive CoffeeScript REPL'], ['-j', '--join [FILE]', 'concatenate the source CoffeeScript before compiling'], ['-l', '--lint', 'pipe the compiled JavaScript through JavaScript Lint'], ['-n', '--nodes', 'print out the parse tree that the parser produces'], ['--nodejs [ARGS]', 'pass options directly to the "node" binary'], ['-o', '--output [DIR]', 'set the output directory for compiled JavaScript'], ['-p', '--print', 'print out the compiled JavaScript'], ['-r', '--require [FILE*]', 'require a library before executing your script'], ['-s', '--stdio', 'listen for and compile scripts over stdio'], ['-t', '--tokens', 'print out the tokens that the lexer/rewriter produce'], ['-v', '--version', 'display the version number'], ['-w', '--watch', 'watch scripts for changes and rerun commands']];
+
+ opts = {};
+
+ sources = [];
+
+ sourceCode = [];
+
+ notSources = {};
+
+ watchers = {};
+
+ optionParser = null;
+
+ exports.run = function() {
+ var literals, source, _i, _len, _results;
+ parseOptions();
+ if (opts.nodejs) {
+ return forkNode();
+ }
+ if (opts.help) {
+ return usage();
+ }
+ if (opts.version) {
+ return version();
+ }
+ if (opts.require) {
+ loadRequires();
+ }
+ if (opts.interactive) {
+ return require('./repl');
+ }
+ if (opts.watch && !fs.watch) {
+ return printWarn("The --watch feature depends on Node v0.6.0+. You are running " + process.version + ".");
+ }
+ if (opts.stdio) {
+ return compileStdio();
+ }
+ if (opts["eval"]) {
+ return compileScript(null, sources[0]);
+ }
+ if (!sources.length) {
+ return require('./repl');
+ }
+ literals = opts.run ? sources.splice(1) : [];
+ process.argv = process.argv.slice(0, 2).concat(literals);
+ process.argv[0] = 'coffee';
+ process.execPath = require.main.filename;
+ _results = [];
+ for (_i = 0, _len = sources.length; _i < _len; _i++) {
+ source = sources[_i];
+ _results.push(compilePath(source, true, path.normalize(source)));
+ }
+ return _results;
+ };
+
+ compilePath = function(source, topLevel, base) {
+ return fs.stat(source, function(err, stats) {
+ if (err && err.code !== 'ENOENT') {
+ throw err;
+ }
+ if ((err != null ? err.code : void 0) === 'ENOENT') {
+ if (topLevel && source.slice(-7) !== '.coffee') {
+ source = sources[sources.indexOf(source)] = "" + source + ".coffee";
+ return compilePath(source, topLevel, base);
+ }
+ if (topLevel) {
+ console.error("File not found: " + source);
+ process.exit(1);
+ }
+ return;
+ }
+ if (stats.isDirectory()) {
+ if (opts.watch) {
+ watchDir(source, base);
+ }
+ return fs.readdir(source, function(err, files) {
+ var file, index, _i, _len, _ref1, _ref2, _results;
+ if (err && err.code !== 'ENOENT') {
+ throw err;
+ }
+ if ((err != null ? err.code : void 0) === 'ENOENT') {
+ return;
+ }
+ index = sources.indexOf(source);
+ [].splice.apply(sources, [index, index - index + 1].concat(_ref1 = (function() {
+ var _i, _len, _results;
+ _results = [];
+ for (_i = 0, _len = files.length; _i < _len; _i++) {
+ file = files[_i];
+ _results.push(path.join(source, file));
+ }
+ return _results;
+ })())), _ref1;
+ [].splice.apply(sourceCode, [index, index - index + 1].concat(_ref2 = files.map(function() {
+ return null;
+ }))), _ref2;
+ _results = [];
+ for (_i = 0, _len = files.length; _i < _len; _i++) {
+ file = files[_i];
+ if (!hidden(file)) {
+ _results.push(compilePath(path.join(source, file), false, base));
+ }
+ }
+ return _results;
+ });
+ } else if (topLevel || path.extname(source) === '.coffee') {
+ if (opts.watch) {
+ watch(source, base);
+ }
+ return fs.readFile(source, function(err, code) {
+ if (err && err.code !== 'ENOENT') {
+ throw err;
+ }
+ if ((err != null ? err.code : void 0) === 'ENOENT') {
+ return;
+ }
+ return compileScript(source, code.toString(), base);
+ });
+ } else {
+ notSources[source] = true;
+ return removeSource(source, base);
+ }
+ });
+ };
+
+ compileScript = function(file, input, base) {
+ var o, options, t, task;
+ o = opts;
+ options = compileOptions(file);
+ try {
+ t = task = {
+ file: file,
+ input: input,
+ options: options
+ };
+ CoffeeScript.emit('compile', task);
+ if (o.tokens) {
+ return printTokens(CoffeeScript.tokens(t.input));
+ } else if (o.nodes) {
+ return printLine(CoffeeScript.nodes(t.input).toString().trim());
+ } else if (o.run) {
+ return CoffeeScript.run(t.input, t.options);
+ } else if (o.join && t.file !== o.join) {
+ sourceCode[sources.indexOf(t.file)] = t.input;
+ return compileJoin();
+ } else {
+ t.output = CoffeeScript.compile(t.input, t.options);
+ CoffeeScript.emit('success', task);
+ if (o.print) {
+ return printLine(t.output.trim());
+ } else if (o.compile) {
+ return writeJs(t.file, t.output, base);
+ } else if (o.lint) {
+ return lint(t.file, t.output);
+ }
+ }
+ } catch (err) {
+ CoffeeScript.emit('failure', err, task);
+ if (CoffeeScript.listeners('failure').length) {
+ return;
+ }
+ if (o.watch) {
+ return printLine(err.message + '\x07');
+ }
+ printWarn(err instanceof Error && err.stack || ("ERROR: " + err));
+ return process.exit(1);
+ }
+ };