Skip to content

Commit 2e10289

Browse files
committed
replace custom copyDirSync with fs.cpSync
1 parent 097b81a commit 2e10289

1 file changed

Lines changed: 4 additions & 20 deletions

File tree

packages/e2e/setup/auth.ts

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,10 @@ import {waitForText} from '../helpers/wait-for-text.js'
77
import {completeLogin} from '../helpers/browser-login.js'
88
import {execa} from 'execa'
99
import * as fs from 'fs'
10-
import * as path from 'path'
1110

1211
// eslint-disable-next-line @typescript-eslint/no-explicit-any
1312
const log = {log: (_ctx: any, msg: string) => globalLog('auth', msg)}
1413

15-
/**
16-
* Copy directory contents recursively.
17-
*/
18-
function copyDirSync(src: string, dest: string): void {
19-
fs.mkdirSync(dest, {recursive: true})
20-
for (const entry of fs.readdirSync(src, {withFileTypes: true})) {
21-
const srcPath = path.join(src, entry.name)
22-
const destPath = path.join(dest, entry.name)
23-
if (entry.isDirectory()) {
24-
copyDirSync(srcPath, destPath)
25-
} else {
26-
fs.copyFileSync(srcPath, destPath)
27-
}
28-
}
29-
}
3014

3115
/**
3216
* Worker-scoped fixture that provides an authenticated CLI session.
@@ -57,10 +41,10 @@ export const authFixture = browserFixture.extend<{}, {authLogin: void}>({
5741
// Copy pre-authenticated session from global setup
5842
log.log(env, 'copying session from global setup')
5943

60-
copyDirSync(authConfigDir, env.processEnv.XDG_CONFIG_HOME!)
61-
copyDirSync(authDataDir, env.processEnv.XDG_DATA_HOME!)
62-
copyDirSync(authStateDir, env.processEnv.XDG_STATE_HOME!)
63-
copyDirSync(authCacheDir, env.processEnv.XDG_CACHE_HOME!)
44+
fs.cpSync(authConfigDir, env.processEnv.XDG_CONFIG_HOME!, {recursive: true})
45+
fs.cpSync(authDataDir, env.processEnv.XDG_DATA_HOME!, {recursive: true})
46+
fs.cpSync(authStateDir, env.processEnv.XDG_STATE_HOME!, {recursive: true})
47+
fs.cpSync(authCacheDir, env.processEnv.XDG_CACHE_HOME!, {recursive: true})
6448

6549
await use()
6650
return

0 commit comments

Comments
 (0)