diff --git a/test/integration/util.ts b/test/integration/util.ts index 0b39a8080..025eadd08 100644 --- a/test/integration/util.ts +++ b/test/integration/util.ts @@ -1,6 +1,6 @@ import assert from 'assert'; import { exec } from 'child_process'; -import { promises as fs } from 'fs'; +import { copyFileSync, promises as fs, unlinkSync } from 'fs'; import * as fse from 'fs-extra'; import glob from 'glob'; import { join } from 'path'; @@ -160,7 +160,8 @@ export async function restoreFile(filePath: string, workspaceDir = ProjectA): Pr const dstPath = join(ProjectA, filePath); const tmpPath = dstPath + '.orig'; await executeWorkspaceOSCommand(`git show HEAD:./${filePath} > ${tmpPath}`, workspaceDir); - await fs.rename(tmpPath, dstPath); + copyFileSync(tmpPath, dstPath); + unlinkSync(tmpPath); } /**