Open ragavendra opened 5 months ago
Answering my own question. I was getting the below error when running the tests.
No write concern mode named 'majority-test' found in replica set configuration
I was able to fix it by following this .
Looks like the .env.example needs the MONGODB_URL
to be updated like MONGODB_URL=mongodb+srv://mrrabbil:mernx123@cluster0.rtpbcy6.mongodb.net/app_todo?retryWrites=true
@ragavendra you included your username and password
I was able to fix it by following this .
Looks like the .env.example needs the
MONGODB_URL
to be updated like
the url in .env.example is referencing a local mongo server
the reason why you were getting that error is because in the config it appends -test
to the db name; your mongo uri has query options appended to the end; hence why it's saying majority-test
you do not want tests running on your db with live/real data, plus if you take a look at tests/utils/setupTestDB.js you'll see that before each test it purges all the collections.
also as mentioned above you are sharing your username and password in the connection string you pasted
First of all, thanks for this template or boilerplate, there is a lot of modules that I learnt about.
When I run
npm run test
a lot of tests are failing like below, although I am runningnpm run dev
in another instance.Correct me if I am wrong. I can see that this project is not actively maintained? The reason for this is that I am seeing some not supported modules like
xss-clean