Exclude the project root when ran in GitHub CI

This commit is contained in:
jamelreid 2022-02-16 23:31:04 -05:00
parent 265be6b514
commit c73c2be097
1 changed files with 9 additions and 1 deletions

View File

@ -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/', '' );