Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix deprecation warnings #122

Closed
wants to merge 4 commits into from
Closed

Fix deprecation warnings #122

wants to merge 4 commits into from

Conversation

hboylan
Copy link

@hboylan hboylan commented Nov 7, 2017

  • Use existing mongo.options for connections
  • Match _package.json packages as subset within package.json for thorough testing
  • Fix sinon.stub() reference
  • Fix babel-preset-env reference

@maustand
Copy link
Collaborator

maustand commented Nov 7, 2017

@hboylan I was trying to do as you say on test/setup.js but after i updated mockgoose, some of my tests that they were working perfect before the update, they dont work right now.

They show me this.

  ● Console

    console.error node_modules/jest-jasmine2/build/jasmine/Env.js:194
      Unhandled error
    console.error node_modules/jest-jasmine2/build/jasmine/Env.js:195
      undefined

  ● Reports › Namespace Should be defined.

    Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.
      
      at node_modules/jest-jasmine2/build/queue_runner.js:64:21
      at ontimeout (timers.js:386:11)
      at tryOnTimeout (timers.js:250:5)
      at Timer.listOnTimeout (timers.js:214:5)

Anyway it is broken the build.

Lets see what's happening..

@hboylan
Copy link
Author

hboylan commented Nov 7, 2017

Ah, dang. Thought it was just the linter complaining, but this one also fails.

I'm unable to run tests locally right now. My work machine is Winderps without Admin access so it can't do symlinking. 😢

@maustand
Copy link
Collaborator

maustand commented Nov 7, 2017

@hboylan Hi again.

Honestly i think that it would be great that you try to run the test in your local environment before to push.
Anyway i understand that you are not able to do it right now because your OS..

But you could try to push in chuncks.. for example, the commit that it fixes the warnings, i am sure that it would pass the tests..
Otherwise if you want to update the dependecies, i am not sure about it..

I have been trying to update mockgoose for a while and always it breaks my app.
I tried today at the office with my app that it is on production and still i have the problem..
When i updated the dependencies in project, i was able to update all the dependencies except :

  • babel-jest
  • jest-cli
  • mockgoose

See my PR

Anyway if you dont have time, i would do it for you if you want...

Otherwise this commit would have conflicts because you updated "supertest-as-promised" and @Lobosque has deleted this dependency because it is deprecated..

Regards and thank you so munch !! =)

@hboylan
Copy link
Author

hboylan commented Nov 7, 2017

@maustand You're right, I'll try to push these changes more incrementally from Mac later on.

@hboylan hboylan changed the title Update dependencies and fix deprecation warnings Fix deprecation warnings Nov 8, 2017
@coveralls
Copy link

coveralls commented Nov 8, 2017

Coverage Status

Coverage remained the same at 100.0% when pulling cd73749 on hboylan:master into f266fbd on diegohaz:master.

@hboylan
Copy link
Author

hboylan commented Nov 8, 2017

@maustand Currently passing locally, also able to run a fresh yo rest && yarn test 🤷‍♂️

  • os: Mac Sierra
  • node: 6.12.0
  • npm: 3.10.10

@maustand
Copy link
Collaborator

maustand commented Nov 8, 2017

@hboylan

