some test fixes

changed package.json to use `jest-cli` and not `jest`
added jest-related configs in `package.json` that will circumvent the "function" error you were seeing, but will yield a different error.
added a test that allows you to completely mock the `body-parser` module.
I should have included more notes to make it clearer, but, the "jest"
config block in your package.json tells your testing suite to never mock
specific modules. After looking over the body-parser module I saw there was
some weird stuff going on with other modules (hence the other errors that
crop up in your existing rest). Thus I simply just invented my own mock in
my test and used jest.setMock() to implement it.

As for why I didn't use jest.dontMock("body-parser"), it's identical to the
implementation of using the "jest" config block in package.json. you run
into other errors (the cannot call forEach of undefined). I believe it's
because "fs" is a module that isn't being mocked. There is an open issue on
jest concerning mocking native node modules. You can try a
jest.dontMock("fs") at the top to confirm. Hope that helps.

---
Sent from my mobile device. Please excuse typos and abbreviations.
On Dec 16, 2014 5:26 PM, "Ben Fletcher" <notifications@github.com> wrote:

> In package.json
> <https://github.com/bjfletcher/jest-issue/pull/1#discussion-diff-21937705>
> :
>
> > @@ -12,6 +12,9 @@
> >      "body-parser": "^1.10.0"
> >    },
> >    "devDependencies": {
> > -    "jest": "^0.1.37"
> > +    "jest-cli": "^0.2.1"
> > +  },
> > +  "jest": {
> > +    "unmockedModulePathPatterns": ["node_modules/body-parser"]
>
> Out of interest, why'd we need to do this rather than jest.donMock?
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/bjfletcher/jest-issue/pull/1/files#r21937705>.
>