mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-23 04:11:06 +07:00
Merge pull request #84 from decnorton/develop
Add problem matcher for PHPUnit
This commit is contained in:
commit
8039546df3
24
.github/matchers/phpunit.json
vendored
Normal file
24
.github/matchers/phpunit.json
vendored
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
{
|
||||||
|
"problemMatcher": [
|
||||||
|
{
|
||||||
|
"owner": "phpunit",
|
||||||
|
"pattern": [
|
||||||
|
{
|
||||||
|
"regexp": "^\\d+\\)\\s.*$"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"regexp": "^(.*)$",
|
||||||
|
"message": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"regexp": "^\\s*$"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"regexp": "^(.*):(\\d+)$",
|
||||||
|
"file": 1,
|
||||||
|
"line": 2
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
@ -1,4 +1,6 @@
|
|||||||
import * as install from '../src/install';
|
import * as install from '../src/install';
|
||||||
|
import * as matchers from '../src/matchers';
|
||||||
|
import * as path from 'path';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mock install.ts
|
* Mock install.ts
|
||||||
@ -150,4 +152,34 @@ describe('Install', () => {
|
|||||||
expect(script).toContain('set coverage driver');
|
expect(script).toContain('set coverage driver');
|
||||||
expect(script).toContain('sh script.sh 7.3 ' + __dirname);
|
expect(script).toContain('sh script.sh 7.3 ' + __dirname);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('Matchers', () => {
|
||||||
|
let originalLogMethod: any;
|
||||||
|
let outputData: any[] = [];
|
||||||
|
|
||||||
|
beforeAll(() => {
|
||||||
|
originalLogMethod = console.log;
|
||||||
|
console['log'] = jest.fn(inputs => outputData.push(inputs));
|
||||||
|
});
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
outputData = [];
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(() => {
|
||||||
|
console['log'] = originalLogMethod;
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Add matchers', async () => {
|
||||||
|
matchers.addMatchers();
|
||||||
|
|
||||||
|
expect(outputData).toEqual([
|
||||||
|
`##[add-matcher]${path.join(
|
||||||
|
__dirname,
|
||||||
|
'..',
|
||||||
|
'.github/matchers/phpunit.json'
|
||||||
|
)}`
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@ -4,6 +4,7 @@ import * as config from './config';
|
|||||||
import * as coverage from './coverage';
|
import * as coverage from './coverage';
|
||||||
import * as extensions from './extensions';
|
import * as extensions from './extensions';
|
||||||
import * as utils from './utils';
|
import * as utils from './utils';
|
||||||
|
import {addMatchers} from './matchers';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build the script
|
* Build the script
|
||||||
@ -68,6 +69,8 @@ export async function run(): Promise<void> {
|
|||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addMatchers();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
core.setFailed(error.message);
|
core.setFailed(error.message);
|
||||||
}
|
}
|
||||||
|
10
src/matchers.ts
Normal file
10
src/matchers.ts
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
import * as path from 'path';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add matches using the Actions Toolkit problem matchers syntax
|
||||||
|
* https://github.com/actions/toolkit/blob/master/docs/problem-matchers.md
|
||||||
|
*/
|
||||||
|
export function addMatchers(): void {
|
||||||
|
const matchersPath = path.join(__dirname, '..', '.github/matchers');
|
||||||
|
console.log(`##[add-matcher]${path.join(matchersPath, 'phpunit.json')}`);
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user