root.js 556 B

12345678910111213141516171819202122
  1. /* Tests borrowed from substack's node-mkdirp
  2. * https://github.com/substack/node-mkdirp */
  3. var mkpath = require('../');
  4. var path = require('path');
  5. var fs = require('fs');
  6. var test = require('tap').test;
  7. test('root', function (t) {
  8. // '/' on unix, 'c:/' on windows.
  9. var file = path.resolve('/');
  10. mkpath(file, 0755, function (err) {
  11. if (err) throw err
  12. fs.stat(file, function (er, stat) {
  13. if (er) throw er
  14. t.ok(stat.isDirectory(), 'target is a directory');
  15. t.end();
  16. })
  17. });
  18. });