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

tests passing without entering data #9

Open
vital-tech-results opened this issue Jun 25, 2019 · 8 comments
Open

tests passing without entering data #9

vital-tech-results opened this issue Jun 25, 2019 · 8 comments

Comments

@vital-tech-results
Copy link

vital-tech-results commented Jun 25, 2019

hey there! I'm having issues with getting tests to pass with the models exercises.

Steps taken

click to see my steps
  1. git clone url
  2. npm install
  3. navigate to the exercises/models directory and run this
  4. npm test exercises/models/__test__/
  5. tests pass even though I did not enter code for tests

on the connect.js file I entered this


const mongoose = require('mongoose')
mongoose.Promise = global.Promise

const connect = () => {
    return mongoose.connect('mongodb://localhost:27017/usersDatabase')
}
module.exports = connect

@zerogravit1
Copy link

If you use yarn test, instead of npm, the tests run as expected.

@vital-tech-results
Copy link
Author

If you use yarn test, instead of npm, the tests run as expected.

does this mean I'd have to do yarn install (instead of npm install)? And use yarn throughout the project? Or only use yarn to run the tests?

@zerogravit1
Copy link

I'm just getting my feet wet with yarn and did npm install (mostly out of habit). I would assume that yarn would still install the same packages and package dependencies. So for this I'm just using yarn to run the tests.

@kimdhoe
Copy link

kimdhoe commented Oct 7, 2019

I met similar problems running tests for exercise. Some tests passed even before I write a code with an error message "server instance pool was destroyed". I modified afterEach call in testconfig.js as below and now it works fine.

afterEach(async done => {
  await mongoose.disconnect()
  return done()
}

@Ashish0077
Copy link

NPM is for sure conflicting with something
when i used YARN everything worked flawlessly

to avoid unexpected behaviour use YARN

@matacabras
Copy link

Thanks @kimdho, your solution worked for me using NPM

@kimdho
Copy link

kimdho commented Apr 16, 2020 via email

@kimdhoe
Copy link

kimdhoe commented Apr 19, 2020

@matacabras @kimdho 🤣

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

No branches or pull requests

6 participants