From 42d5bb7b0215db9a3b884b4d8f61accd4a0fab4c Mon Sep 17 00:00:00 2001 From: Kimmo Brunfeldt Date: Tue, 9 Dec 2014 00:03:05 +0200 Subject: [PATCH] Support browserify --- index.js | 4 +--- test/stats.js | 9 ++++++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/index.js b/index.js index fc86e40..61a8b27 100644 --- a/index.js +++ b/index.js @@ -1,3 +1 @@ -module.exports = (process && process.env && process.env.CHAI_STATS_COV) - ? require('./lib-cov/stats') - : require('./lib/stats'); +module.exports = require('./lib/stats'); diff --git a/test/stats.js b/test/stats.js index 5890d3c..54897de 100644 --- a/test/stats.js +++ b/test/stats.js @@ -1,7 +1,10 @@ var tmp; if (!chai) { - var chai = require('chai') - , stats = require('..'); + var chai = require('chai'); + var stats = (process && process.env && process.env.CHAI_STATS_COV) + ? require('../lib-cov/stats') + : require('../lib/stats'); + chai.use(stats); tmp = stats; } @@ -62,7 +65,7 @@ describe('Chai Stats', function () { }).should.throw(chai.AssertionError, "expected { pi: 3.1416 } to equal { pi: 3.14159 } up to 7 decimal places"); }); - + it('should round to nearest number if explicitely given 0 precision', function() { ({ pi: 3.1416 }).should.almost.eql({ pi: 3 }, 0); assert.deepAlmostEqual({pi: 3.1416}, {pi: 3}, 0);