Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Grunt and hood.ie test database

I'm currently running my test suite on AngularJS using Grunt, Karma, Jasmine and Protractor. The database library I'm using is hood.ie, which is a library on top of CouchDB. I start hood.ie using the following code in my Gruntfile:

hoodie: {
  start: {
    options: {
      callback: function(config) {
        grunt.config.set('connect.proxies.0.port', config.stack.couch.port);
      }
    }
  }
},

However, I would like to have a separate database for running tests, which automatically resets afterwards. This way, the production data won't conflict with the tests.

How should I approach this? I would assume there's some kind of standard way of doing this, as I can imagine other people have come across the same problem, but I'm unable to find anything on the internet.

like image 558
Jeroen Avatar asked Jun 02 '14 07:06

Jeroen


1 Answers

Currently, this seems to be impossible as the hoodie server does not support it. The best way to go about this is to modify it yourself at Hood.ie server Github repository by adding a parameter to define the folder in which the data will be stored, which is at the moment hardcoded to 'data' (https://github.com/hoodiehq/hoodie-server/blob/master/lib/core/environment.js#L48)

Something similar to this should work:

app_path: path.resolve(project_dir, argv.folder || 'data')
like image 107
Vliegenthart Avatar answered Nov 01 '22 06:11

Vliegenthart