[performance metrics] Use engines.pnpm version when setting up the environment (#46787)

This commit is contained in:
Adrian Moldovan 2024-04-22 20:34:28 +03:00 committed by GitHub
parent 05fed19271
commit a33078ba6b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 17 additions and 6 deletions

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
Perf tests: fix environment setup issue

View File

@ -1,3 +1,6 @@
/**
* External dependencies
*/
import { existsSync, readFileSync } from 'fs';
export function median( array ) {

View File

@ -1,13 +1,17 @@
const packageJson = require( '../../package.json' );
let pnpm_package = 'pnpm';
if ( packageJson.engines.pnpm ) {
pnpm_package = `pnpm@${ packageJson.engines.pnpm }`;
}
const config = {
gitRepositoryURL: 'https://github.com/woocommerce/woocommerce.git',
setupTestRunner:
'npm install -g pnpm && pnpm install --filter="@woocommerce/plugin-woocommerce" &> /dev/null && cd plugins/woocommerce && pnpm exec playwright install chromium',
setupCommand:
'npm install -g pnpm && pnpm install &> /dev/null && pnpm build &> /dev/null',
setupTestRunner: `npm install -g ${ pnpm_package } && pnpm install --filter="@woocommerce/plugin-woocommerce" &> /dev/null && cd plugins/woocommerce && pnpm exec playwright install chromium`,
setupCommand: `npm install -g ${ pnpm_package } && pnpm install &> /dev/null && pnpm build &> /dev/null`,
pluginPath: '/plugins/woocommerce',
testsPath: '/plugins/woocommerce/tests/metrics/specs',
testCommand:
'npm install -g pnpm && cd plugins/woocommerce && pnpm test:metrics',
testCommand: `npm install -g ${ pnpm_package } && cd plugins/woocommerce && pnpm test:metrics`,
};
module.exports = config;