Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 84 lines (59 sloc) 2.468 kb
e77ca28 @mhevery initial revision of jasmine-node
authored
1 jasmine-node
2 ======
f7204c1 @mhevery mini docs
authored
3
9273475 @spaghetticode add travis integration
spaghetticode authored
4 [![Build Status](https://secure.travis-ci.org/spaghetticode/jasmine-node.png)](http://travis-ci.org/spaghetticode/jasmine-node)
5
36669d8 @gfxmonk removed specs.js, as it seems superceded by cli.js.
gfxmonk authored
6 This node.js module makes the wonderful Pivotal Lab's jasmine
7 (http://github.com/pivotal/jasmine) spec framework available in
8 node.js.
f7204c1 @mhevery mini docs
authored
9
24d1d16 @Phoscur improved naming of helpers, install information in readme
Phoscur authored
10 install
11 ------
12 npm install jasmine-node -g
13
cc14b8a @mhevery Add usage details.
authored
14 usage
15 ------
16
9273475 @spaghetticode add travis integration
spaghetticode authored
17 Write the specifications for your code in *.js and *.coffee files in the
18 spec/ directory (note: your specification files must end with either
19 .spec.js or .spec.coffee; otherwise jasmine-node won't find them!). You
b5e72a7 correcting message
Adam Victor Nazareth Brandizzi authored
20 can use sub-directories to better organise your specs.
cc14b8a @mhevery Add usage details.
authored
21
36669d8 @gfxmonk removed specs.js, as it seems superceded by cli.js.
gfxmonk authored
22 If you have installed the npm package, you can run it with:
23
24 jasmine-node
25
26 If you aren't using npm, you should add `pwd`/lib to the $NODE_PATH
27 environment variable, then run:
28
29 node lib/jasmine-node/cli.js
cc14b8a @mhevery Add usage details.
authored
30
31
32 You can supply the following arguments:
33
081bd2a @mcollina Added basic autotest support.
mcollina authored
34 * <code>--autotest</code>, provides automatic execution of specs after
35 each changes
d235607 @iangreenleaf Adding `--coffee` to the readme.
iangreenleaf authored
36 * <code>--coffee</code>, allow execution of .coffee specs
36669d8 @gfxmonk removed specs.js, as it seems superceded by cli.js.
gfxmonk authored
37 * <code>--color</code>, indicates spec output should uses color to
38 indicates passing (green) or failing (red) specs
cc14b8a @mhevery Add usage details.
authored
39 * <code>--noColor</code>, do not use color in the output
40 * <code>--verbose</code>, verbose output as the specs are run
67400ed @TheRaven Added jasmine-reporters as dependency and added option to use a default ...
TheRaven authored
41 * <code>--junitreport</code>, export tests results as junitreport xml format'
cc14b8a @mhevery Add usage details.
authored
42
36669d8 @gfxmonk removed specs.js, as it seems superceded by cli.js.
gfxmonk authored
43 Checkout spec/SampleSpecs.js to see how to use it.
320976e @adomokos Adding the scripts directory with the specs script
adomokos authored
44
25ca90c @brianlow Default timeout on asynchronous tests to jasmines's DEFAULT_TIMEOUT_INTE...
brianlow authored
45 async tests
46 -----------
47
48 jasmine-node includes an alternate syntax for writing asynchronous tests. Accepting
9273475 @spaghetticode add travis integration
spaghetticode authored
49 a done callback in the specification will trigger jasmine-node to run the test
25ca90c @brianlow Default timeout on asynchronous tests to jasmines's DEFAULT_TIMEOUT_INTE...
brianlow authored
50 asynchronously waiting until the done() callback is called.
51
52 ```javascript
53 it("should respond with hello world", function(done) {
54 request("http://localhost:3000/hello", function(error, response, body){
55 expect(body).toEqual("hello world");
56 done();
57 });
58 });
59 ```
60
9273475 @spaghetticode add travis integration
spaghetticode authored
61 An asynchronous test will fail after 5000 ms if done() is not called. This timeout
62 can be changed by setting jasmine.DEFAULT_TIMEOUT_INTERVAL or by passing a timeout
25ca90c @brianlow Default timeout on asynchronous tests to jasmines's DEFAULT_TIMEOUT_INTE...
brianlow authored
63 interval in the specification.
64
65 it("should respond with hello world", function(done) {
66 request("http://localhost:3000/hello", function(error, response, body){
67 done();
68 }, 250); // timeout after 250 ms
69 });
320976e @adomokos Adding the scripts directory with the specs script
adomokos authored
70
71 development
72 -----------
73 Install the dependent packages by running:
74
75 npm install
76
77 Run the specs before you send your pull request:
78
79 scripts/specs
80
81 or
82
83 scripts/specs --verbose
Something went wrong with that request. Please try again.