root.js 496 B

12345678910111213141516171819
  1. var mkdirp = require('../');
  2. var path = require('path');
  3. var fs = require('fs');
  4. var test = require('tap').test;
  5. var _0755 = parseInt('0755', 8);
  6. test('root', function (t) {
  7. // '/' on unix, 'c:/' on windows.
  8. var file = path.resolve('/');
  9. mkdirp(file, _0755, function (err) {
  10. if (err) throw err
  11. fs.stat(file, function (er, stat) {
  12. if (er) throw er
  13. t.ok(stat.isDirectory(), 'target is a directory');
  14. t.end();
  15. })
  16. });
  17. });