Skip to content

Commit 117bd5f

Browse files
committed
add new conditional test runs helper
1 parent 4b1988d commit 117bd5f

3 files changed

Lines changed: 12 additions & 7 deletions

File tree

tests/helpers/conditional-runs.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
const runningActionsOnInternalRepo = process.env.GITHUB_ACTIONS === 'true' && process.env.GITHUB_REPOSITORY === 'github/docs-internal'
2+
3+
const testViaActionsOnly = runningActionsOnInternalRepo ? test : test.skip
4+
const describeViaActionsOnly = runningActionsOnInternalRepo ? describe : describe.skip
5+
6+
module.exports = {
7+
testViaActionsOnly,
8+
describeViaActionsOnly
9+
}

tests/rendering/server.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
const lodash = require('lodash')
22
const enterpriseServerReleases = require('../../lib/enterprise-server-releases')
33
const { get, getDOM, head } = require('../helpers/supertest')
4+
const { describeViaActionsOnly } = require('../helpers/conditional-runs')
45
const path = require('path')
56
const nonEnterpriseDefaultVersion = require('../../lib/non-enterprise-default-version')
67
const { loadPages } = require('../../lib/pages')
78

8-
const describeInternalOnly = process.env.GITHUB_REPOSITORY === 'github/docs-internal' ? describe : describe.skip
9-
109
describe('server', () => {
1110
jest.setTimeout(60 * 1000)
1211

@@ -358,7 +357,7 @@ describe('server', () => {
358357
})
359358
})
360359

361-
describeInternalOnly('Early Access articles', () => {
360+
describeViaActionsOnly('Early Access articles', () => {
362361
let hiddenPageHrefs, hiddenPages
363362

364363
beforeAll(async (done) => {

tests/unit/early-access.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
const fs = require('fs')
22
const path = require('path')
3-
4-
const { GITHUB_ACTIONS, GITHUB_REPOSITORY } = process.env
5-
const runningActionsOnInternalRepo = GITHUB_ACTIONS === 'true' && GITHUB_REPOSITORY === 'github/docs-internal'
6-
const testViaActionsOnly = runningActionsOnInternalRepo ? test : test.skip
3+
const { testViaActionsOnly } = require('../helpers/conditional-runs')
74

85
describe('cloning early-access', () => {
96
testViaActionsOnly('the content directory exists', async () => {

0 commit comments

Comments
 (0)