Skip to content
Newer
Older
100644 55 lines (36 sloc) 1.41 KB
b76f80e @BryanDonovan updated README
authored Dec 19, 2011
1 Node.js Mocking with Mockery
2 ============================
3
4 ## Installation
5
6 ```
7 npm install .
8 ```
9
10 ## Running tests
11
12
13 This passes:
14
15 ```
16 make test_with_mock
17 ```
18
19 And this passes:
20
21 ```
22 make test_no_mock
23 ```
24
25 But this fails, which runs both of the above:
26
27 ```
28 make test
29 ```
e361d2e @BryanDonovan better readme example
authored Dec 19, 2011
30
31 no mock
32 (ok) returns real response
33
34 with mock
35 0) returns mocked response
36
37
38 1 of 2 tests failed:
39
40 0) with mock returns mocked response:
41
42 AssertionError: "mocked widget" == "real widget"
43 at Test.fn (/Users/bryan/code/nodejs-mock-test/test/with_mock.unit.js:27:16)
44 at Test.run (/Users/bryan/code/nodejs-mock-test/node_modules/mocha/lib/runnable.js:138:12)
45 at Runner.runTest (/Users/bryan/code/nodejs-mock-test/node_modules/mocha/lib/runner.js:270:10)
46 at /Users/bryan/code/nodejs-mock-test/node_modules/mocha/lib/runner.js:310:12
47 at next (/Users/bryan/code/nodejs-mock-test/node_modules/mocha/lib/runner.js:198:14)
48 at /Users/bryan/code/nodejs-mock-test/node_modules/mocha/lib/runner.js:207:7
49 at next (/Users/bryan/code/nodejs-mock-test/node_modules/mocha/lib/runner.js:157:23)
50 at Array.<anonymous> (/Users/bryan/code/nodejs-mock-test/node_modules/mocha/lib/runner.js:175:5)
51 at EventEmitter._tickCallback (node.js:126:26)
52
53
54 As you can see, the mock is not recognized in the mock test, since the real module has already been loaded and cached in the require.cache.
Something went wrong with that request. Please try again.