From 8382731a573423d534a0d3d97c80d3d82e6f34e7 Mon Sep 17 00:00:00 2001 From: Vladimir Reznichenko Date: Fri, 28 Jun 2024 13:50:01 +0200 Subject: [PATCH] Testing: fix metrics job on push to trunk (#48893) This PR fixes a failure in CI jobs (performance testing results publishing). The fix introduces a fallback path for the artifacts folder, similar to the command that performs the testing. --- tools/compare-perf/log-to-codevitals.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/tools/compare-perf/log-to-codevitals.js b/tools/compare-perf/log-to-codevitals.js index 5b4c2459062..58a53f75c82 100644 --- a/tools/compare-perf/log-to-codevitals.js +++ b/tools/compare-perf/log-to-codevitals.js @@ -15,14 +15,11 @@ const resultsFiles = [ metricsPrefix: 'product-editor-', }, ]; +const ARTIFACTS_PATH = + process.env.WP_ARTIFACTS_PATH || path.join( process.cwd(), 'artifacts' ); const performanceResults = resultsFiles.map( ( { file } ) => - JSON.parse( - fs.readFileSync( - path.join( process.env.WP_ARTIFACTS_PATH, file ), - 'utf8' - ) - ) + JSON.parse( fs.readFileSync( path.join( ARTIFACTS_PATH, file ), 'utf8' ) ) ); const data = new TextEncoder().encode(