From 28c0f8aaddb72d05f7a1a2abd13ae9b7de457e4f Mon Sep 17 00:00:00 2001 From: Tonye Jack Date: Wed, 21 Aug 2024 02:59:41 -0600 Subject: [PATCH] chore: conditionally skip certain test for foked prs --- src/__tests__/utils.test.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/__tests__/utils.test.ts b/src/__tests__/utils.test.ts index 15eb0d15102..9e39a950354 100644 --- a/src/__tests__/utils.test.ts +++ b/src/__tests__/utils.test.ts @@ -659,8 +659,11 @@ describe('utils test', () => { }) }) describe('getPreviousGitTag', () => { + // Check if the environment variable GITHUB_REPOSITORY_OWNER is 'tj-actions' + const shouldSkip = process.env.GITHUB_REPOSITORY_OWNER !== 'tj-actions'; + // Function returns the second-latest tag and its SHA - it('should return the second latest tag and its SHA when multiple tags are present', async () => { + (shouldSkip ? test.skip : test)('should return the second latest tag and its SHA when multiple tags are present', async () => { const result = await getPreviousGitTag({ cwd: '.', tagsPattern: '*', @@ -674,7 +677,7 @@ describe('utils test', () => { }) // Tags are filtered by a specified pattern when 'tagsPattern' is provided - it('should filter tags by the specified pattern', async () => { + (shouldSkip ? test.skip : test)('should filter tags by the specified pattern', async () => { const result = await getPreviousGitTag({ cwd: '.', tagsPattern: 'v1.*', @@ -688,7 +691,7 @@ describe('utils test', () => { }) // Tags are excluded by a specified ignore pattern when 'tagsIgnorePattern' is provided - it('should exclude tags by the specified ignore pattern', async () => { + (shouldSkip ? test.skip : test)('should exclude tags by the specified ignore pattern', async () => { const result = await getPreviousGitTag({ cwd: '.', tagsPattern: '*',