From ca15bf23688b4e8b9fb81bf76c8a708c1e19bd1c Mon Sep 17 00:00:00 2001 From: JP Richardson Date: Sun, 12 Apr 2015 23:04:57 -0500 Subject: [PATCH] removed more testutil --- test/mkdirp/clobber.test.js | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/test/mkdirp/clobber.test.js b/test/mkdirp/clobber.test.js index 537b5ce..2ab35f9 100644 --- a/test/mkdirp/clobber.test.js +++ b/test/mkdirp/clobber.test.js @@ -1,35 +1,41 @@ var assert = require('assert') var fs = require('fs') var path = require('path') +var os = require('os') var fse = require(process.cwd()) -var testutil = require('testutil') /* global before, describe, it */ var o755 = parseInt('755', 8) describe('mkdirp / clobber', function () { + var TEST_DIR var ps, file, itw before(function (done) { - ps = ['', testutil.createTestDir('fs-extra')] + TEST_DIR = path.join(os.tmpdir(), 'fs-extra', 'mkdirp-clobber') + fse.emptyDir(TEST_DIR, function (err) { + assert.ifError(err) - for (var i = 0; i < 25; i++) { - var dir = Math.floor(Math.random() * Math.pow(16, 4)).toString(16) - ps.push(dir) - } + ps = ['', TEST_DIR] - file = ps.join(path.sep) + for (var i = 0; i < 15; i++) { + var dir = Math.floor(Math.random() * Math.pow(16, 4)).toString(16) + ps.push(dir) + } - // a file in the way - itw = ps.slice(0, 3).join(path.sep) + file = ps.join(path.sep) - fs.writeFileSync(itw, 'I AM IN THE WAY, THE TRUTH, AND THE LIGHT.') + // a file in the way + itw = ps.slice(0, 3).join(path.sep) - fs.stat(itw, function (er, stat) { - assert.ifError(er) - assert.ok(stat && stat.isFile(), 'should be file') - done() + fs.writeFileSync(itw, 'I AM IN THE WAY, THE TRUTH, AND THE LIGHT.') + + fs.stat(itw, function (er, stat) { + assert.ifError(er) + assert.ok(stat && stat.isFile(), 'should be file') + done() + }) }) })