| 1 |
'use strict' |
| 2 |
|
| 3 |
const fs = require('fs') |
| 4 |
const os = require('os') |
| 5 |
const fse = require(process.cwd()) |
| 6 |
const path = require('path') |
| 7 |
const assert = require('assert') |
| 8 |
|
| 9 |
/* global beforeEach, describe, it */ |
| 10 |
|
| 11 |
describe('mkdirs / opts-undef', () => { |
| 12 |
let TEST_DIR |
| 13 |
|
| 14 |
beforeEach(done => { |
| 15 |
TEST_DIR = path.join(os.tmpdir(), 'fs-extra', 'mkdirs') |
| 16 |
fse.emptyDir(TEST_DIR, done) |
| 17 |
}) |
| 18 |
|
| 19 |
// https://github.com/substack/node-mkdirp/issues/45 |
| 20 |
it('should not hang', done => { |
| 21 |
const newDir = path.join(TEST_DIR, 'doest', 'not', 'exist') |
| 22 |
assert(!fs.existsSync(newDir)) |
| 23 |
|
| 24 |
fse.mkdirs(newDir, undefined, err => { |
| 25 |
assert.ifError(err) |
| 26 |
assert(fs.existsSync(newDir)) |
| 27 |
done() |
| 28 |
}) |
| 29 |
}) |
| 30 |
}) |