How to globally add CORS to couchdb for testing

By default, CORS is not enabled in couchdb which makes it difficult to setup couchdb related tests in remote testing environments like Travis CI. Is there an easy way to enable CORS before each test?

There is a great npm package called add-cors-to-couchdb that can be used with any node project.

Moreover, if you are using grunt, you can also use grunt-execute to add CORS support to your test task. For example, factoryng uses both add-cors-to-couchdb and grunt-execute.