概要
Mockgooseを利用しようとしてGithubからcloneし、テスト実行したもののエラーが発生した。
$ npm test
> mockgoose@7.3.3 test /your-project-path/Mockgoose
> mocha
User functions
1) "before all" hook
0 passing (2m)
1 failing
1) User functions "before all" hook:
Error: timeout of 120000ms exceeded. Ensure the done() callback is being called in this test.
npm ERR! Test failed. See above for more details.
前提
- 環境は、https://github.com/Mockgoose/Mockgoose#setup 参照
- npm:v7.10.0
- OS:OSX10.10.5
- クローンしたプロジェクトのMockgoose/test/index.js を対象(15.jsとかは15.js_に変更)
原因調査
これという原因はわからない。状況としては、ネットワーク関係が怪しい。
仕事場では失敗するが、自宅では成功した。
自宅では以下の様にnpm test
を実行すると、Cmpleted: 7.7 % (6mb / 77.3mbmb
というコンソールが出力されるが、仕事場ではこの処理自体発生しなかった。
$ npm test
> mockgoose@7.3.3 test /your-project-path/Mockgoose
> mocha
bug 15
Cmpleted: 7.7 % (6mb / 77.3mbmb
成功時の実行結果(test/index.js)
$ npm test
(node:67560) DeprecationWarning: `open()` is deprecated in mongoose >= 4.11.0, use `openUri()` instead, or set the `useMong
oClient` option if using `connect()` or `createConnection()`. See http://mongoosejs.com/docs/connections.html#use-mongo-cli
ent
✓ isMocked
✓ should create a cat foo (42ms)
✓ should find cat foo
✓ should remove cat foo
(node:67560) DeprecationWarning: Mongoose: mpromise (mongoose's default promise library) is deprecated, plug in your own pr
omise library instead: http://mongoosejs.com/docs/promises.html
✓ reset
5 passing (1s)