Skip to content

Commit 0c9da90

Browse files
committed
refactor: convert env helper to async/await per review feedback
1 parent 87f6742 commit 0c9da90

1 file changed

Lines changed: 15 additions & 15 deletions

File tree

test/helpers/env.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,21 @@ import { glob } from 'tinyglobby'
44

55
import tmp from './tmp.js'
66

7-
export default function (config, fixtures = '**/*', extension = 'cjs') {
7+
export default async function (config, fixtures = '**/*', extension = 'cjs') {
88
const dir = tmp()
99

10-
return fs.mkdir(dir, { recursive: true }).then(() =>
11-
Promise.all([
12-
glob(fixtures, { cwd: 'test/fixtures' }).then((list) => {
13-
return Promise.all(
14-
list.map(async (item) => {
15-
const dest = path.join(dir, item)
16-
await fs.mkdir(path.dirname(dest), { recursive: true })
17-
return fs.copyFile(path.join('test/fixtures', item), dest)
18-
}),
19-
)
20-
}),
21-
fs.writeFile(path.join(dir, `postcss.config.${extension}`), config),
22-
]).then(() => dir),
23-
)
10+
await fs.mkdir(dir, { recursive: true })
11+
12+
const list = await glob(fixtures, { cwd: 'test/fixtures' })
13+
14+
await Promise.all([
15+
...list.map(async (item) => {
16+
const dest = path.join(dir, item)
17+
await fs.mkdir(path.dirname(dest), { recursive: true })
18+
await fs.copyFile(path.join('test/fixtures', item), dest)
19+
}),
20+
fs.writeFile(path.join(dir, `postcss.config.${extension}`), config),
21+
])
22+
23+
return dir
2424
}

0 commit comments

Comments
 (0)