-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: create function to set up test repo
- Loading branch information
Showing
4 changed files
with
32 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
'use strict'; | ||
|
||
import { promises as fsPromises, readFile, stat, readdir, mkdtempSync } from 'node:fs'; | ||
import { mkdir, writeFile } from 'node:fs/promises'; | ||
import git from 'isomorphic-git'; | ||
|
||
import { regExFile, regExFileContents, sfdxConfigFile, sfdxConfigJsonString } from './testConstants.js'; | ||
|
||
export async function setupTestRepo(): Promise<string> { | ||
const tempDir = mkdtempSync('../git-temp-'); | ||
process.chdir(tempDir); | ||
const fs = { promises: fsPromises, readFile, stat, readdir }; | ||
|
||
await mkdir('force-app/main/default/classes', { recursive: true }); | ||
await mkdir('packaged/classes', { recursive: true }); | ||
await git.init({ fs, dir: tempDir }); | ||
await writeFile(regExFile, regExFileContents); | ||
await writeFile(sfdxConfigFile, sfdxConfigJsonString); | ||
return tempDir; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters