Clean up tmp directory contents automatically

This commit is contained in:
Adam Wathan 2019-03-05 07:49:23 -05:00
parent 6a592930a4
commit c360c602f7
3 changed files with 23 additions and 4 deletions

View file

@ -1,16 +1,17 @@
import fs from 'fs'
import path from 'path'
import rimraf from 'rimraf'
import postcss from 'postcss'
import tailwind from '../src/index'
function inTempDirectory(callback) {
return new Promise(resolve => {
rimraf.sync('./__tmp')
fs.mkdirSync(path.resolve('./__tmp'))
process.chdir(path.resolve('./__tmp'))
callback().then(() => {
process.chdir(path.resolve('../'))
fs.rmdirSync(path.resolve('./__tmp'))
resolve()
rimraf('./__tmp', resolve)
})
})
}
@ -113,7 +114,6 @@ test('tailwind.config.js is picked up by default', () => {
}
}
`)
fs.unlinkSync(path.resolve('./tailwind.config.js'))
})
})
})

View file

@ -38,7 +38,7 @@
"eslint-plugin-prettier": "^2.3.1",
"jest": "^23.6.0",
"prettier": "^1.7.4",
"rimraf": "^2.6.1"
"rimraf": "^2.6.3"
},
"dependencies": {
"autoprefixer": "^9.4.5",

View file

@ -2208,6 +2208,18 @@ glob@^7.0.3, glob@^7.0.5, glob@^7.1.1, glob@^7.1.2:
once "^1.3.0"
path-is-absolute "^1.0.0"
glob@^7.1.3:
version "7.1.3"
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.3.tgz#3960832d3f1574108342dafd3a67b332c0969df1"
integrity sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==
dependencies:
fs.realpath "^1.0.0"
inflight "^1.0.4"
inherits "2"
minimatch "^3.0.4"
once "^1.3.0"
path-is-absolute "^1.0.0"
globals@^11.0.1:
version "11.5.0"
resolved "https://registry.yarnpkg.com/globals/-/globals-11.5.0.tgz#6bc840de6771173b191f13d3a9c94d441ee92642"
@ -4437,6 +4449,13 @@ rimraf@^2.2.8, rimraf@^2.5.4, rimraf@^2.6.1:
dependencies:
glob "^7.0.5"
rimraf@^2.6.3:
version "2.6.3"
resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.3.tgz#b2d104fe0d8fb27cf9e0a1cda8262dd3833c6cab"
integrity sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==
dependencies:
glob "^7.1.3"
rsvp@^3.3.3:
version "3.6.2"
resolved "https://registry.yarnpkg.com/rsvp/-/rsvp-3.6.2.tgz#2e96491599a96cde1b515d5674a8f7a91452926a"