refactor: Use declarations style for functions.

This commit is contained in:
Ruben Verborgh
2021-01-06 11:24:43 +01:00
parent e70e060225
commit f9a20799eb
23 changed files with 208 additions and 162 deletions

View File

@@ -8,8 +8,8 @@ export const BASE = 'http://test.com';
/**
* Returns a component instantiated from a Components.js configuration.
*/
export const instantiateFromConfig = async(componentUrl: string, configFile: string,
variables?: Record<string, any>): Promise<any> => {
export async function instantiateFromConfig(componentUrl: string, configFile: string,
variables?: Record<string, any>): Promise<any> {
// Initialize the Components.js loader
const mainModulePath = joinFilePath(__dirname, '../../');
const loader = new Loader({ mainModulePath });
@@ -18,15 +18,16 @@ export const instantiateFromConfig = async(componentUrl: string, configFile: str
// Instantiate the component from the config
const configPath = toSystemFilePath(joinFilePath(__dirname, 'config', configFile));
return loader.instantiateFromUrl(componentUrl, configPath, undefined, { variables });
};
}
export const getTestFolder = (name: string): string =>
joinFilePath(__dirname, '../tmp', name);
export function getTestFolder(name: string): string {
return joinFilePath(__dirname, '../tmp', name);
}
export const createFolder = (folder: string): void => {
export function createFolder(folder: string): void {
mkdirSync(folder, { recursive: true });
};
}
export const removeFolder = (folder: string): void => {
export function removeFolder(folder: string): void {
rimraf.sync(folder, { glob: false });
};
}