stylus-source 0.31.0 → 0.32.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/VERSION +1 -1
- data/vendor/lib/nodes/unit.js +1 -1
- data/vendor/lib/parser.js +0 -1
- data/vendor/lib/renderer.js +2 -0
- data/vendor/lib/visitor/compiler.js +6 -0
- data/vendor/node_modules/cssom/README.mdown +34 -0
- data/vendor/node_modules/cssom/package.json +2 -1
- data/vendor/node_modules/debug/History.md +15 -0
- data/vendor/node_modules/debug/Readme.md +3 -18
- data/vendor/node_modules/debug/component.json +9 -0
- data/vendor/node_modules/debug/debug.js +10 -2
- data/vendor/node_modules/debug/index.js +5 -2
- data/vendor/node_modules/debug/lib/debug.js +5 -6
- data/vendor/node_modules/debug/package.json +11 -6
- data/vendor/node_modules/mkdirp/package.json +6 -9
- data/vendor/node_modules/mkdirp/{README.markdown → readme.markdown} +26 -24
- data/vendor/node_modules/mocha/History.md +140 -58
- data/vendor/node_modules/mocha/LICENSE +2 -2
- data/vendor/node_modules/mocha/Makefile +20 -5
- data/vendor/node_modules/mocha/Readme.md +110 -22
- data/vendor/node_modules/mocha/_mocha.js +574 -182
- data/vendor/node_modules/mocha/bin/_mocha +39 -22
- data/vendor/node_modules/mocha/bin/mocha +6 -2
- data/vendor/node_modules/mocha/component.json +16 -0
- data/vendor/node_modules/mocha/lib/browser/debug.js +1 -2
- data/vendor/node_modules/mocha/lib/browser/diff.js +287 -0
- data/vendor/node_modules/mocha/lib/browser/tty.js +7 -2
- data/vendor/node_modules/mocha/lib/hook.js +0 -1
- data/vendor/node_modules/mocha/lib/interfaces/bdd.js +3 -3
- data/vendor/node_modules/mocha/lib/interfaces/exports.js +5 -5
- data/vendor/node_modules/mocha/lib/interfaces/qunit.js +38 -9
- data/vendor/node_modules/mocha/lib/interfaces/tdd.js +15 -2
- data/vendor/node_modules/mocha/lib/mocha.js +20 -4
- data/vendor/node_modules/mocha/lib/reporters/base.js +57 -37
- data/vendor/node_modules/mocha/lib/reporters/html.js +2 -4
- data/vendor/node_modules/mocha/lib/reporters/json-stream.js +4 -14
- data/vendor/node_modules/mocha/lib/reporters/json.js +9 -19
- data/vendor/node_modules/mocha/lib/reporters/markdown.js +0 -1
- data/vendor/node_modules/mocha/lib/reporters/min.js +2 -2
- data/vendor/node_modules/mocha/lib/reporters/nyan.js +33 -39
- data/vendor/node_modules/mocha/lib/reporters/tap.js +12 -2
- data/vendor/node_modules/mocha/lib/reporters/templates/coverage.jade +3 -3
- data/vendor/node_modules/mocha/lib/reporters/templates/menu.jade +1 -1
- data/vendor/node_modules/mocha/lib/reporters/xunit.js +4 -4
- data/vendor/node_modules/mocha/lib/runnable.js +7 -9
- data/vendor/node_modules/mocha/lib/runner.js +24 -9
- data/vendor/node_modules/mocha/lib/template.html +2 -1
- data/vendor/node_modules/mocha/lib/utils.js +3 -3
- data/vendor/node_modules/mocha/mocha.css +37 -13
- data/vendor/node_modules/mocha/mocha.js +661 -253
- data/vendor/node_modules/mocha/node_modules/commander/package.json +5 -1
- data/vendor/node_modules/mocha/node_modules/diff/package.json +5 -1
- data/vendor/node_modules/mocha/node_modules/glob/LICENSE +27 -0
- data/vendor/node_modules/mocha/node_modules/glob/README.md +250 -0
- data/vendor/node_modules/mocha/node_modules/glob/examples/g.js +9 -0
- data/vendor/node_modules/mocha/node_modules/glob/examples/usr-local.js +9 -0
- data/vendor/node_modules/mocha/node_modules/glob/glob.js +675 -0
- data/vendor/node_modules/mocha/node_modules/glob/node_modules/graceful-fs/LICENSE +27 -0
- data/vendor/node_modules/mocha/node_modules/glob/node_modules/graceful-fs/README.md +33 -0
- data/vendor/node_modules/mocha/node_modules/glob/node_modules/graceful-fs/graceful-fs.js +442 -0
- data/vendor/node_modules/mocha/node_modules/glob/node_modules/graceful-fs/package.json +49 -0
- data/vendor/node_modules/mocha/node_modules/glob/node_modules/graceful-fs/test/open.js +46 -0
- data/vendor/node_modules/mocha/node_modules/glob/node_modules/graceful-fs/test/ulimit.js +158 -0
- data/vendor/node_modules/mocha/node_modules/glob/node_modules/inherits/README.md +51 -0
- data/vendor/node_modules/mocha/node_modules/glob/node_modules/inherits/inherits.js +29 -0
- data/vendor/node_modules/mocha/node_modules/glob/node_modules/inherits/package.json +26 -0
- data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/LICENSE +23 -0
- data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/README.md +218 -0
- data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/minimatch.js +1079 -0
- data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/AUTHORS +8 -0
- data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/LICENSE +23 -0
- data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/README.md +97 -0
- data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/lib/lru-cache.js +257 -0
- data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/package.json +59 -0
- data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/s.js +25 -0
- data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/test/basic.js +329 -0
- data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/test/foreach.js +52 -0
- data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/test/memory-leak.js +50 -0
- data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/sigmund/LICENSE +27 -0
- data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/sigmund/README.md +53 -0
- data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/sigmund/bench.js +283 -0
- data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/sigmund/package.json +38 -0
- data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/sigmund/sigmund.js +39 -0
- data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/sigmund/test/basic.js +24 -0
- data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/package.json +36 -0
- data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/test/basic.js +399 -0
- data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/test/brace-expand.js +33 -0
- data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/test/caching.js +14 -0
- data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/test/defaults.js +274 -0
- data/vendor/node_modules/mocha/node_modules/glob/package.json +40 -0
- data/vendor/node_modules/mocha/node_modules/glob/test/00-setup.js +176 -0
- data/vendor/node_modules/mocha/node_modules/glob/test/bash-comparison.js +63 -0
- data/vendor/node_modules/mocha/node_modules/glob/test/bash-results.json +350 -0
- data/vendor/node_modules/mocha/node_modules/glob/test/cwd-test.js +55 -0
- data/vendor/node_modules/mocha/node_modules/glob/test/globstar-match.js +19 -0
- data/vendor/node_modules/mocha/node_modules/glob/test/mark.js +74 -0
- data/vendor/node_modules/mocha/node_modules/glob/test/nocase-nomagic.js +113 -0
- data/vendor/node_modules/mocha/node_modules/glob/test/pause-resume.js +73 -0
- data/vendor/node_modules/mocha/node_modules/glob/test/root-nomount.js +39 -0
- data/vendor/node_modules/mocha/node_modules/glob/test/root.js +46 -0
- data/vendor/node_modules/mocha/node_modules/glob/test/stat.js +32 -0
- data/vendor/node_modules/mocha/node_modules/glob/test/zz-cleanup.js +11 -0
- data/vendor/node_modules/mocha/node_modules/growl/History.md +5 -0
- data/vendor/node_modules/mocha/node_modules/growl/lib/growl.js +2 -0
- data/vendor/node_modules/mocha/node_modules/growl/package.json +7 -3
- data/vendor/node_modules/mocha/node_modules/jade/node_modules/mkdirp/package.json +5 -1
- data/vendor/node_modules/mocha/node_modules/jade/package.json +5 -1
- data/vendor/node_modules/mocha/node_modules/ms/package.json +5 -1
- data/vendor/node_modules/mocha/package.json +13 -7
- data/vendor/node_modules/mocha/test.js +10 -21
- data/vendor/node_modules/should/History.md +5 -0
- data/vendor/node_modules/should/Readme.md +172 -172
- data/vendor/node_modules/should/lib/eql.js +2 -0
- data/vendor/node_modules/should/lib/should.js +4 -3
- data/vendor/node_modules/should/package.json +8 -4
- data/vendor/node_modules/should/test/should.test.js +27 -0
- data/vendor/package.json +1 -1
- metadata +61 -35
- data/vendor/node_modules/debug/Makefile +0 -4
- data/vendor/node_modules/debug/debug.component.js +0 -120
- data/vendor/node_modules/debug/head.js +0 -1
- data/vendor/node_modules/debug/tail.js +0 -4
- data/vendor/node_modules/mocha/node_modules/mkdirp/LICENSE +0 -21
- data/vendor/node_modules/mocha/node_modules/mkdirp/README.markdown +0 -61
- data/vendor/node_modules/mocha/node_modules/mkdirp/examples/pow.js +0 -6
- data/vendor/node_modules/mocha/node_modules/mkdirp/examples/pow.js.orig +0 -6
- data/vendor/node_modules/mocha/node_modules/mkdirp/examples/pow.js.rej +0 -19
- data/vendor/node_modules/mocha/node_modules/mkdirp/index.js +0 -94
- data/vendor/node_modules/mocha/node_modules/mkdirp/package.json +0 -33
- data/vendor/node_modules/mocha/node_modules/mkdirp/test/chmod.js +0 -38
- data/vendor/node_modules/mocha/node_modules/mkdirp/test/clobber.js +0 -37
- data/vendor/node_modules/mocha/node_modules/mkdirp/test/mkdirp.js +0 -28
- data/vendor/node_modules/mocha/node_modules/mkdirp/test/perm.js +0 -32
- data/vendor/node_modules/mocha/node_modules/mkdirp/test/perm_sync.js +0 -39
- data/vendor/node_modules/mocha/node_modules/mkdirp/test/race.js +0 -41
- data/vendor/node_modules/mocha/node_modules/mkdirp/test/rel.js +0 -32
- data/vendor/node_modules/mocha/node_modules/mkdirp/test/return.js +0 -25
- data/vendor/node_modules/mocha/node_modules/mkdirp/test/return_sync.js +0 -24
- data/vendor/node_modules/mocha/node_modules/mkdirp/test/root.js +0 -18
- data/vendor/node_modules/mocha/node_modules/mkdirp/test/sync.js +0 -32
- data/vendor/node_modules/mocha/node_modules/mkdirp/test/umask.js +0 -28
- data/vendor/node_modules/mocha/node_modules/mkdirp/test/umask_sync.js +0 -32
@@ -5,21 +5,21 @@ It extends the Object prototype with a single non-enumerable getter that allows
|
|
5
5
|
_should_ literally extends node's _assert_ module, in fact, it is node's assert module, for example `should.equal(str, 'foo')` will work, just as `assert.equal(str, 'foo')` would, and `should.AssertionError` **is** `assert.AssertionError`, meaning any test framework supporting this constructor will function properly with _should_.
|
6
6
|
|
7
7
|
## Example
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
8
|
+
```javascript
|
9
|
+
var user = {
|
10
|
+
name: 'tj'
|
11
|
+
, pets: ['tobi', 'loki', 'jane', 'bandit']
|
12
|
+
};
|
13
|
+
|
14
|
+
user.should.have.property('name', 'tj');
|
15
|
+
user.should.have.property('pets').with.lengthOf(4);
|
16
|
+
|
17
|
+
someAsyncTask(foo, function(err, result){
|
18
|
+
should.not.exist(err);
|
19
|
+
should.exist(result);
|
20
|
+
result.bar.should.equal(foo);
|
21
|
+
});
|
22
|
+
```
|
23
23
|
## Installation
|
24
24
|
|
25
25
|
$ npm install should
|
@@ -27,253 +27,253 @@ _should_ literally extends node's _assert_ module, in fact, it is node's assert
|
|
27
27
|
## assert extras
|
28
28
|
|
29
29
|
As mentioned above, _should_ extends node's _assert_. The returned object from `require('should')` is thus similar to the returned object from `require('assert')`, but it has one extra convenience method:
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
30
|
+
```javascript
|
31
|
+
should.exist('hello')
|
32
|
+
should.exist([])
|
33
|
+
should.exist(null) // will throw
|
34
|
+
```
|
35
35
|
This is equivalent to `should.ok`, which is equivalent to `assert.ok`, but reads a bit better. It gets better, though:
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
36
|
+
```javascript
|
37
|
+
should.not.exist(false)
|
38
|
+
should.not.exist('')
|
39
|
+
should.not.exist({}) // will throw
|
40
|
+
```
|
41
41
|
We may add more _assert_ extras in the future... ;)
|
42
42
|
|
43
43
|
## chaining assertions
|
44
44
|
|
45
45
|
Some assertions can be chained, for example if a property is volatile we can first assert property existence:
|
46
|
-
|
47
|
-
|
48
|
-
|
46
|
+
```javascript
|
47
|
+
user.should.have.property('pets').with.lengthOf(4)
|
48
|
+
```
|
49
49
|
which is essentially equivalent to below, however the property may not exist:
|
50
|
-
|
51
|
-
|
52
|
-
|
50
|
+
```javascript
|
51
|
+
user.pets.should.have.lengthOf(4)
|
52
|
+
```
|
53
53
|
our dummy getters such as _and_ also help express chaining:
|
54
|
-
|
55
|
-
|
56
|
-
|
54
|
+
```javascript
|
55
|
+
user.should.be.a('object').and.have.property('name', 'tj')
|
56
|
+
```
|
57
57
|
## exist (static)
|
58
58
|
|
59
59
|
The returned object from `require('should')` is the same object as `require('assert')`. So you can use `should` just like `assert`:
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
60
|
+
```javascript
|
61
|
+
should.fail('expected an error!')
|
62
|
+
should.strictEqual(foo, bar)
|
63
|
+
```
|
64
64
|
In general, using the Object prototype's _should_ is nicer than using these `assert` equivalents, because _should_ gives you access to the expressive and readable language described above:
|
65
|
-
|
66
|
-
|
67
|
-
|
65
|
+
```javascript
|
66
|
+
foo.should.equal(bar) // same as should.strictEqual(foo, bar) above
|
67
|
+
```
|
68
68
|
The only exception, though, is when you can't be sure that a particular object exists. In that case, attempting to access the _should_ property may throw a TypeError:
|
69
|
-
|
70
|
-
|
71
|
-
|
69
|
+
```javascript
|
70
|
+
foo.should.equal(bar) // throws if foo is null or undefined!
|
71
|
+
```
|
72
72
|
For this case, `require('should')` extends `require('assert')` with an extra convenience method to check whether an object exists:
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
73
|
+
```javascript
|
74
|
+
should.exist({})
|
75
|
+
should.exist([])
|
76
|
+
should.exist('')
|
77
|
+
should.exist(0)
|
78
|
+
should.exist(null) // will throw
|
79
|
+
should.exist(undefined) // will throw
|
80
|
+
```
|
81
81
|
You can also check the negation:
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
82
|
+
```javascript
|
83
|
+
should.not.exist(undefined)
|
84
|
+
should.not.exist(null)
|
85
|
+
should.not.exist('') // will throw
|
86
|
+
should.not.exist({}) // will throw
|
87
|
+
```
|
88
88
|
Once you know an object exists, you can safely use the _should_ property on it.
|
89
89
|
|
90
90
|
## ok
|
91
91
|
|
92
92
|
Assert truthfulness:
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
93
|
+
```javascript
|
94
|
+
true.should.be.ok
|
95
|
+
'yay'.should.be.ok
|
96
|
+
(1).should.be.ok
|
97
|
+
```
|
98
98
|
or negated:
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
99
|
+
```javascript
|
100
|
+
false.should.not.be.ok
|
101
|
+
''.should.not.be.ok
|
102
|
+
(0).should.not.be.ok
|
103
|
+
```
|
104
104
|
## true
|
105
105
|
|
106
106
|
Assert === true:
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
107
|
+
```javascript
|
108
|
+
true.should.be.true
|
109
|
+
'1'.should.not.be.true
|
110
|
+
```
|
111
111
|
## false
|
112
112
|
|
113
113
|
Assert === false:
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
114
|
+
```javascript
|
115
|
+
false.should.be.false
|
116
|
+
(0).should.not.be.false
|
117
|
+
```
|
118
118
|
## arguments
|
119
119
|
|
120
120
|
Assert `Arguments`:
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
121
|
+
```javascript
|
122
|
+
var args = (function(){ return arguments; })(1,2,3);
|
123
|
+
args.should.be.arguments;
|
124
|
+
[].should.not.be.arguments;
|
125
|
+
```
|
126
126
|
## empty
|
127
127
|
|
128
128
|
Asserts that length is 0:
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
129
|
+
```javascript
|
130
|
+
[].should.be.empty
|
131
|
+
''.should.be.empty
|
132
|
+
({ length: 0 }).should.be.empty
|
133
|
+
```
|
134
134
|
## eql
|
135
135
|
|
136
136
|
equality:
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
137
|
+
```javascript
|
138
|
+
({ foo: 'bar' }).should.eql({ foo: 'bar' })
|
139
|
+
[1,2,3].should.eql([1,2,3])
|
140
|
+
```
|
141
141
|
## equal
|
142
142
|
|
143
143
|
strict equality:
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
144
|
+
```javascript
|
145
|
+
should.strictEqual(undefined, value)
|
146
|
+
should.strictEqual(false, value)
|
147
|
+
(4).should.equal(4)
|
148
|
+
'test'.should.equal('test')
|
149
|
+
[1,2,3].should.not.equal([1,2,3])
|
150
|
+
```
|
151
151
|
## within
|
152
152
|
|
153
153
|
Assert inclusive numeric range:
|
154
|
-
|
155
|
-
|
156
|
-
|
154
|
+
```javascript
|
155
|
+
user.age.should.be.within(5, 50)
|
156
|
+
```
|
157
157
|
## a
|
158
158
|
|
159
159
|
Assert __typeof__:
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
160
|
+
```javascript
|
161
|
+
user.should.be.a('object')
|
162
|
+
'test'.should.be.a('string')
|
163
|
+
```
|
164
164
|
## instanceof and instanceOf
|
165
165
|
|
166
166
|
Assert __instanceof__ or __instanceOf__:
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
167
|
+
```javascript
|
168
|
+
user.should.be.an.instanceof(User)
|
169
|
+
[].should.be.an.instanceOf(Array)
|
170
|
+
```
|
171
171
|
## above
|
172
172
|
|
173
173
|
Assert numeric value above the given value:
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
174
|
+
```javascript
|
175
|
+
user.age.should.be.above(5)
|
176
|
+
user.age.should.not.be.above(100)
|
177
|
+
```
|
178
178
|
## below
|
179
179
|
|
180
180
|
Assert numeric value below the given value:
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
181
|
+
```javascript
|
182
|
+
user.age.should.be.below(100)
|
183
|
+
user.age.should.not.be.below(5)
|
184
|
+
```
|
185
185
|
## match
|
186
186
|
|
187
187
|
Assert regexp match:
|
188
|
-
|
189
|
-
|
190
|
-
|
188
|
+
```javascript
|
189
|
+
username.should.match(/^\w+$/)
|
190
|
+
```
|
191
191
|
## length
|
192
192
|
|
193
193
|
Assert _length_ property exists and has a value of the given number:
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
194
|
+
```javascript
|
195
|
+
user.pets.should.have.length(5)
|
196
|
+
user.pets.should.have.a.lengthOf(5)
|
197
|
+
```
|
198
198
|
Aliases: _lengthOf_
|
199
199
|
|
200
200
|
## property
|
201
201
|
|
202
202
|
Assert property exists and has optional value:
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
203
|
+
```javascript
|
204
|
+
user.should.have.property('name')
|
205
|
+
user.should.have.property('age', 15)
|
206
|
+
user.should.not.have.property('rawr')
|
207
|
+
user.should.not.have.property('age', 0)
|
208
|
+
```
|
209
209
|
## ownProperty
|
210
210
|
|
211
211
|
Assert own property (on the immediate object):
|
212
|
-
|
213
|
-
|
214
|
-
|
212
|
+
```javascript
|
213
|
+
({ foo: 'bar' }).should.have.ownProperty('foo')
|
214
|
+
```
|
215
215
|
## status(code)
|
216
216
|
|
217
217
|
Asserts that `.statusCode` is `code`:
|
218
|
-
|
219
|
-
|
220
|
-
|
218
|
+
```javascript
|
219
|
+
res.should.have.status(200);
|
220
|
+
```
|
221
221
|
## header(field[, value])
|
222
222
|
|
223
223
|
Asserts that a `.headers` object with `field` and optional `value` are present:
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
224
|
+
```javascript
|
225
|
+
res.should.have.header('content-length');
|
226
|
+
res.should.have.header('Content-Length', '123');
|
227
|
+
res.should.have.header('content-length', '123');
|
228
|
+
```
|
229
229
|
## json
|
230
230
|
|
231
231
|
Assert that Content-Type is "application/json; charset=utf-8"
|
232
|
-
|
233
|
-
|
234
|
-
|
232
|
+
```javascript
|
233
|
+
res.should.be.json
|
234
|
+
```
|
235
235
|
## html
|
236
236
|
|
237
237
|
Assert that Content-Type is "text/html; charset=utf-8"
|
238
|
-
|
239
|
-
|
240
|
-
|
238
|
+
```javascript
|
239
|
+
res.should.be.html
|
240
|
+
```
|
241
241
|
## include(obj)
|
242
242
|
|
243
243
|
Assert that the given `obj` is present via `indexOf()`, so this works for strings, arrays, or custom objects implementing indexOf.
|
244
244
|
|
245
245
|
Assert array value:
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
246
|
+
```javascript
|
247
|
+
[1,2,3].should.include(3)
|
248
|
+
[1,2,3].should.include(2)
|
249
|
+
[1,2,3].should.not.include(4)
|
250
|
+
```
|
251
251
|
Assert substring:
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
252
|
+
```javascript
|
253
|
+
'foo bar baz'.should.include('foo')
|
254
|
+
'foo bar baz'.should.include('bar')
|
255
|
+
'foo bar baz'.should.include('baz')
|
256
|
+
'foo bar baz'.should.not.include('FOO')
|
257
|
+
```
|
258
258
|
Assert object includes another object:
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
259
|
+
```javascript
|
260
|
+
var tobi = { name: 'Tobi', age: 1 };
|
261
|
+
var jane = { name: 'Jane', age: 5 };
|
262
|
+
var user = { name: 'TJ', pet: tobi };
|
263
|
+
|
264
|
+
user.should.include({ pet: tobi });
|
265
|
+
user.should.include({ pet: tobi, name: 'TJ' });
|
266
|
+
user.should.not.include({ pet: jane });
|
267
|
+
user.should.not.include({ name: 'Someone' });
|
268
|
+
```
|
269
269
|
## includeEql(obj)
|
270
270
|
|
271
271
|
Assert that an object equal to the given `obj` is present in an Array:
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
272
|
+
```javascript
|
273
|
+
[[1],[2],[3]].should.includeEql([3])
|
274
|
+
[[1],[2],[3]].should.includeEql([2])
|
275
|
+
[[1],[2],[3]].should.not.includeEql([4])
|
276
|
+
```
|
277
277
|
## throw()
|
278
278
|
|
279
279
|
Assert an exception is thrown:
|
@@ -72,7 +72,7 @@ exports.not.exist = exports.not.exists = function(obj, msg){
|
|
72
72
|
Object.defineProperty(Object.prototype, 'should', {
|
73
73
|
set: function(){},
|
74
74
|
get: function(){
|
75
|
-
return new Assertion(
|
75
|
+
return new Assertion(this.valueOf() == this ? this.valueOf() : this);
|
76
76
|
},
|
77
77
|
configurable: true
|
78
78
|
});
|
@@ -301,7 +301,7 @@ Assertion.prototype = {
|
|
301
301
|
|
302
302
|
equal: function(val, desc){
|
303
303
|
this.assert(
|
304
|
-
val
|
304
|
+
val === this.obj
|
305
305
|
, function(){ return 'expected ' + this.inspect + ' to equal ' + i(val) + (desc ? " | " + desc : "") }
|
306
306
|
, function(){ return 'expected ' + this.inspect + ' to not equal ' + i(val) + (desc ? " | " + desc : "") }
|
307
307
|
, val);
|
@@ -351,7 +351,7 @@ Assertion.prototype = {
|
|
351
351
|
this.assert(
|
352
352
|
type == typeof this.obj
|
353
353
|
, function(){ return 'expected ' + this.inspect + ' to be a ' + type + (desc ? " | " + desc : "") }
|
354
|
-
, function(){ return 'expected ' + this.inspect + ' not to be a ' + type + (desc ? " | " + desc : "") })
|
354
|
+
, function(){ return 'expected ' + this.inspect + ' not to be a ' + type + (desc ? " | " + desc : "") })
|
355
355
|
return this;
|
356
356
|
},
|
357
357
|
|
@@ -484,6 +484,7 @@ Assertion.prototype = {
|
|
484
484
|
this.obj.hasOwnProperty(name)
|
485
485
|
, function(){ return 'expected ' + this.inspect + ' to have own property ' + i(name) + (desc ? " | " + desc : "") }
|
486
486
|
, function(){ return 'expected ' + this.inspect + ' to not have own property ' + i(name) + (desc ? " | " + desc : "") });
|
487
|
+
this.obj = this.obj[name];
|
487
488
|
return this;
|
488
489
|
},
|
489
490
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "should",
|
3
3
|
"description": "test framework agnostic BDD-style assertions",
|
4
|
-
"version": "1.2.
|
4
|
+
"version": "1.2.2",
|
5
5
|
"author": {
|
6
6
|
"name": "TJ Holowaychuk",
|
7
7
|
"email": "tj@vision-media.ca"
|
@@ -29,8 +29,12 @@
|
|
29
29
|
"engines": {
|
30
30
|
"node": ">= 0.2.0"
|
31
31
|
},
|
32
|
-
"readme": "_should_ is an expressive, readable, test framework agnostic, assertion library for [node](http://nodejs.org).\n\nIt extends the Object prototype with a single non-enumerable getter that allows you to express how that object should behave.\n\n_should_ literally extends node's _assert_ module, in fact, it is node's assert module, for example `should.equal(str, 'foo')` will work, just as `assert.equal(str, 'foo')` would, and `should.AssertionError` **is** `assert.AssertionError`, meaning any test framework supporting this constructor will function properly with _should_.\n\n## Example\n\n var user = {\n name: 'tj'\n , pets: ['tobi', 'loki', 'jane', 'bandit']\n };\n\n user.should.have.property('name', 'tj');\n user.should.have.property('pets').with.lengthOf(4);\n\n someAsyncTask(foo, function(err, result){\n should.not.exist(err);\n should.exist(result);\n result.bar.should.equal(foo);\n });\n\n## Installation\n\n $ npm install should\n\n## assert extras\n\nAs mentioned above, _should_ extends node's _assert_. The returned object from `require('should')` is thus similar to the returned object from `require('assert')`, but it has one extra convenience method:\n\n should.exist('hello')\n should.exist([])\n should.exist(null) // will throw\n\nThis is equivalent to `should.ok`, which is equivalent to `assert.ok`, but reads a bit better. It gets better, though:\n\n should.not.exist(false)\n should.not.exist('')\n should.not.exist({}) // will throw\n\nWe may add more _assert_ extras in the future... ;)\n\n## chaining assertions\n\nSome assertions can be chained, for example if a property is volatile we can first assert property existence:\n\n user.should.have.property('pets').with.lengthOf(4)\n\nwhich is essentially equivalent to below, however the property may not exist:\n\n user.pets.should.have.lengthOf(4)\n\nour dummy getters such as _and_ also help express chaining:\n\n user.should.be.a('object').and.have.property('name', 'tj')\n\n## exist (static)\n\nThe returned object from `require('should')` is the same object as `require('assert')`. So you can use `should` just like `assert`:\n\n should.fail('expected an error!')\n should.strictEqual(foo, bar)\n\nIn general, using the Object prototype's _should_ is nicer than using these `assert` equivalents, because _should_ gives you access to the expressive and readable language described above:\n\n foo.should.equal(bar) // same as should.strictEqual(foo, bar) above\n\nThe only exception, though, is when you can't be sure that a particular object exists. In that case, attempting to access the _should_ property may throw a TypeError:\n\n foo.should.equal(bar) // throws if foo is null or undefined!\n\nFor this case, `require('should')` extends `require('assert')` with an extra convenience method to check whether an object exists:\n\n should.exist({})\n should.exist([])\n should.exist('')\n should.exist(0)\n should.exist(null) // will throw\n should.exist(undefined) // will throw\n\nYou can also check the negation:\n\n should.not.exist(undefined)\n should.not.exist(null)\n should.not.exist('') // will throw\n should.not.exist({}) // will throw\n\nOnce you know an object exists, you can safely use the _should_ property on it.\n\n## ok\n\nAssert truthfulness:\n\n true.should.be.ok\n 'yay'.should.be.ok\n (1).should.be.ok\n\nor negated:\n\n false.should.not.be.ok\n ''.should.not.be.ok\n (0).should.not.be.ok\n\n## true\n\nAssert === true:\n\n true.should.be.true\n '1'.should.not.be.true\n\n## false\n\nAssert === false:\n\n false.should.be.false\n (0).should.not.be.false\n\n## arguments\n\nAssert `Arguments`:\n\n var args = (function(){ return arguments; })(1,2,3);\n args.should.be.arguments;\n [].should.not.be.arguments;\n\n## empty\n\nAsserts that length is 0:\n\n [].should.be.empty\n ''.should.be.empty\n ({ length: 0 }).should.be.empty\n\n## eql\n\nequality:\n\n ({ foo: 'bar' }).should.eql({ foo: 'bar' })\n [1,2,3].should.eql([1,2,3])\n\n## equal\n\nstrict equality:\n\n should.strictEqual(undefined, value)\n should.strictEqual(false, value)\n (4).should.equal(4)\n 'test'.should.equal('test')\n [1,2,3].should.not.equal([1,2,3])\n\n## within\n\nAssert inclusive numeric range:\n\n user.age.should.be.within(5, 50)\n\n## a\n\nAssert __typeof__:\n\n user.should.be.a('object')\n 'test'.should.be.a('string')\n\n## instanceof and instanceOf\n\nAssert __instanceof__ or __instanceOf__:\n\n user.should.be.an.instanceof(User)\n [].should.be.an.instanceOf(Array)\n\n## above\n\nAssert numeric value above the given value:\n\n user.age.should.be.above(5)\n user.age.should.not.be.above(100)\n\n## below\n\nAssert numeric value below the given value:\n\n user.age.should.be.below(100)\n user.age.should.not.be.below(5)\n\n## match\n\nAssert regexp match:\n\n username.should.match(/^\\w+$/)\n\n## length\n\nAssert _length_ property exists and has a value of the given number:\n\n user.pets.should.have.length(5)\n user.pets.should.have.a.lengthOf(5)\n\nAliases: _lengthOf_\n\n## property\n\nAssert property exists and has optional value:\n\n user.should.have.property('name')\n user.should.have.property('age', 15)\n user.should.not.have.property('rawr')\n user.should.not.have.property('age', 0)\n\n## ownProperty\n\nAssert own property (on the immediate object):\n\n ({ foo: 'bar' }).should.have.ownProperty('foo')\n\n## status(code)\n\n Asserts that `.statusCode` is `code`:\n\n res.should.have.status(200);\n\n## header(field[, value])\n\n Asserts that a `.headers` object with `field` and optional `value` are present:\n\n res.should.have.header('content-length');\n res.should.have.header('Content-Length', '123');\n res.should.have.header('content-length', '123');\n\n## json\n\n Assert that Content-Type is \"application/json; charset=utf-8\"\n\n res.should.be.json\n\n## html\n\n Assert that Content-Type is \"text/html; charset=utf-8\"\n\n res.should.be.html\n\n## include(obj)\n\nAssert that the given `obj` is present via `indexOf()`, so this works for strings, arrays, or custom objects implementing indexOf.\n\nAssert array value:\n\n [1,2,3].should.include(3)\n [1,2,3].should.include(2)\n [1,2,3].should.not.include(4)\n\nAssert substring:\n\n 'foo bar baz'.should.include('foo')\n 'foo bar baz'.should.include('bar')\n 'foo bar baz'.should.include('baz')\n 'foo bar baz'.should.not.include('FOO')\n\nAssert object includes another object:\n\n var tobi = { name: 'Tobi', age: 1 };\n var jane = { name: 'Jane', age: 5 };\n var user = { name: 'TJ', pet: tobi };\n\n user.should.include({ pet: tobi });\n user.should.include({ pet: tobi, name: 'TJ' });\n user.should.not.include({ pet: jane });\n user.should.not.include({ name: 'Someone' });\n\n## includeEql(obj)\n\nAssert that an object equal to the given `obj` is present in an Array:\n\n [[1],[2],[3]].should.includeEql([3])\n [[1],[2],[3]].should.includeEql([2])\n [[1],[2],[3]].should.not.includeEql([4])\n\n## throw()\n\nAssert an exception is thrown:\n\n```js\n(function(){\n throw new Error('fail');\n}).should.throw();\n```\n\nAssert an exception is not thrown:\n\n```js\n(function(){\n\n}).should.not.throw();\n```\nAssert exepection message matches string:\n\n```js\n(function(){\n throw new Error('fail');\n}).should.throw('fail');\n```\n\nAssert exepection message matches regexp:\n\n```js\n(function(){\n throw new Error('failed to foo');\n}).should.throw(/^fail/);\n```\n\n## throwError()\n\nAn alias of `throw`, its purpose is to be an option for those who run\n[jshint](https://github.com/jshint/node-jshint/) in strict mode.\n\n```js\n(function(){\n throw new Error('failed to baz');\n}).should.throwError(/^fail.*/);\n```\n\n\n## keys\n\nAssert own object keys, which must match _exactly_,\nand will fail if you omit a key or two:\n\n var obj = { foo: 'bar', baz: 'raz' };\n obj.should.have.keys('foo', 'bar');\n obj.should.have.keys(['foo', 'bar']);\n\n## Optional Error description\n\nAs it can often be difficult to ascertain exactly where failed assertions are coming from in your tests, an optional description parameter can be passed to several should matchers. The description will follow the failed assertion in the error:\n\n (1).should.eql(0, 'some useful description')\n\n AssertionError: expected 1 to equal 0 | some useful description\n at Object.eql (/Users/swift/code/should.js/node_modules/should/lib/should.js:280:10)\n ...\n\nThe methods that support this optional description are: `eql`, `equal`, `within`, `a`, `instanceof`, `above`, `below`, `match`, `length`, `property`, `ownProperty`, `include`, and `includeEql`.\n\n## Express example\n\nFor example you can use should with the [Expresso TDD Framework](http://github.com/visionmedia/expresso) by simply including it:\n\n var lib = require('mylib')\n , should = require('should');\n\n module.exports = {\n 'test .version': function(){\n lib.version.should.match(/^\\d+\\.\\d+\\.\\d+$/);\n }\n };\n\n## Running tests\n\nTo run the tests for _should_ simply update your git submodules and run:\n\n $ make test\n\n## OMG IT EXTENDS OBJECT???!?!@\n\nYes, yes it does, with a single getter _should_, and no it won't break your code, because it does this **properly** with a non-enumerable property.\n\n## License\n\n(The MIT License)\n\nCopyright (c) 2010-2011 TJ Holowaychuk <tj@vision-media.ca>\nCopyright (c) 2011 Aseem Kishore <aseem.kishore@gmail.com>\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n",
|
32
|
+
"readme": "_should_ is an expressive, readable, test framework agnostic, assertion library for [node](http://nodejs.org).\n\nIt extends the Object prototype with a single non-enumerable getter that allows you to express how that object should behave.\n\n_should_ literally extends node's _assert_ module, in fact, it is node's assert module, for example `should.equal(str, 'foo')` will work, just as `assert.equal(str, 'foo')` would, and `should.AssertionError` **is** `assert.AssertionError`, meaning any test framework supporting this constructor will function properly with _should_.\n\n## Example\n```javascript\nvar user = {\n name: 'tj'\n , pets: ['tobi', 'loki', 'jane', 'bandit']\n};\n\nuser.should.have.property('name', 'tj');\nuser.should.have.property('pets').with.lengthOf(4);\n\nsomeAsyncTask(foo, function(err, result){\n should.not.exist(err);\n should.exist(result);\n result.bar.should.equal(foo);\n});\n```\n## Installation\n\n $ npm install should\n\n## assert extras\n\nAs mentioned above, _should_ extends node's _assert_. The returned object from `require('should')` is thus similar to the returned object from `require('assert')`, but it has one extra convenience method:\n```javascript\nshould.exist('hello')\nshould.exist([])\nshould.exist(null) // will throw\n```\nThis is equivalent to `should.ok`, which is equivalent to `assert.ok`, but reads a bit better. It gets better, though:\n```javascript\nshould.not.exist(false)\nshould.not.exist('')\nshould.not.exist({}) // will throw\n```\nWe may add more _assert_ extras in the future... ;)\n\n## chaining assertions\n\nSome assertions can be chained, for example if a property is volatile we can first assert property existence:\n```javascript\nuser.should.have.property('pets').with.lengthOf(4)\n```\nwhich is essentially equivalent to below, however the property may not exist:\n```javascript\nuser.pets.should.have.lengthOf(4)\n```\nour dummy getters such as _and_ also help express chaining:\n```javascript\nuser.should.be.a('object').and.have.property('name', 'tj')\n```\n## exist (static)\n\nThe returned object from `require('should')` is the same object as `require('assert')`. So you can use `should` just like `assert`:\n```javascript\nshould.fail('expected an error!')\nshould.strictEqual(foo, bar)\n```\nIn general, using the Object prototype's _should_ is nicer than using these `assert` equivalents, because _should_ gives you access to the expressive and readable language described above:\n```javascript\nfoo.should.equal(bar) // same as should.strictEqual(foo, bar) above\n```\nThe only exception, though, is when you can't be sure that a particular object exists. In that case, attempting to access the _should_ property may throw a TypeError:\n```javascript\nfoo.should.equal(bar) // throws if foo is null or undefined!\n```\nFor this case, `require('should')` extends `require('assert')` with an extra convenience method to check whether an object exists:\n```javascript\nshould.exist({})\nshould.exist([])\nshould.exist('')\nshould.exist(0)\nshould.exist(null) // will throw\nshould.exist(undefined) // will throw\n```\nYou can also check the negation:\n```javascript\nshould.not.exist(undefined)\nshould.not.exist(null)\nshould.not.exist('') // will throw\nshould.not.exist({}) // will throw\n```\nOnce you know an object exists, you can safely use the _should_ property on it.\n\n## ok\n\nAssert truthfulness:\n```javascript\ntrue.should.be.ok\n'yay'.should.be.ok\n(1).should.be.ok\n```\nor negated:\n```javascript\nfalse.should.not.be.ok\n''.should.not.be.ok\n(0).should.not.be.ok\n```\n## true\n\nAssert === true:\n```javascript\ntrue.should.be.true\n'1'.should.not.be.true\n```\n## false\n\nAssert === false:\n```javascript\nfalse.should.be.false\n(0).should.not.be.false\n```\n## arguments\n\nAssert `Arguments`:\n```javascript\nvar args = (function(){ return arguments; })(1,2,3);\nargs.should.be.arguments;\n[].should.not.be.arguments;\n```\n## empty\n\nAsserts that length is 0:\n```javascript\n[].should.be.empty\n''.should.be.empty\n({ length: 0 }).should.be.empty\n```\n## eql\n\nequality:\n```javascript\n({ foo: 'bar' }).should.eql({ foo: 'bar' })\n[1,2,3].should.eql([1,2,3])\n```\n## equal\n\nstrict equality:\n```javascript\nshould.strictEqual(undefined, value)\nshould.strictEqual(false, value)\n(4).should.equal(4)\n'test'.should.equal('test')\n[1,2,3].should.not.equal([1,2,3])\n```\n## within\n\nAssert inclusive numeric range:\n```javascript\nuser.age.should.be.within(5, 50)\n```\n## a\n\nAssert __typeof__:\n```javascript\nuser.should.be.a('object')\n'test'.should.be.a('string')\n```\n## instanceof and instanceOf\n\nAssert __instanceof__ or __instanceOf__:\n```javascript\nuser.should.be.an.instanceof(User)\n[].should.be.an.instanceOf(Array)\n```\n## above\n\nAssert numeric value above the given value:\n```javascript\nuser.age.should.be.above(5)\nuser.age.should.not.be.above(100)\n```\n## below\n\nAssert numeric value below the given value:\n```javascript\nuser.age.should.be.below(100)\nuser.age.should.not.be.below(5)\n```\n## match\n\nAssert regexp match:\n```javascript\nusername.should.match(/^\\w+$/)\n```\n## length\n\nAssert _length_ property exists and has a value of the given number:\n```javascript\nuser.pets.should.have.length(5)\nuser.pets.should.have.a.lengthOf(5)\n```\nAliases: _lengthOf_\n\n## property\n\nAssert property exists and has optional value:\n```javascript\nuser.should.have.property('name')\nuser.should.have.property('age', 15)\nuser.should.not.have.property('rawr')\nuser.should.not.have.property('age', 0)\n```\n## ownProperty\n\nAssert own property (on the immediate object):\n```javascript\n({ foo: 'bar' }).should.have.ownProperty('foo')\n```\n## status(code)\n\n Asserts that `.statusCode` is `code`:\n```javascript\nres.should.have.status(200);\n```\n## header(field[, value])\n\n Asserts that a `.headers` object with `field` and optional `value` are present:\n```javascript\nres.should.have.header('content-length');\nres.should.have.header('Content-Length', '123');\nres.should.have.header('content-length', '123');\n```\n## json\n\n Assert that Content-Type is \"application/json; charset=utf-8\"\n```javascript\nres.should.be.json\n```\n## html\n\n Assert that Content-Type is \"text/html; charset=utf-8\"\n```javascript\nres.should.be.html\n```\n## include(obj)\n\nAssert that the given `obj` is present via `indexOf()`, so this works for strings, arrays, or custom objects implementing indexOf.\n\nAssert array value:\n```javascript\n[1,2,3].should.include(3)\n[1,2,3].should.include(2)\n[1,2,3].should.not.include(4)\n```\nAssert substring:\n```javascript\n'foo bar baz'.should.include('foo')\n'foo bar baz'.should.include('bar')\n'foo bar baz'.should.include('baz')\n'foo bar baz'.should.not.include('FOO')\n```\nAssert object includes another object:\n```javascript\nvar tobi = { name: 'Tobi', age: 1 };\nvar jane = { name: 'Jane', age: 5 };\nvar user = { name: 'TJ', pet: tobi };\n\nuser.should.include({ pet: tobi });\nuser.should.include({ pet: tobi, name: 'TJ' });\nuser.should.not.include({ pet: jane });\nuser.should.not.include({ name: 'Someone' });\n```\n## includeEql(obj)\n\nAssert that an object equal to the given `obj` is present in an Array:\n```javascript\n[[1],[2],[3]].should.includeEql([3])\n[[1],[2],[3]].should.includeEql([2])\n[[1],[2],[3]].should.not.includeEql([4])\n```\n## throw()\n\nAssert an exception is thrown:\n\n```js\n(function(){\n throw new Error('fail');\n}).should.throw();\n```\n\nAssert an exception is not thrown:\n\n```js\n(function(){\n\n}).should.not.throw();\n```\nAssert exepection message matches string:\n\n```js\n(function(){\n throw new Error('fail');\n}).should.throw('fail');\n```\n\nAssert exepection message matches regexp:\n\n```js\n(function(){\n throw new Error('failed to foo');\n}).should.throw(/^fail/);\n```\n\n## throwError()\n\nAn alias of `throw`, its purpose is to be an option for those who run\n[jshint](https://github.com/jshint/node-jshint/) in strict mode.\n\n```js\n(function(){\n throw new Error('failed to baz');\n}).should.throwError(/^fail.*/);\n```\n\n\n## keys\n\nAssert own object keys, which must match _exactly_,\nand will fail if you omit a key or two:\n\n var obj = { foo: 'bar', baz: 'raz' };\n obj.should.have.keys('foo', 'bar');\n obj.should.have.keys(['foo', 'bar']);\n\n## Optional Error description\n\nAs it can often be difficult to ascertain exactly where failed assertions are coming from in your tests, an optional description parameter can be passed to several should matchers. The description will follow the failed assertion in the error:\n\n (1).should.eql(0, 'some useful description')\n\n AssertionError: expected 1 to equal 0 | some useful description\n at Object.eql (/Users/swift/code/should.js/node_modules/should/lib/should.js:280:10)\n ...\n\nThe methods that support this optional description are: `eql`, `equal`, `within`, `a`, `instanceof`, `above`, `below`, `match`, `length`, `property`, `ownProperty`, `include`, and `includeEql`.\n\n## Express example\n\nFor example you can use should with the [Expresso TDD Framework](http://github.com/visionmedia/expresso) by simply including it:\n\n var lib = require('mylib')\n , should = require('should');\n\n module.exports = {\n 'test .version': function(){\n lib.version.should.match(/^\\d+\\.\\d+\\.\\d+$/);\n }\n };\n\n## Running tests\n\nTo run the tests for _should_ simply update your git submodules and run:\n\n $ make test\n\n## OMG IT EXTENDS OBJECT???!?!@\n\nYes, yes it does, with a single getter _should_, and no it won't break your code, because it does this **properly** with a non-enumerable property.\n\n## License\n\n(The MIT License)\n\nCopyright (c) 2010-2011 TJ Holowaychuk <tj@vision-media.ca>\nCopyright (c) 2011 Aseem Kishore <aseem.kishore@gmail.com>\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n",
|
33
33
|
"readmeFilename": "Readme.md",
|
34
|
-
"_id": "should@1.2.
|
35
|
-
"
|
34
|
+
"_id": "should@1.2.2",
|
35
|
+
"dist": {
|
36
|
+
"shasum": "de2a9e27cb9dae77d67bc9b0b0b694a9f728e25f"
|
37
|
+
},
|
38
|
+
"_from": "should@*",
|
39
|
+
"_resolved": "https://registry.npmjs.org/should/-/should-1.2.2.tgz"
|
36
40
|
}
|
@@ -106,6 +106,14 @@ module.exports = {
|
|
106
106
|
function Foo(){}
|
107
107
|
new Foo().should.be.an.instanceof(Foo);
|
108
108
|
|
109
|
+
new Date().should.be.an.instanceof(Date);
|
110
|
+
|
111
|
+
var tobi = { name: 'Tobi', age: 2 };
|
112
|
+
tobi.should.be.an.instanceof(Object);
|
113
|
+
|
114
|
+
var getSomething = function() {return "something"};
|
115
|
+
getSomething.should.be.an.instanceof(Function);
|
116
|
+
|
109
117
|
err(function(){
|
110
118
|
(3).should.an.instanceof(Foo);
|
111
119
|
}, "expected 3 to be an instance of Foo");
|
@@ -119,6 +127,14 @@ module.exports = {
|
|
119
127
|
function Foo(){}
|
120
128
|
new Foo().should.be.an.instanceOf(Foo);
|
121
129
|
|
130
|
+
new Date().should.be.an.instanceOf(Date);
|
131
|
+
|
132
|
+
var tobi = { name: 'Tobi', age: 2 };
|
133
|
+
tobi.should.be.an.instanceOf(Object);
|
134
|
+
|
135
|
+
var getSomething = function() {return "something"};
|
136
|
+
getSomething.should.be.an.instanceOf(Function);
|
137
|
+
|
122
138
|
err(function(){
|
123
139
|
(9).should.an.instanceOf(Foo);
|
124
140
|
}, "expected 9 to be an instance of Foo");
|
@@ -246,6 +262,13 @@ module.exports = {
|
|
246
262
|
({ foo: 'bar' }).should.eql({ foo: 'bar' });
|
247
263
|
(1).should.eql(1);
|
248
264
|
'4'.should.not.eql(4);
|
265
|
+
var memo = [];
|
266
|
+
function memorize() {
|
267
|
+
memo.push(arguments);
|
268
|
+
}
|
269
|
+
memorize('a', [1, 2]);
|
270
|
+
memorize('a', [1, 2]);
|
271
|
+
memo[0].should.eql(memo[1]);
|
249
272
|
|
250
273
|
err(function(){
|
251
274
|
(4).should.eql(3);
|
@@ -392,6 +415,10 @@ module.exports = {
|
|
392
415
|
}, "expected { length: 12 } to have own property 'foo' | foo");
|
393
416
|
},
|
394
417
|
|
418
|
+
'test ownProperty(name).equal(val)': function() {
|
419
|
+
({length: 10}).should.have.ownProperty('length').equal(10);
|
420
|
+
},
|
421
|
+
|
395
422
|
'test include() with string': function(){
|
396
423
|
'foobar'.should.include('bar');
|
397
424
|
'foobar'.should.include('foo');
|
data/vendor/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{ "name": "stylus"
|
2
2
|
, "description": "Robust, expressive, and feature-rich CSS superset"
|
3
|
-
, "version": "0.
|
3
|
+
, "version": "0.32.0"
|
4
4
|
, "author": "TJ Holowaychuk <tj@vision-media.ca>"
|
5
5
|
, "keywords": ["css", "parser", "style", "stylesheets", "jade", "language"]
|
6
6
|
, "repository": "git://github.com/learnboost/stylus"
|