mirror of
https://github.com/tailwindlabs/tailwindcss.git
synced 2025-12-08 21:36:08 +00:00
* Update rimraf to version 4.1.2 * use rimraf sync API Our `oxide` engine uses rimraf v4, our `stable` engine uses rimraf v3 and the API is different in both. However the tests are currently shared for both engines so we have to use the correct API for the correct version. However, we can also just use the `sync` API. More info: https://github.com/isaacs/rimraf#major-changes-from-v3-to-v4 --------- Co-authored-by: depfu[bot] <23717796+depfu[bot]@users.noreply.github.com>
26 lines
525 B
JavaScript
26 lines
525 B
JavaScript
import fs from 'fs'
|
|
import path from 'path'
|
|
|
|
import rimraf from 'rimraf'
|
|
|
|
let id = 0
|
|
|
|
export default function (callback) {
|
|
return new Promise((resolve) => {
|
|
const workerId = `${process.env.JEST_WORKER_ID}-${id++}`
|
|
const tmpPath = path.resolve(__dirname, `../__tmp_${workerId}`)
|
|
const currentPath = process.cwd()
|
|
|
|
rimraf.sync(tmpPath)
|
|
fs.mkdirSync(tmpPath)
|
|
process.chdir(tmpPath)
|
|
|
|
callback().then(() => {
|
|
process.chdir(currentPath)
|
|
|
|
rimraf.sync(tmpPath)
|
|
resolve()
|
|
})
|
|
})
|
|
}
|