diff --git a/plugins/woocommerce/changelog/fix-metrics-tests-pnpm-version-error b/plugins/woocommerce/changelog/fix-metrics-tests-pnpm-version-error new file mode 100644 index 00000000000..a3a451619eb --- /dev/null +++ b/plugins/woocommerce/changelog/fix-metrics-tests-pnpm-version-error @@ -0,0 +1,4 @@ +Significance: patch +Type: dev + +Perf tests: fix environment setup issue diff --git a/plugins/woocommerce/tests/metrics/utils.js b/plugins/woocommerce/tests/metrics/utils.js index 48d11ef144a..c014ae4b487 100644 --- a/plugins/woocommerce/tests/metrics/utils.js +++ b/plugins/woocommerce/tests/metrics/utils.js @@ -1,3 +1,6 @@ +/** + * External dependencies + */ import { existsSync, readFileSync } from 'fs'; export function median( array ) { diff --git a/tools/compare-perf/config.js b/tools/compare-perf/config.js index cd140ca5a2a..a4cc42a3155 100644 --- a/tools/compare-perf/config.js +++ b/tools/compare-perf/config.js @@ -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;