Fabianopb/create-mern-ts-app

Prevent `MongoNetworkError` in the CI

Closed this issue · 1 comments

After installing backend dependencies yarn will run postinstall, which runs yarn build and a node script to populate the database with sample data (in case it's empty).

The problem is that in Travis there's no Mongo connection, making the following error appear:

MongoNetworkError: failed to connect to server [localhost:27017] on first connect [MongoNetworkError: connect ECONNREFUSED 127.0.0.1:27017]

This is a passable error and doesn't prevent Travis from running the tests, however it would be nice to avoid that, for example, by preventing running the script to populate the database when in test environment.

I'm having a look at this