diff --git a/packages/artifact/__tests__/config.test.ts b/packages/artifact/__tests__/config.test.ts index 3822db18..a312d642 100644 --- a/packages/artifact/__tests__/config.test.ts +++ b/packages/artifact/__tests__/config.test.ts @@ -1,25 +1,22 @@ import * as config from '../src/internal/shared/config' - beforeEach(() => { - jest.resetModules() - }); - + jest.resetModules() +}) describe('isGhes', () => { - it('should return false when the request domain is github.com', () => { - process.env.GITHUB_SERVER_URL = 'https://github.com' - expect(config.isGhes()).toBe(false) - }) + it('should return false when the request domain is github.com', () => { + process.env.GITHUB_SERVER_URL = 'https://github.com' + expect(config.isGhes()).toBe(false) + }) - it('should return false when the request has ACTIONS_RESULTS_URL set', () => { - process.env.ACTIONS_RESULTS_URL = 'my.results.url' - expect(config.isGhes()).toBe(false) - }) + it('should return false when the request has ACTIONS_RESULTS_URL set', () => { + process.env.ACTIONS_RESULTS_URL = 'my.results.url' + expect(config.isGhes()).toBe(false) + }) - - it('should return false when the request domain is specific to an enterprise', () => { - process.env.GITHUB_SERVER_URL = 'https://my-enterprise.github.com' - expect(config.isGhes()).toBe(true) - }) -}) \ No newline at end of file + it('should return false when the request domain is specific to an enterprise', () => { + process.env.GITHUB_SERVER_URL = 'https://my-enterprise.github.com' + expect(config.isGhes()).toBe(true) + }) +}) diff --git a/packages/artifact/src/internal/shared/config.ts b/packages/artifact/src/internal/shared/config.ts index 8ab4dc20..c8bef2ef 100644 --- a/packages/artifact/src/internal/shared/config.ts +++ b/packages/artifact/src/internal/shared/config.ts @@ -27,10 +27,11 @@ export function isGhes(): boolean { const ghUrl = new URL( process.env['GITHUB_SERVER_URL'] || 'https://github.com' ) - - const isGitHubHost = (ghUrl.hostname.trimEnd().toUpperCase() === 'GITHUB.COM') - const isResultsServiceRequest = process.env['ACTIONS_RESULTS_URL'] != undefined - + + const isGitHubHost = ghUrl.hostname.trimEnd().toUpperCase() === 'GITHUB.COM' + const isResultsServiceRequest = + process.env['ACTIONS_RESULTS_URL'] != undefined + return !isGitHubHost && !isResultsServiceRequest } diff --git a/packages/cache/__tests__/cacheUtils.test.ts b/packages/cache/__tests__/cacheUtils.test.ts index fb96ab58..1e4849ed 100644 --- a/packages/cache/__tests__/cacheUtils.test.ts +++ b/packages/cache/__tests__/cacheUtils.test.ts @@ -3,8 +3,8 @@ import * as path from 'path' import * as cacheUtils from '../src/internal/cacheUtils' beforeEach(() => { - jest.resetModules() -}); + jest.resetModules() +}) test('getArchiveFileSizeInBytes returns file size', () => { const filePath = path.join(__dirname, '__fixtures__', 'helloWorld.txt') diff --git a/packages/cache/src/internal/cacheUtils.ts b/packages/cache/src/internal/cacheUtils.ts index 64b7dfcf..9c1035a9 100644 --- a/packages/cache/src/internal/cacheUtils.ts +++ b/packages/cache/src/internal/cacheUtils.ts @@ -129,4 +129,4 @@ export function isGhes(): boolean { process.env['GITHUB_SERVER_URL'] || 'https://github.com' ) return ghUrl.hostname.toUpperCase() !== 'GITHUB.COM' -} \ No newline at end of file +}