Skip to content

Commit f73f5f1

Browse files
committed
fix: integration tests gets stuck waithing for nothing after test run complete due to pending timers
1 parent 43724c4 commit f73f5f1

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"test": "npm run test:unit && npm run test:integ",
2323
"test:unit": "APP_CONFIG=./test/unit/utils/.app.json mocha test/unit/*.spec.js test/unit/**/*.spec.js test/unit/**/*.spec.js test/unit/**/**/*.spec.js --timeout=3000",
2424
"setupIntegTestConfig": "node ./test/integration/setupTestConfig.js",
25-
"test:integ": "npm run setupIntegTestConfig && APP_CONFIG=./src/testConfig.json mocha test/integration/*.spec.js test/integration/**/*.spec.js --timeout=3000",
25+
"test:integ": "npm run setupIntegTestConfig && TEST_ENV=integ APP_CONFIG=./src/testConfig.json mocha test/integration/*.spec.js test/integration/**/*.spec.js --timeout=3000",
2626
"printReportsLink": "echo Detailed unit test coverage report: file:///$(pwd)/coverage-unit/index.html && echo Detailed integration test coverage report: file:///$(pwd)/coverage-integration/index.html",
2727
"cover": "npm run cover:unit",
2828
"cover:unit": "c8 -c .nycrc.unit.json npm run test:unit && npm run --silent printReportsLink",

src/github.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ function _resetGithubOpsIssue() {
2222
githubOpsIssueForTheDay = null;
2323
}
2424
export function setupGitHubOpsMonitoring() {
25+
if(process.env.TEST_ENV){
26+
console.log("test environment detected, disabling setupGitHubOpsMonitoring flow");
27+
return;
28+
}
2529
setInterval(_resetTPH, ONE_HOUR);
2630
setInterval(_resetGithubOpsIssue, ONE_DAY);
2731
}

src/utils/sync.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,10 @@ export async function _syncPopularityEvery15Minutes() { // exported for unit tes
196196
// not testing this as no time and is manually tested. If you are touching this code, manual test thoroughly
197197
let worker;
198198
export function startCollectStarsWorker() {
199+
if(process.env.TEST_ENV){
200+
console.log("test environment detected, disabling startCollectStarsWorker flow");
201+
return;
202+
}
199203
if(worker){
200204
return;
201205
}

0 commit comments

Comments
 (0)