woocommerce/tools/compare-perf/config.js

35 lines
1.2 KiB
JavaScript
Raw Normal View History

const path = require( 'path' );
const getPnpmPackage = ( sourceDir ) => {
const packageJson = require( path.join( sourceDir, 'package.json' ) );
2024-08-06 09:23:04 +00:00
let pnpmPackage = 'pnpm';
if ( packageJson.engines.pnpm ) {
2024-08-06 09:23:04 +00:00
pnpmPackage = `pnpm@${ packageJson.engines.pnpm }`;
}
2024-08-06 09:23:04 +00:00
return pnpmPackage;
};
const config = {
gitRepositoryURL: 'https://github.com/woocommerce/woocommerce.git',
pluginPath: '/plugins/woocommerce',
testsPath: '/plugins/woocommerce/tests/metrics/specs',
getSetupTestRunner: ( sourceDir ) => {
2024-08-06 09:23:04 +00:00
const pnpmPackage = getPnpmPackage( sourceDir );
2024-08-06 09:23:04 +00:00
return `npm install -g ${ pnpmPackage } && pnpm install --frozen-lockfile --filter="@woocommerce/plugin-woocommerce" &> /dev/null && cd plugins/woocommerce && pnpm exec playwright install chromium`;
},
getSetupCommand: ( sourceDir ) => {
2024-08-06 09:23:04 +00:00
const pnpmPackage = getPnpmPackage( sourceDir );
2024-08-06 09:23:04 +00:00
return `npm install -g ${ pnpmPackage } && pnpm install --frozen-lockfile &> /dev/null && pnpm build &> /dev/null`;
},
getTestCommand: ( sourceDir ) => {
2024-08-06 09:23:04 +00:00
const pnpmPackage = getPnpmPackage( sourceDir );
return `npm install -g ${ pnpmPackage } && cd plugins/woocommerce && pnpm test:metrics`;
},
};
module.exports = config;