From c73c2be09731e395f9fc86fd1ccbde9523c9ec79 Mon Sep 17 00:00:00 2001 From: jamelreid Date: Wed, 16 Feb 2022 23:31:04 -0500 Subject: [PATCH] Exclude the project root when ran in GitHub CI --- packages/js/e2e-environment/utils/test-config.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/js/e2e-environment/utils/test-config.js b/packages/js/e2e-environment/utils/test-config.js index 3cd94888299..b082da56f93 100644 --- a/packages/js/e2e-environment/utils/test-config.js +++ b/packages/js/e2e-environment/utils/test-config.js @@ -101,9 +101,17 @@ const resolvePackagePath = ( filename, packageName = '' ) => { * @return {string} */ const resolveSingleE2EPath = ( filePath, exclude = [ 'woocommerce' ] ) => { - const { SMOKE_TEST_URL } = process.env; + const { SMOKE_TEST_URL, GITHUB_ACTIONS } = process.env; let prunedPath; + // If running in GitHub CI, add the project root to the exclude array + // This is done because the project root is always duplicated in GitHub CI + if ( GITHUB_ACTIONS ) { + const appPathArray = appPath.split( '/' ); + const projectRoot = appPathArray[ appPathArray.length - 2 ]; + exclude.push( projectRoot ); + } + // Removes 'plugins/woocommerce/' from path only for tests against a smoke test site. if ( SMOKE_TEST_URL ) { prunedPath = filePath.replace( 'plugins/woocommerce/', '' );