UNPKG

826 BJavaScriptView Raw
1module.exports = function(root) {
2 root = root ? root : global;
3 root.expect = root.chai.expect;
4
5 beforeEach(function() {
6 // Using these globally-available Sinon features is preferrable, as they're
7 // automatically restored for you in the subsequent `afterEach`
8 root.sandbox = root.sinon.sandbox.create();
9 root.stub = root.sandbox.stub.bind(root.sandbox);
10 root.spy = root.sandbox.spy.bind(root.sandbox);
11 root.mock = root.sandbox.mock.bind(root.sandbox);
12 root.useFakeTimers = root.sandbox.useFakeTimers.bind(root.sandbox);
13 root.useFakeXMLHttpRequest = root.sandbox.useFakeXMLHttpRequest.bind(root.sandbox);
14 root.useFakeServer = root.sandbox.useFakeServer.bind(root.sandbox);
15 });
16
17 afterEach(function() {
18 delete root.stub;
19 delete root.spy;
20 root.sandbox.restore();
21 });
22};