Skip to content

Commit

Permalink
chore: remove fs-extra dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
johannschopplich committed Nov 14, 2024
1 parent 098b09e commit 946be81
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions test/utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as fsp from 'node:fs/promises'
import { dirname } from 'node:path'
import fg from 'fast-glob'
import { outputFile, readFile } from 'fs-extra'
import { resolve } from 'pathe'
import { startCli } from '../src/node/cli-start'

Expand All @@ -11,13 +12,15 @@ export async function runCli(files: Record<string, string>) {

// Retrieve any file's content
const getFileContent = (filename: string) =>
readFile(resolve(testDir, filename), 'utf8')
fsp.readFile(resolve(testDir, filename), 'utf8')

// Write entry files on disk
await Promise.all(
Object.entries(files).map(([path, content]) =>
outputFile(resolve(testDir, path), content, 'utf8'),
),
Object.entries(files).map(async ([path, content]) => {
const filePath = resolve(testDir, path)
await fsp.mkdir(dirname(filePath), { recursive: true })
await fsp.writeFile(filePath, content, 'utf8')
}),
)

await runAsyncChildProcess(testDir, 'src/input.js')
Expand Down

0 comments on commit 946be81

Please sign in to comment.