Clean up databases created by tests once tests are done
I ran tests using npm test and look what I have. Now I got to clean them up manually :cry:

Hum so a long time ago rethinkdb didn't like to have too many databases/tables - even removed. I think 2.1 fixed that but I haven't tried it.
That being said, the assumption is basically to just kill/delete the data directory/restart rethinkdb when developing on rethinkdbdash.
At least with 2.1, deleting is fine. After running tests a few times, I had 100+ databases left over for cleanup which I could remove using a simple query. I think all the tests should be updated to automate cleanup once the tests have run.
IMO, it's sort of unfair to assume that I would delete my rethinkdb data directory just because I ran the tests. I wouldn't want to lose out on my development dbs of another project. And this assumption inherits the assumption that I am working on a single project at any given point of time which may not be the case.
@kulbirsaini I absolutely agree with you, but I think there is just a different expectation from the maintainer's perspective. If you take a look over here you can pull out the concept of the TestFixture for the thinky tests and easily rework the tests such that tables and databases are cleaned up properly after test runs.
@mbroadst I could but if that's not going to be merged I don't think I would.
I use my own package Jamadar to cleanup databases. It's fairly straight forward.
var Jamadar = require('jamadar');
var db = new Jamadar(servers: [
{ host: 'localhost', port: 28015 }
]);
db.getDbList()
.then(function(results) {
// All db names created by rethinkdbdash are of 32 characters.
var filtered = results.filter(function(result) {
return result.length === 32;
});
console.log(filtered.length, 'databases to be dropped');
return db.dropDbsIfExist(filtered);
})
.then(function() {
console.log('done');
});
I'm fine with a PR that clean the databases after the test. Not a PR that create one database and one table per test.