mkdir.js 667 B

1234567891011121314151617181920212223242526
  1. var testCase = require('nodeunit').testCase;
  2. var fs = require('fs');
  3. var wrench = require('../lib/wrench');
  4. var path = require('path');
  5. module.exports = testCase({
  6. test_mkdirSyncRecursive: function(test) {
  7. var dir = __dirname + '/_tmp/foo/bar';
  8. test.equals(path.existsSync(dir), false, 'Dir shouldn\'t exist - clean it up manually?');
  9. wrench.mkdirSyncRecursive(dir, 0777);
  10. test.equals(path.existsSync(dir), true, 'Dir should exist now');
  11. // clean up
  12. while (dir != __dirname) {
  13. fs.rmdirSync(dir);
  14. dir = path.dirname(dir);
  15. }
  16. test.done();
  17. },
  18. });
  19. // vim: et ts=4 sw=4