woocommerce-paypal-payments/tests/qa/bin/test-env-clean.js
2025-11-14 11:32:46 +01:00

38 lines
992 B
JavaScript

#!/usr/bin/env node
/**
* External dependencies
*/
const { execSync } = require( 'child_process' );
const commands = [
{
description: 'Activate storefront theme',
command: 'wp-env run tests-cli wp theme deactivate storefront',
},
{
description: 'Uninstall WooCommerce Payments',
command:
'wp-env run tests-cli -- wp plugin delete woocommerce-payments',
},
{
description: 'Uninstall WooCommerce',
command: 'wp-env run tests-cli -- wp plugin delete woocommerce',
},
];
console.log( 'Cleaning test environment...\n' );
commands.forEach( ( item, index ) => {
try {
console.log( `${ index + 1 }. ${ item.description }` );
execSync( item.command, { stdio: 'inherit' } );
console.log( '✅ Success\n' );
} catch ( error ) {
console.error( `❌ Failed: ${ item.description }` );
console.error( `Command: ${ item.command }` );
console.error( `Error: ${ error.message }\n` );
process.exit( 1 );
}
} );
console.log( '🧹 Test environment clean complete!' );