mirror of
https://code.forgejo.org/actions/git-backporting.git
synced 2025-05-18 11:39:12 -04:00
feat: config file as option (#42)
Fix https://github.com/lampajr/backporting/issues/37 This enhancement required a huge refactoring where all arguments defaults have been centralized in one single place ArgsParser#parse
This commit is contained in:
parent
a88adeec35
commit
5ead31f606
27 changed files with 1465 additions and 219 deletions
|
@ -1,4 +1,5 @@
|
|||
import * as core from "@actions/core";
|
||||
import * as fs from "fs";
|
||||
|
||||
export const addProcessArgs = (args: string[]) => {
|
||||
process.argv = [...process.argv, ...args];
|
||||
|
@ -24,4 +25,21 @@ export const spyGetInput = (obj: any) => {
|
|||
*/
|
||||
export const expectArrayEqual = (actual: unknown[], expected: unknown[]) => {
|
||||
expect(actual.sort()).toEqual(expected.sort());
|
||||
};
|
||||
|
||||
/**
|
||||
* Create a test file given the full pathname
|
||||
* @param pathname full file pathname e.g, /tmp/dir/filename.json
|
||||
* @param content what must be written in the file
|
||||
*/
|
||||
export const createTestFile = (pathname: string, content: string) => {
|
||||
fs.writeFileSync(pathname, content);
|
||||
};
|
||||
|
||||
/**
|
||||
* Remove a file located at pathname
|
||||
* @param pathname full file pathname e.g, /tmp/dir/filename.json
|
||||
*/
|
||||
export const removeTestFile = (pathname: string) => {
|
||||
fs.rmSync(pathname);
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue