mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-22 20:01:06 +07:00
Fix coverage
This commit is contained in:
parent
e6a3eb1258
commit
62aa8428dd
46
dist/index.js
vendored
46
dist/index.js
vendored
@ -1677,10 +1677,14 @@ const config = __importStar(__nccwpck_require__(373));
|
||||
* @param pipe
|
||||
*/
|
||||
async function addCoverageXdebug(extension, version, os_version, pipe) {
|
||||
const xdebug = (await extensions.addExtension(extension, version, os_version, true)) +
|
||||
pipe;
|
||||
const log = await utils.addLog('$tick', extension, 'Xdebug enabled as coverage driver', os_version);
|
||||
return xdebug + '\n' + log;
|
||||
let script = '\n';
|
||||
script +=
|
||||
(await extensions.addExtension(':pcov', version, os_version, true)) + pipe;
|
||||
script +=
|
||||
(await extensions.addExtension(extension, version, os_version, true)) +
|
||||
pipe;
|
||||
script += await utils.addLog('$tick', extension, 'Xdebug enabled as coverage driver', os_version);
|
||||
return script;
|
||||
}
|
||||
exports.addCoverageXdebug = addCoverageXdebug;
|
||||
/**
|
||||
@ -1694,22 +1698,14 @@ async function addCoveragePCOV(version, os_version, pipe) {
|
||||
let script = '\n';
|
||||
switch (true) {
|
||||
default:
|
||||
script +=
|
||||
(await extensions.addExtension(':xdebug', version, os_version, true)) +
|
||||
pipe;
|
||||
script +=
|
||||
(await extensions.addExtension('pcov', version, os_version, true)) +
|
||||
pipe +
|
||||
'\n';
|
||||
pipe;
|
||||
script +=
|
||||
(await config.addINIValues('pcov.enabled=1', os_version, true)) + '\n';
|
||||
// add command to disable xdebug and enable pcov
|
||||
switch (os_version) {
|
||||
case 'linux':
|
||||
case 'darwin':
|
||||
script += 'remove_extension xdebug' + pipe + '\n';
|
||||
break;
|
||||
case 'win32':
|
||||
script += 'Remove-Extension xdebug' + pipe + '\n';
|
||||
break;
|
||||
}
|
||||
// success
|
||||
script += await utils.addLog('$tick', 'coverage: pcov', 'PCOV enabled as coverage driver', os_version);
|
||||
// version is not supported
|
||||
@ -1730,17 +1726,11 @@ exports.addCoveragePCOV = addCoveragePCOV;
|
||||
*/
|
||||
async function disableCoverage(version, os_version, pipe) {
|
||||
let script = '\n';
|
||||
switch (os_version) {
|
||||
case 'linux':
|
||||
case 'darwin':
|
||||
script += 'remove_extension xdebug' + pipe + '\n';
|
||||
script += 'remove_extension pcov' + pipe + '\n';
|
||||
break;
|
||||
case 'win32':
|
||||
script += 'Remove-Extension xdebug' + pipe + '\n';
|
||||
script += 'Remove-Extension pcov' + pipe + '\n';
|
||||
break;
|
||||
}
|
||||
script +=
|
||||
(await extensions.addExtension(':pcov', version, os_version, true)) + pipe;
|
||||
script +=
|
||||
(await extensions.addExtension(':xdebug', version, os_version, true)) +
|
||||
pipe;
|
||||
script += await utils.addLog('$tick', 'none', 'Disabled Xdebug and PCOV', os_version);
|
||||
return script;
|
||||
}
|
||||
@ -1755,7 +1745,7 @@ exports.disableCoverage = disableCoverage;
|
||||
async function addCoverage(coverage_driver, version, os_version) {
|
||||
coverage_driver = coverage_driver.toLowerCase();
|
||||
const script = '\n' + (await utils.stepLog('Setup Coverage', os_version));
|
||||
const pipe = await utils.suppressOutput(os_version);
|
||||
const pipe = (await utils.suppressOutput(os_version)) + '\n';
|
||||
switch (coverage_driver) {
|
||||
case 'pcov':
|
||||
return script + (await addCoveragePCOV(version, os_version, pipe));
|
||||
|
@ -16,16 +16,19 @@ export async function addCoverageXdebug(
|
||||
os_version: string,
|
||||
pipe: string
|
||||
): Promise<string> {
|
||||
const xdebug =
|
||||
let script = '\n';
|
||||
script +=
|
||||
(await extensions.addExtension(':pcov', version, os_version, true)) + pipe;
|
||||
script +=
|
||||
(await extensions.addExtension(extension, version, os_version, true)) +
|
||||
pipe;
|
||||
const log = await utils.addLog(
|
||||
script += await utils.addLog(
|
||||
'$tick',
|
||||
extension,
|
||||
'Xdebug enabled as coverage driver',
|
||||
os_version
|
||||
);
|
||||
return xdebug + '\n' + log;
|
||||
return script;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -43,24 +46,15 @@ export async function addCoveragePCOV(
|
||||
let script = '\n';
|
||||
switch (true) {
|
||||
default:
|
||||
script +=
|
||||
(await extensions.addExtension(':xdebug', version, os_version, true)) +
|
||||
pipe;
|
||||
script +=
|
||||
(await extensions.addExtension('pcov', version, os_version, true)) +
|
||||
pipe +
|
||||
'\n';
|
||||
pipe;
|
||||
script +=
|
||||
(await config.addINIValues('pcov.enabled=1', os_version, true)) + '\n';
|
||||
|
||||
// add command to disable xdebug and enable pcov
|
||||
switch (os_version) {
|
||||
case 'linux':
|
||||
case 'darwin':
|
||||
script += 'remove_extension xdebug' + pipe + '\n';
|
||||
break;
|
||||
case 'win32':
|
||||
script += 'Remove-Extension xdebug' + pipe + '\n';
|
||||
break;
|
||||
}
|
||||
|
||||
// success
|
||||
script += await utils.addLog(
|
||||
'$tick',
|
||||
@ -97,17 +91,11 @@ export async function disableCoverage(
|
||||
pipe: string
|
||||
): Promise<string> {
|
||||
let script = '\n';
|
||||
switch (os_version) {
|
||||
case 'linux':
|
||||
case 'darwin':
|
||||
script += 'remove_extension xdebug' + pipe + '\n';
|
||||
script += 'remove_extension pcov' + pipe + '\n';
|
||||
break;
|
||||
case 'win32':
|
||||
script += 'Remove-Extension xdebug' + pipe + '\n';
|
||||
script += 'Remove-Extension pcov' + pipe + '\n';
|
||||
break;
|
||||
}
|
||||
script +=
|
||||
(await extensions.addExtension(':pcov', version, os_version, true)) + pipe;
|
||||
script +=
|
||||
(await extensions.addExtension(':xdebug', version, os_version, true)) +
|
||||
pipe;
|
||||
script += await utils.addLog(
|
||||
'$tick',
|
||||
'none',
|
||||
@ -133,7 +121,7 @@ export async function addCoverage(
|
||||
coverage_driver = coverage_driver.toLowerCase();
|
||||
const script: string =
|
||||
'\n' + (await utils.stepLog('Setup Coverage', os_version));
|
||||
const pipe: string = await utils.suppressOutput(os_version);
|
||||
const pipe: string = (await utils.suppressOutput(os_version)) + '\n';
|
||||
switch (coverage_driver) {
|
||||
case 'pcov':
|
||||
return script + (await addCoveragePCOV(version, os_version, pipe));
|
||||
|
Loading…
Reference in New Issue
Block a user