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

View File

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