diff --git a/tests/helpers/conditional-runs.js b/tests/helpers/conditional-runs.js new file mode 100644 index 0000000000..ebbc5e7657 --- /dev/null +++ b/tests/helpers/conditional-runs.js @@ -0,0 +1,9 @@ +const runningActionsOnInternalRepo = process.env.GITHUB_ACTIONS === 'true' && process.env.GITHUB_REPOSITORY === 'github/docs-internal' + +const testViaActionsOnly = runningActionsOnInternalRepo ? test : test.skip +const describeViaActionsOnly = runningActionsOnInternalRepo ? describe : describe.skip + +module.exports = { + testViaActionsOnly, + describeViaActionsOnly +} \ No newline at end of file diff --git a/tests/rendering/server.js b/tests/rendering/server.js index 063b76c634..cb13cba6a5 100644 --- a/tests/rendering/server.js +++ b/tests/rendering/server.js @@ -1,12 +1,11 @@ const lodash = require('lodash') const enterpriseServerReleases = require('../../lib/enterprise-server-releases') const { get, getDOM, head } = require('../helpers/supertest') +const { describeViaActionsOnly } = require('../helpers/conditional-runs') const path = require('path') const nonEnterpriseDefaultVersion = require('../../lib/non-enterprise-default-version') const { loadPages } = require('../../lib/pages') -const describeInternalOnly = process.env.GITHUB_REPOSITORY === 'github/docs-internal' ? describe : describe.skip - describe('server', () => { jest.setTimeout(60 * 1000) @@ -358,7 +357,7 @@ describe('server', () => { }) }) - describeInternalOnly('Early Access articles', () => { + describeViaActionsOnly('Early Access articles', () => { let hiddenPageHrefs, hiddenPages beforeAll(async (done) => { diff --git a/tests/unit/early-access.js b/tests/unit/early-access.js index f8ad0b3b88..82e2f4cbd4 100644 --- a/tests/unit/early-access.js +++ b/tests/unit/early-access.js @@ -1,9 +1,6 @@ const fs = require('fs') const path = require('path') - -const { GITHUB_ACTIONS, GITHUB_REPOSITORY } = process.env -const runningActionsOnInternalRepo = GITHUB_ACTIONS === 'true' && GITHUB_REPOSITORY === 'github/docs-internal' -const testViaActionsOnly = runningActionsOnInternalRepo ? test : test.skip +const { testViaActionsOnly } = require('../helpers/conditional-runs') describe('cloning early-access', () => { testViaActionsOnly('the content directory exists', async () => {