import tempy from 'tempy'
import fs from 'fs-extra'

export default function (test) {
  test.beforeEach(async (t) => {
    const directory = tempy.directory()
    await fs.ensureDir(directory)
    Object.assign(t.context, {directory})
  })

  test.afterEach.always(async (t) => {
    const {directory} = t.context
    await fs.remove(directory)
  })
}

import {temporaryDirectory} from 'tempy'
import fs from 'fs-extra'

export default function (test) {
  test.beforeEach(async (t) => {
    const directory = temporaryDirectory()
    await fs.ensureDir(directory)
    Object.assign(t.context, {directory})
  })

  test.afterEach.always(async (t) => {
    const {directory} = t.context
    await fs.remove(directory)
  })
}

Fix breaking usages of an updated version of tempy
test(withDirectory): Fix breaking usages of an updated version of tempy
