1 var mkdirp = require('../');
2 var path = require('path');
3 var fs = require('fs');
4 var exists = fs.exists || path.exists;
5 var test = require('tap').test;
7 test('sync perm', function (t) {
9 var file = '/tmp/' + (Math.random() * (1<<30)).toString(16) + '.json';
11 mkdirp.sync(file, 0755);
12 exists(file, function (ex) {
13 t.ok(ex, 'file created');
14 fs.stat(file, function (err, stat) {
16 t.equal(stat.mode & 0777, 0755);
17 t.ok(stat.isDirectory(), 'target not a directory');
22 test('sync root perm', function (t) {
26 mkdirp.sync(file, 0755);
27 exists(file, function (ex) {
28 t.ok(ex, 'file created');
29 fs.stat(file, function (err, stat) {
31 t.ok(stat.isDirectory(), 'target not a directory');