Fix xdebug setup

Co-authored-by: Owen Voke <development@voke.dev>
Co-authored-by: Shivam Mathur <shivam_jpr@hotmail.com>
This commit is contained in:
Shivam Mathur 2020-11-26 23:11:52 +05:30
parent 790a41a722
commit 5a40a5875d
No known key found for this signature in database
GPG Key ID: 3E13E4C8591ACC2A
5 changed files with 29 additions and 16 deletions

View File

@ -28,11 +28,13 @@ describe('Config tests', () => {
it('checking addCoverage with Xdebug on windows', async () => { it('checking addCoverage with Xdebug on windows', async () => {
const win32: string = await coverage.addCoverage('xdebug', '7.4', 'win32'); const win32: string = await coverage.addCoverage('xdebug', '7.4', 'win32');
expect(win32).toContain('Add-Extension xdebug'); expect(win32).toContain('Add-Extension xdebug');
expect(win32).toContain('xdebug.mode=coverage');
}); });
it('checking addCoverage with Xdebug on linux', async () => { it('checking addCoverage with Xdebug on linux', async () => {
const linux: string = await coverage.addCoverage('xdebug', '8.0', 'linux'); const linux: string = await coverage.addCoverage('xdebug', '8.0', 'linux');
expect(linux).toContain('add_extension xdebug'); expect(linux).toContain('add_extension xdebug');
expect(linux).toContain('echo "xdebug.mode=coverage"');
}); });
it('checking addCoverage with Xdebug3 on linux', async () => { it('checking addCoverage with Xdebug3 on linux', async () => {

View File

@ -25,6 +25,9 @@ describe('Extension tests', () => {
'Add-Log "$cross" "pcov" "pcov is not supported on PHP 5.6"' 'Add-Log "$cross" "pcov" "pcov is not supported on PHP 5.6"'
); );
win32 = await extensions.addExtension('xdebug', '7.2', 'win32');
expect(win32).toContain('Add-Extension xdebug stable 2.9.8');
win32 = await extensions.addExtension('mysql', '7.4', 'win32'); win32 = await extensions.addExtension('mysql', '7.4', 'win32');
expect(win32).toContain('Add-Extension mysqli'); expect(win32).toContain('Add-Extension mysqli');
expect(win32).toContain('Add-Extension mysqlnd'); expect(win32).toContain('Add-Extension mysqlnd');
@ -96,6 +99,9 @@ describe('Extension tests', () => {
linux = await extensions.addExtension('cubrid', '7.4', 'linux'); linux = await extensions.addExtension('cubrid', '7.4', 'linux');
expect(linux).toContain('add_cubrid cubrid'); expect(linux).toContain('add_cubrid cubrid');
linux = await extensions.addExtension('xdebug', '7.2', 'linux');
expect(linux).toContain('add_pecl_extension xdebug 2.9.8 zend_extension');
linux = await extensions.addExtension('xdebug', '7.2', 'openbsd'); linux = await extensions.addExtension('xdebug', '7.2', 'openbsd');
expect(linux).toContain('Platform openbsd is not supported'); expect(linux).toContain('Platform openbsd is not supported');

16
dist/index.js vendored
View File

@ -2328,14 +2328,7 @@ async function addCoverageXdebug(extension, version, os_version, pipe) {
pipe; pipe;
const ini = await config.addINIValues('xdebug.mode=coverage', os_version, true); const ini = await config.addINIValues('xdebug.mode=coverage', os_version, true);
const log = await utils.addLog('$tick', extension, 'Xdebug enabled as coverage driver', os_version); const log = await utils.addLog('$tick', extension, 'Xdebug enabled as coverage driver', os_version);
switch (true) { return [xdebug, ini, log].join('\n');
case /^xdebug3$/.test(extension):
case /^8\.\d$/.test(version):
return '\n' + xdebug + '\n' + ini + '\n' + log;
case /^xdebug$/.test(extension):
default:
return xdebug + '\n' + log;
}
} }
exports.addCoverageXdebug = addCoverageXdebug; exports.addCoverageXdebug = addCoverageXdebug;
/** /**
@ -2968,6 +2961,9 @@ async function addExtensionWindows(extension_csv, version) {
add_script += await utils.joins('\nAdd-Extension', ext_name, matches[2].replace('preview', 'devel'), matches[1]); add_script += await utils.joins('\nAdd-Extension', ext_name, matches[2].replace('preview', 'devel'), matches[1]);
break; break;
// match 5.3pcov to 7.0pcov // match 5.3pcov to 7.0pcov
case /7\.2xdebug/.test(version_extension):
add_script += '\nAdd-Extension xdebug stable 2.9.8';
break;
case /(5\.[3-6]|7\.0)pcov/.test(version_extension): case /(5\.[3-6]|7\.0)pcov/.test(version_extension):
add_script += await utils.getUnsupportedLog('pcov', version, 'win32'); add_script += await utils.getUnsupportedLog('pcov', version, 'win32');
break; break;
@ -3049,6 +3045,10 @@ async function addExtensionLinux(extension_csv, version) {
add_script += add_script +=
'\nadd_extension_from_source xdebug xdebug/xdebug master --enable-xdebug zend_extension'; '\nadd_extension_from_source xdebug xdebug/xdebug master --enable-xdebug zend_extension';
return; return;
// match 7.2xdebug
case /^7\.2xdebug$/.test(version_extension):
add_script += await utils.joins('\nadd_pecl_extension', ext_name, '2.9.8', ext_prefix);
break;
// match 8.0xdebug3...8.9xdebug3 // match 8.0xdebug3...8.9xdebug3
case /^8\.[0-9]xdebug3$/.test(version_extension): case /^8\.[0-9]xdebug3$/.test(version_extension):
extension = 'xdebug'; extension = 'xdebug';

View File

@ -30,14 +30,7 @@ export async function addCoverageXdebug(
'Xdebug enabled as coverage driver', 'Xdebug enabled as coverage driver',
os_version os_version
); );
switch (true) { return [xdebug, ini, log].join('\n');
case /^xdebug3$/.test(extension):
case /^8\.\d$/.test(version):
return '\n' + xdebug + '\n' + ini + '\n' + log;
case /^xdebug$/.test(extension):
default:
return xdebug + '\n' + log;
}
} }
/** /**

View File

@ -164,6 +164,9 @@ export async function addExtensionWindows(
); );
break; break;
// match 5.3pcov to 7.0pcov // match 5.3pcov to 7.0pcov
case /7\.2xdebug/.test(version_extension):
add_script += '\nAdd-Extension xdebug stable 2.9.8';
break;
case /(5\.[3-6]|7\.0)pcov/.test(version_extension): case /(5\.[3-6]|7\.0)pcov/.test(version_extension):
add_script += await utils.getUnsupportedLog('pcov', version, 'win32'); add_script += await utils.getUnsupportedLog('pcov', version, 'win32');
break; break;
@ -269,6 +272,15 @@ export async function addExtensionLinux(
add_script += add_script +=
'\nadd_extension_from_source xdebug xdebug/xdebug master --enable-xdebug zend_extension'; '\nadd_extension_from_source xdebug xdebug/xdebug master --enable-xdebug zend_extension';
return; return;
// match 7.2xdebug
case /^7\.2xdebug$/.test(version_extension):
add_script += await utils.joins(
'\nadd_pecl_extension',
ext_name,
'2.9.8',
ext_prefix
);
break;
// match 8.0xdebug3...8.9xdebug3 // match 8.0xdebug3...8.9xdebug3
case /^8\.[0-9]xdebug3$/.test(version_extension): case /^8\.[0-9]xdebug3$/.test(version_extension):
extension = 'xdebug'; extension = 'xdebug';