Skip to content

Commit e14efc3

Browse files
committed
Always delete result files after tests
Use rimraf for recursive delete
1 parent 99dbe22 commit e14efc3

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
"expect.js": "0.3.1",
2525
"mocha": "2.4.5",
2626
"mocks": "0.0.15",
27-
"proxy": "^0.2.4"
27+
"proxy": "^0.2.4",
28+
"rimraf": "^2.5.4"
2829
},
2930
"bugs": "https://github.com/browserstack/browserstack-local-nodejs/issues",
3031
"homepage": "https://github.com/browserstack/browserstack-local-nodejs",

test/local.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ var expect = require('expect.js'),
22
mocks = require('mocks'),
33
path = require('path'),
44
fs = require('fs'),
5+
rimraf = require('rimraf'),
56
Proxy = require('proxy'),
67
browserstack = require('../index'),
78
LocalBinary = require('../lib/LocalBinary');
@@ -181,15 +182,14 @@ describe('LocalBinary', function () {
181182
});
182183

183184
afterEach(function () {
184-
fs.rmdirSync(tempDownloadPath);
185+
rimraf.sync(tempDownloadPath);
185186
});
186187

187188
it('should download binaries without proxy', function (done) {
188189
this.timeout(600000);
189190
var conf = {};
190191
binary.download(conf, tempDownloadPath, function (result) {
191192
expect(fs.existsSync(result)).to.equal(true);
192-
fs.unlinkSync(result);
193193
done();
194194
});
195195
});
@@ -203,7 +203,6 @@ describe('LocalBinary', function () {
203203
binary.download(conf, tempDownloadPath, function (result) {
204204
// test for file existence
205205
expect(fs.existsSync(result)).to.equal(true);
206-
fs.unlinkSync(result);
207206
done();
208207
});
209208
});

0 commit comments

Comments
 (0)