Skip to content
This repository
Browse code

Added `make test-docs`

  • Loading branch information...
commit 18e563fcf1bd45eea3f43c5e829ecc7ecb3ae1dc 1 parent d582f7b
TJ Holowaychuk authored
7 Makefile
@@ -22,9 +22,12 @@ superagent.min.js: superagent.js
22 22 test-server:
23 23 @node test/server
24 24
25   -docs: lib
  25 +docs: lib test-docs
  26 +
  27 +test-docs:
  28 + make test REPORTER=doc | cat docs/head.html - cat docs/tail.html > docs/test.html
26 29
27 30 clean:
28 31 rm -f superagent{,.min}.js
29 32
30   -.PHONY: test docs clean
  33 +.PHONY: test docs test-docs clean
39 docs/head.html
... ... @@ -0,0 +1,39 @@
  1 +<!DOCTYPE html>
  2 +<html>
  3 + <head>
  4 + <title>Superagent</title>
  5 + <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"></script>
  6 + <style>
  7 + body {
  8 + font: 16px/1.6 "Helvetica Neue", arial, sans-serif;
  9 + padding: 60px;
  10 + }
  11 + pre { font-size: 14px; line-height: 1.3 }
  12 + code .init { color: #2F6FAD }
  13 + code .string { color: #5890AD }
  14 + code .keyword { color: #8A6343 }
  15 + code .number { color: #2F6FAD }
  16 + </style>
  17 + <script>
  18 + $(function(){
  19 + $('code').each(function(){
  20 + $(this).html(highlight($(this).text()));
  21 + });
  22 + });
  23 +
  24 + function highlight(js) {
  25 + return js
  26 + .replace(/</g, '&lt;')
  27 + .replace(/>/g, '&gt;')
  28 + .replace(/\/\/(.*)/gm, '<span class="comment">//$1</span>')
  29 + .replace(/('.*')/gm, '<span class="string">$1</span>')
  30 + .replace(/(\d+\.\d+)/gm, '<span class="number">$1</span>')
  31 + .replace(/(\d+)/gm, '<span class="number">$1</span>')
  32 + .replace(/\bnew *(\w+)/gm, '<span class="keyword">new</span> <span class="init">$1</span>')
  33 + .replace(/\b(function|new|throw|return|var|if|else)\b/gm, '<span class="keyword">$1</span>')
  34 + }
  35 + </script>
  36 + </head>
  37 + <body>
  38 + <h1>Superagent</h1>
  39 + <p>The superagent test suite.</p>
2  docs/tail.html
... ... @@ -0,0 +1,2 @@
  1 + </body>
  2 +</html>
2  test/node/basic.js
@@ -202,7 +202,7 @@ describe('request', function(){
202 202 })
203 203 })
204 204
205   - describe('req.send(obj)', function(){
  205 + describe('req.send(Object)', function(){
206 206 it('should default to json', function(done){
207 207 request
208 208 .post('http://localhost:3000/echo')

0 comments on commit 18e563f

Please sign in to comment.
Something went wrong with that request. Please try again.