Could you check here ? it seems there is a problem with a test.
probably it is not creating the view mapping or a error with mongodb


 PASS  src/api/all-master/model.test.js
 FAIL  src/api/no-method/model.test.js
  ● view › returns simple view
    MongoError: topology was destroyed
      
      at createIndex (node_modules/mongodb/lib/db.js:1069:76)
      at Db.Object.<anonymous>.Db.createIndex (node_modules/mongodb/lib/db.js:1047:44)
      at node_modules/mongodb/lib/db.js:1159:12
      at handleCallback (node_modules/mongodb/lib/utils.js:120:56)
      at node_modules/mongodb/lib/db.js:1584:5
      at handleCallback (node_modules/mongodb/lib/utils.js:120:56)
      at node_modules/mongodb/lib/cursor.js:861:16
      at handleCallback (node_modules/mongodb-core/lib/cursor.js:171:5)
      at setCursorDeadAndNotified (node_modules/mongodb-core/lib/cursor.js:505:3)
      at nextFunction (node_modules/mongodb-core/lib/cursor.js:658:7)
      at CommandCursor.Object.<anonymous>.Cursor.next [as _next] (node_modules/mongodb-core/lib/cursor.js:699:3)
      at fetchDocs (node_modules/mongodb/lib/cursor.js:857:10)
      at node_modules/mongodb/lib/cursor.js:880:7
      at handleCallback (node_modules/mongodb-core/lib/cursor.js:171:5)
      at nextFunction (node_modules/mongodb-core/lib/cursor.js:689:5)
      at node_modules/mongodb-core/lib/cursor.js:600:7
  ● view › returns simple view
    TypeError: Cannot read property 'view' of undefined

@hboylan
Copy link
Author

hboylan commented Nov 9, 2017

@maustand

I'm unable to reproduce this locally, but after researching a little it appears that there's an uncaught error being thrown when mongoose tries to create a document after the connection has closed.

The failed test also hints at beforeAll():

  9 passing (5m)
  1 failing
  1) generator-rest default install "before all" hook:
     Error: done() invoked with non-Error: 1
      at Process.ChildProcess._handle.onexit (internal/child_process.js:219:12)

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling f29e360 on hboylan:master into f266fbd on diegohaz:master.

2 similar comments
@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling f29e360 on hboylan:master into f266fbd on diegohaz:master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling f29e360 on hboylan:master into f266fbd on diegohaz:master.

@maustand
Copy link
Collaborator

maustand commented Nov 9, 2017

I am going to try reproduce the error again.
All the changes related to fix the problem with mockgoose and mongoose, they should be applied into test/setup.js ?

Lets see..

I will update another time the mockgoose dependecy and i will apply those changes and i will let you know !.

Thanks !

@maustand
Copy link
Collaborator

maustand commented Nov 9, 2017

@hboylan Hi man again !.

I have been doing my own test and sadly i have to tell you that it is broken.

Firstly i tried to update all my dependencies. changes on .babelrc and test/setup.js ect.. in my personal project as you did it in your PR.
Result ?

mongod.active_version is not a function

So i thought that probably there is a problem with my personal project and it is dirty but i downloaded your fork and after npm install, i ran the tests and whola !

