💾 Archived View for gmi.noulin.net › gitRepositories › git-off › file › src › node_modules › mkdirp … captured on 2023-07-10 at 17:53:36. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2023-01-29)

-=-=-=-=-=-=-

git-off

Log

Files

Refs

README

opts_fs.js (938B)

     1 var mkdirp = require('../');
     2 var path = require('path');
     3 var test = require('tap').test;
     4 var mockfs = require('mock-fs');
     5 var _0777 = parseInt('0777', 8);
     6 var _0755 = parseInt('0755', 8);
     7 
     8 test('opts.fs', function (t) {
     9     t.plan(5);
    10     
    11     var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
    12     var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
    13     var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
    14     
    15     var file = '/beep/boop/' + [x,y,z].join('/');
    16     var xfs = mockfs.fs();
    17     
    18     mkdirp(file, { fs: xfs, mode: _0755 }, function (err) {
    19         t.ifError(err);
    20         xfs.exists(file, function (ex) {
    21             t.ok(ex, 'created file');
    22             xfs.stat(file, function (err, stat) {
    23                 t.ifError(err);
    24                 t.equal(stat.mode & _0777, _0755);
    25                 t.ok(stat.isDirectory(), 'target not a directory');
    26             });
    27         });
    28     });
    29 });