Fix macos

This commit is contained in:
Shivam Mathur 2020-11-28 15:02:35 +05:30
parent 02cba443ad
commit d14c0d0dd7
No known key found for this signature in database
GPG Key ID: 3E13E4C8591ACC2A
2 changed files with 15 additions and 14 deletions

View File

@ -42,11 +42,12 @@ describe('Utils tests', () => {
it('checking asyncForEach', async () => {
const array: Array<string> = ['a', 'b', 'c'];
let concat = '';
await utils.asyncForEach(array, async function (
str: string
): Promise<void> {
concat += str;
});
await utils.asyncForEach(
array,
async function (str: string): Promise<void> {
concat += str;
}
);
expect(concat).toBe('abc');
});
@ -83,12 +84,12 @@ describe('Utils tests', () => {
const runner_dir: string = process.env['RUNNER_TOOL_CACHE'] || '';
const script_path: string = path.join(runner_dir, 'test.sh');
await utils.writeScript('test.sh', testString);
await fs.readFile(script_path, function (
error: Error | null,
data: Buffer
) {
expect(testString).toBe(data.toString());
});
await fs.readFile(
script_path,
function (error: Error | null, data: Buffer) {
expect(testString).toBe(data.toString());
}
);
await cleanup(script_path);
});

View File

@ -102,10 +102,10 @@ add_php() {
brew tap --shallow shivammathur/php
fi
update_dependencies
if brew list php@"$version" 2>/dev/null | grep -q "Error" && [ "$action" != "upgrade" ]; then
brew unlink php@"$version"
if ! [[ "$(find "$(brew --cellar)"/php/ -maxdepth 1 -name "$version*" | wc -l 2>/dev/null)" -eq 0 ]] && [ "$action" != "upgrade" ]; then
brew unlink shivammathur/php/php@"$version"
else
brew "$action" shivammathur/php/php@"$version"
brew upgrade "shivammathur/php/php@$version" 2>/dev/null || brew install "shivammathur/php/php@$version"
fi
brew link --force --overwrite php@"$version"
}