Merge pull request #125 from shivammathur/develop

Remove coverage drivers completely if requested
This commit is contained in:
Shivam Mathur 2019-12-20 15:04:11 +05:30 committed by GitHub
commit 0969980399
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 128 additions and 31 deletions

View File

@ -11,7 +11,10 @@ describe('Config tests', () => {
let win32: string = await coverage.addCoverage('pcov', '7.4', 'win32'); let win32: string = await coverage.addCoverage('pcov', '7.4', 'win32');
expect(win32).toContain('addExtension pcov'); expect(win32).toContain('addExtension pcov');
expect(win32).toContain( expect(win32).toContain(
'if(php -m | findstr -i xdebug) { Disable-PhpExtension xdebug C:\\tools\\php' 'if(php -m | findstr -i xdebug) { Disable-PhpExtension xdebug $php_dir'
);
expect(win32).toContain(
'if (Test-Path $ext_dir\\php_xdebug.dll) { Remove-Item $ext_dir\\php_xdebug.dll }'
); );
win32 = await coverage.addCoverage('pcov', '7.0', 'win32'); win32 = await coverage.addCoverage('pcov', '7.0', 'win32');
@ -24,13 +27,18 @@ describe('Config tests', () => {
it('checking addCoverage with PCOV on linux', async () => { it('checking addCoverage with PCOV on linux', async () => {
const linux: string = await coverage.addCoverage('pcov', '7.4', 'linux'); const linux: string = await coverage.addCoverage('pcov', '7.4', 'linux');
expect(linux).toContain('addExtension pcov'); expect(linux).toContain('addExtension pcov');
expect(linux).toContain('sudo sed -i "/xdebug/d" $ini_file'); expect(linux).toContain('sudo sed -i "/xdebug/d" "$ini_file"');
expect(linux).toContain('sudo phpdismod -v 7.4 xdebug'); expect(linux).toContain('sudo phpdismod -v 7.4 xdebug');
expect(linux).toContain(
'sudo DEBIAN_FRONTEND=noninteractive apt-fast remove php-xdebug'
);
}); });
it('checking addCoverage with PCOV on darwin', async () => { it('checking addCoverage with PCOV on darwin', async () => {
const darwin: string = await coverage.addCoverage('pcov', '7.4', 'darwin'); const darwin: string = await coverage.addCoverage('pcov', '7.4', 'darwin');
expect(darwin).toContain('addExtension pcov'); expect(darwin).toContain('addExtension pcov');
expect(darwin).toContain('sudo sed -i \'\' "/xdebug/d" "$ini_file"');
expect(darwin).toContain('sudo rm -rf "$ext_dir"/xdebug.so');
}); });
it('checking addCoverage with Xdebug on windows', async () => { it('checking addCoverage with Xdebug on windows', async () => {
@ -75,20 +83,31 @@ describe('Config tests', () => {
const win32 = await coverage.addCoverage('none', '7.4', 'win32'); const win32 = await coverage.addCoverage('none', '7.4', 'win32');
expect(win32).toContain('Disable-PhpExtension xdebug'); expect(win32).toContain('Disable-PhpExtension xdebug');
expect(win32).toContain('Disable-PhpExtension pcov'); expect(win32).toContain('Disable-PhpExtension pcov');
expect(win32).toContain(
'if (Test-Path $ext_dir\\php_xdebug.dll) { Remove-Item $ext_dir\\php_xdebug.dll }'
);
expect(win32).toContain(
'if (Test-Path $ext_dir\\php_pcov.dll) { Remove-Item $ext_dir\\php_pcov.dll }'
);
}); });
it('checking disableCoverage on linux', async () => { it('checking disableCoverage on linux', async () => {
const linux: string = await coverage.addCoverage('none', '7.4', 'linux'); const linux: string = await coverage.addCoverage('none', '7.4', 'linux');
expect(linux).toContain('sudo phpdismod -v 7.4 xdebug'); expect(linux).toContain('sudo phpdismod -v 7.4 xdebug');
expect(linux).toContain('sudo phpdismod -v 7.4 pcov'); expect(linux).toContain('sudo phpdismod -v 7.4 pcov');
expect(linux).toContain('sudo sed -i "/xdebug/d" $ini_file'); expect(linux).toContain('sudo sed -i "/xdebug/d" "$ini_file"');
expect(linux).toContain('sudo sed -i "/pcov/d" $ini_file'); expect(linux).toContain('sudo sed -i "/pcov/d" "$ini_file"');
expect(linux).toContain(
'sudo DEBIAN_FRONTEND=noninteractive apt-fast remove php-xdebug php-pcov'
);
}); });
it('checking disableCoverage on darwin', async () => { it('checking disableCoverage on darwin', async () => {
const darwin: string = await coverage.addCoverage('none', '7.4', 'darwin'); const darwin: string = await coverage.addCoverage('none', '7.4', 'darwin');
expect(darwin).toContain('sudo sed -i \'\' "/xdebug/d" $ini_file'); expect(darwin).toContain('sudo sed -i \'\' "/xdebug/d" "$ini_file"');
expect(darwin).toContain('sudo sed -i \'\' "/pcov/d" $ini_file'); expect(darwin).toContain('sudo sed -i \'\' "/pcov/d" "$ini_file"');
expect(darwin).toContain('sudo rm -rf "$ext_dir"/xdebug.so');
expect(darwin).toContain('sudo rm -rf "$ext_dir"/pcov.so');
}); });
it('checking no or invalid coverage driver', async () => { it('checking no or invalid coverage driver', async () => {

50
dist/index.js vendored
View File

@ -1613,14 +1613,26 @@ function addCoveragePCOV(version, os_version) {
'/mods-available/xdebug.ini ]; then sudo phpdismod -v ' + '/mods-available/xdebug.ini ]; then sudo phpdismod -v ' +
version + version +
' xdebug; fi\n'; ' xdebug; fi\n';
script += 'sudo sed -i "/xdebug/d" $ini_file\n'; script += 'sudo sed -i "/xdebug/d" "$ini_file"\n';
script +=
'sudo DEBIAN_FRONTEND=noninteractive apt-fast remove php-xdebug -y ' +
(yield utils.suppressOutput('linux')) +
'\n';
break; break;
case 'darwin': case 'darwin':
script += 'sudo sed -i \'\' "/xdebug/d" $ini_file\n'; script += 'sudo sed -i \'\' "/xdebug/d" "$ini_file"\n';
script +=
'sudo rm -rf "$ext_dir"/xdebug.so ' +
(yield utils.suppressOutput('darwin')) +
'\n';
break; break;
case 'win32': case 'win32':
script += script +=
'if(php -m | findstr -i xdebug) { Disable-PhpExtension xdebug C:\\tools\\php }\n'; 'if(php -m | findstr -i xdebug) { Disable-PhpExtension xdebug $php_dir }\n';
script +=
'if (Test-Path $ext_dir\\php_xdebug.dll) { Remove-Item $ext_dir\\php_xdebug.dll }' +
(yield utils.suppressOutput('win32')) +
'\n';
break; break;
} }
// success // success
@ -1659,18 +1671,38 @@ function disableCoverage(version, os_version) {
'/mods-available/pcov.ini ]; then sudo phpdismod -v ' + '/mods-available/pcov.ini ]; then sudo phpdismod -v ' +
version + version +
' pcov; fi\n'; ' pcov; fi\n';
script += 'sudo sed -i "/xdebug/d" $ini_file\n'; script += 'sudo sed -i "/xdebug/d" "$ini_file"\n';
script += 'sudo sed -i "/pcov/d" $ini_file\n'; script += 'sudo sed -i "/pcov/d" "$ini_file"\n';
script +=
'sudo DEBIAN_FRONTEND=noninteractive apt-fast remove php-xdebug php-pcov -y ' +
(yield utils.suppressOutput('linux')) +
'\n';
break; break;
case 'darwin': case 'darwin':
script += 'sudo sed -i \'\' "/xdebug/d" $ini_file\n'; script += 'sudo sed -i \'\' "/xdebug/d" "$ini_file"\n';
script += 'sudo sed -i \'\' "/pcov/d" $ini_file\n'; script += 'sudo sed -i \'\' "/pcov/d" "$ini_file"\n';
script +=
'sudo rm -rf "$ext_dir"/xdebug.so ' +
(yield utils.suppressOutput('darwin')) +
'\n';
script +=
'sudo rm -rf "$ext_dir"/pcov.so ' +
(yield utils.suppressOutput('darwin')) +
'\n';
break; break;
case 'win32': case 'win32':
script += script +=
'if(php -m | findstr -i xdebug) { Disable-PhpExtension xdebug C:\\tools\\php }\n'; 'if(php -m | findstr -i xdebug) { Disable-PhpExtension xdebug $php_dir }\n';
script += script +=
'if(php -m | findstr -i pcov) { Disable-PhpExtension pcov C:\\tools\\php }\n'; 'if(php -m | findstr -i pcov) { Disable-PhpExtension pcov $php_dir }\n';
script +=
'if (Test-Path $ext_dir\\php_xdebug.dll) { Remove-Item $ext_dir\\php_xdebug.dll }' +
(yield utils.suppressOutput('win32')) +
'\n';
script +=
'if (Test-Path $ext_dir\\php_pcov.dll) { Remove-Item $ext_dir\\php_pcov.dll }' +
(yield utils.suppressOutput('win32')) +
'\n';
break; break;
} }
script += yield utils.addLog('$tick', 'none', 'Disabled Xdebug and PCOV', os_version); script += yield utils.addLog('$tick', 'none', 'Disabled Xdebug and PCOV', os_version);

28
package-lock.json generated
View File

@ -2287,12 +2287,14 @@
"balanced-match": { "balanced-match": {
"version": "1.0.0", "version": "1.0.0",
"bundled": true, "bundled": true,
"dev": true "dev": true,
"optional": true
}, },
"brace-expansion": { "brace-expansion": {
"version": "1.1.11", "version": "1.1.11",
"bundled": true, "bundled": true,
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"balanced-match": "^1.0.0", "balanced-match": "^1.0.0",
"concat-map": "0.0.1" "concat-map": "0.0.1"
@ -2307,17 +2309,20 @@
"code-point-at": { "code-point-at": {
"version": "1.1.0", "version": "1.1.0",
"bundled": true, "bundled": true,
"dev": true "dev": true,
"optional": true
}, },
"concat-map": { "concat-map": {
"version": "0.0.1", "version": "0.0.1",
"bundled": true, "bundled": true,
"dev": true "dev": true,
"optional": true
}, },
"console-control-strings": { "console-control-strings": {
"version": "1.1.0", "version": "1.1.0",
"bundled": true, "bundled": true,
"dev": true "dev": true,
"optional": true
}, },
"core-util-is": { "core-util-is": {
"version": "1.0.2", "version": "1.0.2",
@ -2434,7 +2439,8 @@
"inherits": { "inherits": {
"version": "2.0.4", "version": "2.0.4",
"bundled": true, "bundled": true,
"dev": true "dev": true,
"optional": true
}, },
"ini": { "ini": {
"version": "1.3.5", "version": "1.3.5",
@ -2446,6 +2452,7 @@
"version": "1.0.0", "version": "1.0.0",
"bundled": true, "bundled": true,
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"number-is-nan": "^1.0.0" "number-is-nan": "^1.0.0"
} }
@ -2460,6 +2467,7 @@
"version": "3.0.4", "version": "3.0.4",
"bundled": true, "bundled": true,
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"brace-expansion": "^1.1.7" "brace-expansion": "^1.1.7"
} }
@ -2467,12 +2475,14 @@
"minimist": { "minimist": {
"version": "0.0.8", "version": "0.0.8",
"bundled": true, "bundled": true,
"dev": true "dev": true,
"optional": true
}, },
"minipass": { "minipass": {
"version": "2.9.0", "version": "2.9.0",
"bundled": true, "bundled": true,
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"safe-buffer": "^5.1.2", "safe-buffer": "^5.1.2",
"yallist": "^3.0.0" "yallist": "^3.0.0"
@ -2491,6 +2501,7 @@
"version": "0.5.1", "version": "0.5.1",
"bundled": true, "bundled": true,
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"minimist": "0.0.8" "minimist": "0.0.8"
} }
@ -2580,7 +2591,8 @@
"number-is-nan": { "number-is-nan": {
"version": "1.0.1", "version": "1.0.1",
"bundled": true, "bundled": true,
"dev": true "dev": true,
"optional": true
}, },
"object-assign": { "object-assign": {
"version": "4.1.1", "version": "4.1.1",
@ -2592,6 +2604,7 @@
"version": "1.4.0", "version": "1.4.0",
"bundled": true, "bundled": true,
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"wrappy": "1" "wrappy": "1"
} }
@ -2713,6 +2726,7 @@
"version": "1.0.2", "version": "1.0.2",
"bundled": true, "bundled": true,
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"code-point-at": "^1.0.0", "code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0", "is-fullwidth-code-point": "^1.0.0",

View File

@ -68,14 +68,26 @@ export async function addCoveragePCOV(
'/mods-available/xdebug.ini ]; then sudo phpdismod -v ' + '/mods-available/xdebug.ini ]; then sudo phpdismod -v ' +
version + version +
' xdebug; fi\n'; ' xdebug; fi\n';
script += 'sudo sed -i "/xdebug/d" $ini_file\n'; script += 'sudo sed -i "/xdebug/d" "$ini_file"\n';
script +=
'sudo DEBIAN_FRONTEND=noninteractive apt-fast remove php-xdebug -y ' +
(await utils.suppressOutput('linux')) +
'\n';
break; break;
case 'darwin': case 'darwin':
script += 'sudo sed -i \'\' "/xdebug/d" $ini_file\n'; script += 'sudo sed -i \'\' "/xdebug/d" "$ini_file"\n';
script +=
'sudo rm -rf "$ext_dir"/xdebug.so ' +
(await utils.suppressOutput('darwin')) +
'\n';
break; break;
case 'win32': case 'win32':
script += script +=
'if(php -m | findstr -i xdebug) { Disable-PhpExtension xdebug C:\\tools\\php }\n'; 'if(php -m | findstr -i xdebug) { Disable-PhpExtension xdebug $php_dir }\n';
script +=
'if (Test-Path $ext_dir\\php_xdebug.dll) { Remove-Item $ext_dir\\php_xdebug.dll }' +
(await utils.suppressOutput('win32')) +
'\n';
break; break;
} }
@ -127,18 +139,38 @@ export async function disableCoverage(
'/mods-available/pcov.ini ]; then sudo phpdismod -v ' + '/mods-available/pcov.ini ]; then sudo phpdismod -v ' +
version + version +
' pcov; fi\n'; ' pcov; fi\n';
script += 'sudo sed -i "/xdebug/d" $ini_file\n'; script += 'sudo sed -i "/xdebug/d" "$ini_file"\n';
script += 'sudo sed -i "/pcov/d" $ini_file\n'; script += 'sudo sed -i "/pcov/d" "$ini_file"\n';
script +=
'sudo DEBIAN_FRONTEND=noninteractive apt-fast remove php-xdebug php-pcov -y ' +
(await utils.suppressOutput('linux')) +
'\n';
break; break;
case 'darwin': case 'darwin':
script += 'sudo sed -i \'\' "/xdebug/d" $ini_file\n'; script += 'sudo sed -i \'\' "/xdebug/d" "$ini_file"\n';
script += 'sudo sed -i \'\' "/pcov/d" $ini_file\n'; script += 'sudo sed -i \'\' "/pcov/d" "$ini_file"\n';
script +=
'sudo rm -rf "$ext_dir"/xdebug.so ' +
(await utils.suppressOutput('darwin')) +
'\n';
script +=
'sudo rm -rf "$ext_dir"/pcov.so ' +
(await utils.suppressOutput('darwin')) +
'\n';
break; break;
case 'win32': case 'win32':
script += script +=
'if(php -m | findstr -i xdebug) { Disable-PhpExtension xdebug C:\\tools\\php }\n'; 'if(php -m | findstr -i xdebug) { Disable-PhpExtension xdebug $php_dir }\n';
script += script +=
'if(php -m | findstr -i pcov) { Disable-PhpExtension pcov C:\\tools\\php }\n'; 'if(php -m | findstr -i pcov) { Disable-PhpExtension pcov $php_dir }\n';
script +=
'if (Test-Path $ext_dir\\php_xdebug.dll) { Remove-Item $ext_dir\\php_xdebug.dll }' +
(await utils.suppressOutput('win32')) +
'\n';
script +=
'if (Test-Path $ext_dir\\php_pcov.dll) { Remove-Item $ext_dir\\php_pcov.dll }' +
(await utils.suppressOutput('win32')) +
'\n';
break; break;
} }
script += await utils.addLog( script += await utils.addLog(