appium-support
Advanced tools
Comparing version 1.1.0 to 1.1.1
@@ -5,5 +5,5 @@ "use strict"; | ||
mocha = require('gulp-mocha'), | ||
Q = require('q'), | ||
B = require('bluebird'), | ||
spawnWatcher = require('appium-gulp-plugins').spawnWatcher.use(gulp), | ||
runSequence = Q.denodeify(require('run-sequence')), | ||
runSequence = B.promisify(require('run-sequence')), | ||
jshint = require('gulp-jshint'), | ||
@@ -10,0 +10,0 @@ jscs = require('gulp-jscs'); |
@@ -51,2 +51,14 @@ "use strict"; | ||
exports.mkdirp = function (dirName) { | ||
return new B(function (resolve, reject) { | ||
fs.mkdir(dirName, function (err) { | ||
if (err && err.code !== "EEXIST") { | ||
reject(err); | ||
} else { | ||
resolve(); | ||
} | ||
}); | ||
}); | ||
}; | ||
exports.nodeifyModule = function (obj) { | ||
@@ -53,0 +65,0 @@ if (typeof obj !== "function") { |
@@ -7,5 +7,5 @@ { | ||
], | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"author": "appium", | ||
"license": "Apache License 2.0", | ||
"license": "Apache-2.0", | ||
"repository": { | ||
@@ -44,4 +44,5 @@ "type": "git", | ||
"mocha": "^2.1.0", | ||
"rimraf": "^2.4.0", | ||
"run-sequence": "^1.0.2" | ||
} | ||
} |
"use strict"; | ||
var util = require('..').util | ||
, rimraf = require('rimraf') | ||
, path = require('path') | ||
, chaiAsPromised = require('chai-as-promised') | ||
, chai = require('chai'); | ||
chai.use(chaiAsPromised); | ||
var should = chai.should(); | ||
@@ -94,2 +98,29 @@ | ||
}); | ||
describe("mkdirp", function () { | ||
var dirName = path.resolve(__dirname, "tmp"); | ||
it("should make a directory that doesn't exist", function (done) { | ||
rimraf(dirName, function (err) { | ||
if (err) return done(err); | ||
util.mkdirp(dirName).then(function () { | ||
util.fileExists(dirName).then(function (exists) { | ||
exists.should.be.true; | ||
done(); | ||
}).catch(done); | ||
}).catch(done); | ||
}); | ||
}); | ||
it("should not complain if the dir already exists", function (done) { | ||
util.fileExists(dirName).then(function (exists) { | ||
exists.should.be.true; | ||
util.mkdirp(dirName).then(done).catch(done); | ||
}).catch(done); | ||
}); | ||
it("should still throw an error if something else goes wrong", function (done) { | ||
util.mkdirp("/bin/foo").should.eventually.be.rejectedWith('EACCES') | ||
.then(done).catch(done); | ||
}); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
67217
24
381
11