1 | var chai = require('chai');
|
2 | chai.use(require('sinon-chai'));
|
3 |
|
4 | global.expect = chai.expect;
|
5 | global.stub = require('sinon').stub;
|
6 | global.spy = require('sinon').spy;
|
7 | global.fsStub = require('mock-fs');
|
8 | global.fs = require('fs');
|
9 | global.proxyquire = require('proxyquire');
|
10 |
|
11 | global.fileContent = function (file) {
|
12 | return fs.readFileSync(file, 'UTF-8');
|
13 | };
|
14 |
|
15 | global.fileMode = function (file) {
|
16 | return (fs.statSync(file).mode & 07777).toString(8);
|
17 | };
|
18 |
|
19 | global.setupPackageJsonWith = function (content) { return function () {
|
20 | fsStub({ 'package.json': JSON.stringify(content) });
|
21 | };};
|
22 |
|
23 | module.exports = function () {
|
24 | afterEach(fsStub.restore);
|
25 | };
|