Skip to content
Browse files

Added mkdir()

  • Loading branch information...
1 parent f7b5257 commit 5508e8c1efdf4fe5f2b5f13822d3c7dfd02476a9 @jprichardson committed May 31, 2012
Showing with 53 additions and 0 deletions.
  1. +10 −0 lib/mkdir.js
  2. +4 −0 src/mkdir.coffee
  3. +39 −0 test/mkdir.test.coffee
View
10 lib/mkdir.js
@@ -0,0 +1,10 @@
+(function() {
+ var mkdirp;
+
+ mkdirp = require('mkdirp');
+
+ module.exports.mkdir = mkdirp;
+
+ module.exports.mkdirSync = mkdirp.sync;
+
+}).call(this);
View
4 src/mkdir.coffee
@@ -0,0 +1,4 @@
+mkdirp = require('mkdirp')
+
+module.exports.mkdir = mkdirp
+module.exports.mkdirSync = mkdirp.sync
View
39 test/mkdir.test.coffee
@@ -0,0 +1,39 @@
+fs = require('../lib')
+path = require('path-extra')
+testutil = require('testutil')
+
+describe 'fs-extra', ->
+ describe '+ mkdir()', ->
+ it 'should make the directory', (done) ->
+ dir = path.join(path.tempdir(), 'tmp-' + Date.now() + Math.random())
+ F fs.existsSync dir
+ fs.mkdir dir, (err) ->
+ T err is null
+ T fs.existsSync dir
+ done()
+
+ it 'should make the entire directory path', (done) ->
+ dir = path.join(path.tempdir(), 'tmp-' + Date.now() + Math.random())
+ newDir = path.join(dir, 'dfdf', 'ffff', 'aaa')
+ F fs.existsSync dir
+ fs.mkdir dir, (err) ->
+ T err is null
+ T fs.existsSync dir
+ done()
+
+ describe '+ mkdirSync()', ->
+ it 'should make the directory', (done) ->
+ dir = path.join(path.tempdir(), 'tmp-' + Date.now() + Math.random())
+ F fs.existsSync dir
+ fs.mkdirSync dir
+ T fs.existsSync dir
+ done()
+
+ it 'should make the entire directory path', (done) ->
+ dir = path.join(path.tempdir(), 'tmp-' + Date.now() + Math.random())
+ newDir = path.join(dir, 'dfdf', 'ffff', 'aaa')
+ F fs.existsSync dir
+ fs.mkdir dir, (err) ->
+ T err is null
+ T fs.existsSync dir
+ done()

0 comments on commit 5508e8c

Please sign in to comment.
Something went wrong with that request. Please try again.