Skip to content
This repository has been archived by the owner on Aug 30, 2021. It is now read-only.

Tests should be independent of server, should run with http.createServer #175

Closed
ilanbiala opened this issue Sep 9, 2014 · 4 comments
Closed

Comments

@ilanbiala
Copy link
Member

All the tests should ideally work with any server setup as long as Mongoose is connected, and it's quite a black box right now how the server is started and then mocha tests are run. It would be better to move tests toward a generic http.createServer system.

@ilanbiala
Copy link
Member Author

Or use connect, which also is much more barebones than Express. The main issue is that you can't just start the server and run the tests, because the tests won't exit until the server has quit, and that won't happen easily with the current setup...

@lirantal
Copy link
Member

@ilanbiala I understand the problem you're raising and its definitely something that needs resolving, but creating a server through http.createServer() isn't a solution because server.js does more than just start the server, it binds expressjs, loads all the models, controllers, routes, instantiates the configuration etc.

Do you have a suggestion how to actually do it better?

@ilanbiala
Copy link
Member Author

Well you don't need to load all the models for unit testing, all you need is the DB, passport, and the server.., right?

@lirantal
Copy link
Member

Look at the tests and let me know if you still think that its not required to load all models, routes, and controllers.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants