Example of a good bug report for NeDB

September 18, 2015 ยท View on GitHub

// Put all your require statements at the top. Your gist should contain a package.json which lets me download all // the dependencies needed to test your bug report with a simple 'npm install' var async = require('async') , someOtherModule = require('xxx') , fs = require('fs');

// Then require nedb and chai. You need to use chai for your assertions var Nedb = require('nedb') , chai = require('chai') , assert = chai.assert; // Chai supports assert and should style of assertion chai.should(); // Check out the doc, use is straightforward http://chaijs.com/

// If your test includes persistence, make sure to put file name in a variable and erase its contents to avoid hysteresis var filename = 'bugreport.db'; fs.writeFileSync(filename, '', 'utf8');

// Then write actual test code, with assertions to show the expected behavior var db = new Nedb({ autoload: true, filename: filename }); db.insert({ some: 'document' }); db.find({}, function (err, res) { res.length.should.equal(1); // Assertion should of course throw if there is a problem });