Added node.js JSpec testing support
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by visionmedia · committed by visionmedia · parent 50b3c2c · Browse files · 6 files·+44 added−101 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
6 files+44 added−101 removed
- tests:+43 added−100 removed
- other:+1 added−1 removed
Provenance
- Commit
2852524- Tree
87e2a15- Author
visionmedia <tj@vision-media.ca>- Committer
visionmedia <tj@vision-media.ca>- Parent
50b3c2c
6 files changed+44 added−101 removed
modified:lib/express.core.js+1 added-1 removed
592 unmodified lines593 get('/user/:name', function(){594 'User ' + param('name')595 })596 597-Express.start()597+// Express.start()modified:spec/spec.core.js-41 removed
1234567891011121314151617181920212223242526272829303132333435363738394041422345150 unmodified linesExpand all
node = { http : {}}node.http.STATUS_CODES = { 100 : 'Continue', 101 : 'Switching Protocols', 200 : 'OK', 201 : 'Created', 202 : 'Accepted', 203 : 'Non-Authoritative Information', 204 : 'No Content', 205 : 'Reset Content', 206 : 'Partial Content', 300 : 'Multiple Choices', 301 : 'Moved Permanently', 302 : 'Moved Temporarily', 303 : 'See Other', 304 : 'Not Modified', 305 : 'Use Proxy', 400 : 'Bad Request', 401 : 'Unauthorized', 402 : 'Payment Required', 403 : 'Forbidden', 404 : 'Not Found', 405 : 'Method Not Allowed', 406 : 'Not Acceptable', 407 : 'Proxy Authentication Required', 408 : 'Request Time-out', 409 : 'Conflict', 410 : 'Gone', 411 : 'Length Required', 412 : 'Precondition Failed', 413 : 'Request Entity Too Large', 414 : 'Request-URI Too Large', 415 : 'Unsupported Media Type', 500 : 'Internal Server Error', 501 : 'Not Implemented', 502 : 'Bad Gateway', 503 : 'Service Unavailable', 504 : 'Gateway Time-out', 505 : 'HTTP Version not supported'}
describe 'Express' describe '.version' it 'should be properly formatted' Express.version.should.match /\d+\.\d+\.\d+/150 unmodified linesExpand alldeleted:spec/spec.dom.html-25 removed
12345678910111213141516171819202122232425<html> <head> <link type="text/css" rel="stylesheet" href="/Library/Ruby/Gems/1.8/gems/visionmedia-jspec-2.5.0/lib/jspec.css" /> <script src="/Library/Ruby/Gems/1.8/gems/visionmedia-jspec-2.5.0/lib/jspec.js"></script> <script src="../lib/express.core.js"></script> <script src="../lib/express.mime.js"></script> <script src="../lib/express.view.js"></script> <script> function runSuites() { JSpec .exec('spec.core.js') .exec('spec.routing.js') .exec('spec.mime.js') .exec('spec.view.js') .run() .report() } </script> </head> <body class="jspec" onLoad="runSuites();"> <div id="jspec-top"><h2 id="jspec-title">JSpec <em><script>document.write(JSpec.version)</script></em></h2></div> <div id="jspec"></div> <div id="jspec-bottom"></div> </body></html>No newline at end of fileadded:spec/spec.node.js+43 added
1+2+__loading__ = []3+__loadDelay__ = 5004+5+readFile = function(path, callback) {6+ __loading__.push(path)7+ var promise = node.fs.cat(path, "utf8")8+ promise.addErrback(function(){ throw "failed to read file `" + path + "'" })9+ promise.addCallback(function(contents){10+ setTimeout(function(){11+ if (__loading__[0] == path)12+ __loading__.shift(), callback(contents)13+ else14+ setTimeout(arguments.callee, 50)15+ }, 50)16+ }) 17+}18+19+load = function(path) {20+ readFile(path, function(contents){21+ eval(contents)22+ })23+}24+25+load('/Users/tjholowaychuk/scripts/gems/JSpec/lib/jspec.js')26+load('lib/express.core.js')27+load('lib/express.mime.js')28+load('lib/express.view.js')29+30+setTimeout(function(){31+ JSpec32+ .exec('spec/spec.core.js')33+ .exec('spec/spec.routing.js')34+ .exec('spec/spec.mime.js')35+ .exec('spec/spec.view.js')36+ setTimeout(function(){ 37+ JSpec.run({ formatter : JSpec.formatters.Terminal, failuresOnly : true })38+ setTimeout(function() {39+ JSpec.report()40+ }, __loadDelay__ / 3)41+ }, __loadDelay__ / 3)42+}, __loadDelay__ / 3)43+deleted:spec/spec.rhino.js-13 removed
12345678910111213
load('/Library/Ruby/Gems/1.8/gems/visionmedia-jspec-2.5.0/lib/jspec.js')load('lib/express.core.js')load('lib/express.mime.js')load('lib/express.view.js')
JSpec.exec('spec/spec.core.js').exec('spec/spec.routing.js').exec('spec/spec.mime.js').exec('spec/spec.view.js').run({ failuresOnly : true, formatter : JSpec.formatters.Terminal }).report()No newline at end of filedeleted:spec/spec.server.html-21 removed
1-<html>2- <head>3- <script src="jspec.js"></script>4- <script src="../lib/express.core.js"></script>5- <script src="../lib/express.mime.js"></script>6- <script src="../lib/express.view.js"></script>7- <script>8- function runSuites() {9- JSpec10- .exec('spec.core.js')11- .exec('spec.routing.js')12- .exec('spec.mime.js')13- .exec('spec.view.js')14- .run()15- .reportToServer()16- }17- </script>18- </head>19- <body class="jspec" onLoad="runSuites();">20- </body>21-</html>