chai-sync-layer-suite
Advanced tools
Comparing version 0.2.0 to 0.3.0
{ | ||
"name": "chai-sync-layer-suite", | ||
"description": "Chai suite for sync-layer library", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"repository": { | ||
@@ -11,3 +11,5 @@ "type": "git", | ||
"license": "MIT", | ||
"dependencies": {}, | ||
"dependencies": { | ||
"rewire-test-helpers": "^1.0.0-rc1" | ||
}, | ||
"devDependencies": { | ||
@@ -18,3 +20,2 @@ "chai": "^1.10.0", | ||
"rewire": "^2.1.3", | ||
"rewire-test-helpers": "^0.1.0", | ||
"sinon": "^1.12.1", | ||
@@ -21,0 +22,0 @@ "sinon-chai": "^2.6.0" |
@@ -103,9 +103,3 @@ var describeSync = rewire('../describe_sync'); | ||
}); | ||
it('throw descriptive error if sync is required without rewire', function() { | ||
expect(function() { | ||
describeSync('obj', {}) | ||
}).to.throw("Module must be required via rewire (e.g `var answer = require('get-answer');`)") | ||
}); | ||
}); | ||
@@ -0,1 +1,3 @@ | ||
var RewireTestHelpers = require('rewire-test-helpers') | ||
var _global; | ||
@@ -21,6 +23,2 @@ if (typeof global != 'undefined') { | ||
var describeSync = function(subjectName, subject, bodyFn) { | ||
if (!subject.__set__) { | ||
throw "Module must be required via rewire (e.g `var answer = require('get-answer');`)" | ||
} | ||
describe(subjectName, function() { | ||
@@ -38,4 +36,4 @@ beforeEach(function() { | ||
}; | ||
this.__originalRequests = subject.__get__('requests') | ||
subject.__set__('requests', requests); | ||
this.__restoreRequests = | ||
RewireTestHelpers.injectDependencies(subject, {requests: requests}) | ||
@@ -68,4 +66,4 @@ this.__syncRestoreFns = Object.keys(subject).reduce(function(acc, key) { | ||
if (this.__originalRequests) { | ||
subject.__set__('requests', this.__originalRequests); | ||
if (typeof this.__restoreRequests === 'function') { | ||
this.__restoreRequests() | ||
} | ||
@@ -81,2 +79,1 @@ }); | ||
module.exports = describeSync; | ||
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
12690
6
12
1
109
1
296
+ Addedrewire-test-helpers@1.0.0-rc2(transitive)