@alphabin/trx
Version:
TRX reporter for Playwright tests with Azure Blob Storage upload support
46 lines (45 loc) • 1.36 kB
TypeScript
import fs from 'fs';
/**
* Reads a JSON file and parses it
*/
export declare function readJsonFile<T>(filePath: string): T | null;
/**
* Writes an object to a JSON file
*/
export declare function writeJsonFile(filePath: string, data: any): boolean;
/**
* Finds the git root directory by searching for .git
*/
export declare function findGitRoot(startDir?: string): string | null;
/**
* Gets package.json from the nearest directory
*/
export declare function findPackageJson(startDir?: string): any | null;
/**
* Checks if a directory exists
*/
export declare function directoryExists(dirPath: string): boolean;
/**
* Checks if a file exists
*/
export declare function fileExists(filePath: string): boolean;
/**
* Gets directory size recursively
*/
export declare function getDirectorySize(dirPath: string): number;
/**
* Lists files in directory recursively
*/
export declare function listFilesRecursive(dirPath: string, extensions?: string[]): string[];
/**
* Creates a directory if it doesn't exist
*/
export declare function ensureDirectory(dirPath: string): boolean;
/**
* Gets file stats safely
*/
export declare function getFileStats(filePath: string): fs.Stats | null;
/**
* Checks if path is within another path (prevents directory traversal)
*/
export declare function isPathWithin(childPath: string, parentPath: string): boolean;