Ryan Zimmerman ab92b24370
BREAKING: Use internal fork of make-dir for mkdirs implementation (#756)
* 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
2020-02-18 11:41:04 -05:00

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()
})
})
})
})