Skip to content

Commit 1db3f83

Browse files
committed
Fix flaky tests
When tests run in a GitHub action, env includes the variables: - GITHUB_SHA - GITHUB_REF_NAME
1 parent 7ccb6d4 commit 1db3f83

4 files changed

Lines changed: 11 additions & 0 deletions

File tree

.vscode/settings.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,9 @@
1313
"editor.formatOnType": true,
1414
"editor.formatOnSave": true,
1515
"editor.tabSize": 2,
16+
},
17+
"mochaExplorer.env": {
18+
"GITHUB_SHA": "GITHUB_SHA: this should not interfere with the tests",
19+
"GITHUB_REF_NAME": "GITHUB_REF_NAME: this should not interfere with the tests"
1620
}
1721
}

test/lib/confluence-sdk.test.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ describe('confluence-sdk', () => {
4343
sdk = new ConfluenceSdk(sdkOpts);
4444
sandbox.stub(logger, 'error');
4545
sandbox.replace(config, 'version', '1.0.0');
46+
sandbox.replace(config.github, 'refName', 'branch-name');
47+
sandbox.replace(config.github, 'sha', 'git-hub-sha');
4648
});
4749
afterEach(() => {
4850
sandbox.restore();

test/lib/context.test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ const sandbox = sinon.createSandbox();
1212
describe('context', () => {
1313
beforeEach(() => {
1414
sandbox.replace(config.github, 'refName', 'branch-name');
15+
sandbox.replace(config.github, 'sha', 'git-hub-sha');
1516
sandbox.replace(config, 'version', '1.0.0');
1617
});
1718
afterEach(() => {

test/lib/renderers/page-renderer.test.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ import PageRenderer from '../../../lib/renderers/page-renderer.js';
88
const sandbox = sinon.createSandbox();
99

1010
describe('renderers/page-render', () => {
11+
beforeEach(() => {
12+
sandbox.replace(config.github, 'refName', 'branch-name');
13+
sandbox.replace(config.github, 'sha', 'git-hub-sha');
14+
});
1115
afterEach(() => {
1216
sandbox.restore();
1317
});

0 commit comments

Comments
 (0)