mirror of
https://github.com/jprichardson/node-fs-extra.git
synced 2026-01-18 16:13:55 +00:00
* BREAKING: Use internal fork of make-dir for mkdirs implementation Resolves #619 Everything should work similarly to how it did before; except that we no longer return a file path on success (to match fs.mkdir). Also, errors may be different. * Hopefully fix Windows tests - Error codes are different - Match fs.mkdir behavior on Windows when creating root * Port https://github.com/sindresorhus/make-dir/pull/24 * Add comment for clarity * Use at-least-node for version sniffing * Consistent error codes across OSes * Allow different error codes on different Node versions
28 lines
639 B
JavaScript
28 lines
639 B
JavaScript
'use strict'
|
|
|
|
const fs = require('fs')
|
|
const fse = require('../../')
|
|
const path = require('path')
|
|
const assert = require('assert')
|
|
|
|
/* global describe, it */
|
|
|
|
describe('mkdirp / root', () => {
|
|
// '/' on unix
|
|
const dir = path.normalize(path.resolve(path.sep)).toLowerCase()
|
|
|
|
// Windows does not have permission to mkdir on root
|
|
if (process.platform === 'win32') return
|
|
|
|
it('should', done => {
|
|
fse.mkdirp(dir, 0o755, err => {
|
|
if (err) return done(err)
|
|
fs.stat(dir, (er, stat) => {
|
|
if (er) return done(er)
|
|
assert.ok(stat.isDirectory(), 'target is a directory')
|
|
done()
|
|
})
|
|
})
|
|
})
|
|
})
|