`

FAIL src/api/all-user/index.test.js (153.317s)
● POST /all-users 201 (user)

TypeError: mongod.active_version is not a function
  
  at Object.<anonymous>.module.exports (node_modules/mockgoose/Mockgoose.js:37:29)
  at _callee$ (test/setup.js:26:37)
  at tryCatch (node_modules/regenerator-runtime/runtime.js:65:40)
  at GeneratorFunctionPrototype.invoke [as _invoke] (node_modules/regenerator-runtime/runtime.js:299:22)
  at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (node_modules/regenerator-runtime/runtime.js:117:21)
  at step (node_modules/babel-runtime/helpers/asyncToGenerator.js:17:30)
  at node_modules/babel-runtime/helpers/asyncToGenerator.js:35:14
  at Promise.F (node_modules/core-js/library/modules/_export.js:35:28)
  at Object.<anonymous> (node_modules/babel-runtime/helpers/asyncToGenerator.js:14:12)
  at process._tickCallback (internal/process/next_tick.js:109:7)

● POST /all-users 201 (user)

Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.
  
  at ../../home/mauricio/Desktop/rest-master/node_modules/jest-jasmine2/build/queue_runner.js:64:21
  at ontimeout (timers.js:386:11)
  at tryOnTimeout (timers.js:250:5)
  at Timer.listOnTimeout (timers.js:214:5)

● POST /all-users 201 (user)

expect(received).toBe(expected)

Expected value to be (using ===):
  201
Received:
  401
  
  at _callee2$ (src/api/all-user/index.test.js:24:26)
  at tryCatch (node_modules/regenerator-runtime/runtime.js:65:40)
  at GeneratorFunctionPrototype.invoke [as _invoke] (node_modules/regenerator-runtime/runtime.js:299:22)
  at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (node_modules/regenerator-runtime/runtime.js:117:21)
  at step (node_modules/babel-runtime/helpers/asyncToGenerator.js:17:30)
  at node_modules/babel-runtime/helpers/asyncToGenerator.js:28:13
  at process._tickCallback (internal/process/next_tick.js:109:7)

● POST /all-users 401

TypeError: mongod.active_version is not a function
  
  at Object.<anonymous>.module.exports (node_modules/mockgoose/Mockgoose.js:37:29)
  at _callee$ (test/setup.js:26:37)
  at tryCatch (node_modules/regenerator-runtime/runtime.js:65:40)
  at GeneratorFunctionPrototype.invoke [as _invoke] (node_modules/regenerator-runtime/runtime.js:299:22)
  at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (node_modules/regenerator-runtime/runtime.js:117:21)
  at step (node_modules/babel-runtime/helpers/asyncToGenerator.js:17:30)
  at node_modules/babel-runtime/helpers/asyncToGenerator.js:35:14
  at Promise.F (node_modules/core-js/library/modules/_export.js:35:28)
  at Object.<anonymous> (node_modules/babel-runtime/helpers/asyncToGenerator.js:14:12)
  at process._tickCallback (internal/process/next_tick.js:109:7)

● POST /all-users 401

Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.
  
  at ../../home/mauricio/Desktop/rest-master/node_modules/jest-jasmine2/build/queue_runner.js:64:21
  at ontimeout (timers.js:386:11)
  at tryOnTimeout (timers.js:250:5)
  at Timer.listOnTimeout (timers.js:214:5)

● GET /all-users 200 (user)

TypeError: mongod.active_version is not a function
  
  at Object.<anonymous>.module.exports (node_modules/mockgoose/Mockgoose.js:37:29)
  at _callee$ (test/setup.js:26:37)
  at tryCatch (node_modules/regenerator-runtime/runtime.js:65:40)
  at GeneratorFunctionPrototype.invoke [as _invoke] (node_modules/regenerator-runtime/runtime.js:299:22)
  at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (node_modules/regenerator-runtime/runtime.js:117:21)
  at step (node_modules/babel-runtime/helpers/asyncToGenerator.js:17:30)
  at node_modules/babel-runtime/helpers/asyncToGenerator.js:35:14
  at Promise.F (node_modules/core-js/library/modules/_export.js:35:28)
  at Object.<anonymous> (node_modules/babel-runtime/helpers/asyncToGenerator.js:14:12)
  at process._tickCallback (internal/process/next_tick.js:109:7)

Same problem...

Anyway it is very weird about the last commit has fixed the building and it is not broken anymore.

In other hand i think that it would be great to split your changes in chunks (PR;s) because this problem with mockgoose, it is making a lots of troubles. Probably your improvements and package.json update would work perfect.
Thank you so munch !

Regards

@diegohaz
Copy link
Owner

diegohaz commented Nov 9, 2017

Maybe something related to #106 (comment)?

@hboylan
Copy link
Author

hboylan commented Nov 9, 2017

I haven't seen that specific error, but believe that all of the issues stem from Mockgoose. Was seeing the topology error pop up randomly while developing my rest app. Looks like reverting to [email protected] gets rid of it. I'll try it here later.

@hboylan
Copy link
Author

hboylan commented Nov 9, 2017

Just kidding ^^

"MongoError: topology was destroyed" still outputs randomly. Looks like a synchronization issue somewhere. Can't seem to actually catch the error in setup.js so it must get thrown in some test(s).

@hboylan hboylan closed this Nov 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants