Skip to content

Commit 8ae8ae3

Browse files
committed
test: tweak
1 parent 179802f commit 8ae8ae3

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

packages/plugin-rsc/e2e/fixture.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -214,19 +214,17 @@ export async function setupInlineFixture(options: {
214214
// write additional files
215215
if (options.files) {
216216
for (let [filename, contents] of Object.entries(options.files)) {
217+
const filepath = path.join(options.dest, filename)
218+
fs.mkdirSync(path.dirname(filepath), { recursive: true })
219+
217220
// custom command
218221
if (typeof contents === 'object' && 'cp' in contents) {
219222
const srcFile = path.join(options.dest, contents.cp)
220-
const destFile = path.join(options.dest, filename)
221-
fs.mkdirSync(path.dirname(srcFile), { recursive: true })
222-
fs.mkdirSync(path.dirname(destFile), { recursive: true })
223-
fs.cpSync(srcFile, destFile, { recursive: true })
223+
fs.cpSync(srcFile, filepath, { recursive: true })
224224
continue
225225
}
226-
// write a file
227-
const filepath = path.join(options.dest, filename)
228-
fs.mkdirSync(path.dirname(filepath), { recursive: true })
229-
// strip indent
226+
227+
// write a new file
230228
contents = contents.replace(/^\n*/, '').replace(/\s*$/, '\n')
231229
const indent = contents.match(/^\s*/)?.[0] ?? ''
232230
const strippedContents = contents

0 commit comments

Comments
 (0)