root.js 462 B

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