Skip to content

Commit e983b41

Browse files
authored
pr_checker: consider LITE CI as a ci requirement
Fixes: #225
1 parent 8c6f7cc commit e983b41

File tree

4 files changed

+39
-3
lines changed

4 files changed

+39
-3
lines changed

lib/pr_checker.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const {
1919

2020
const CIParser = require('./ci');
2121
const CI_TYPES = CIParser.TYPES;
22-
const { FULL } = CIParser.constants;
22+
const { FULL, LITE } = CIParser.constants;
2323

2424
class PRChecker {
2525
/**
@@ -203,9 +203,9 @@ class PRChecker {
203203
cli.error('No CI runs detected');
204204
this.CIStatus = false;
205205
return false;
206-
} else if (!ciMap.get(FULL)) {
206+
} else if (!ciMap.get(FULL) && !ciMap.get(LITE)) {
207207
status = false;
208-
cli.error('No full CI runs detected');
208+
cli.error('No full CI runs or lite CI runs detected');
209209
}
210210

211211
let lastCI;
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[
2+
{
3+
"publishedAt": "2018-02-09T21:38:30Z",
4+
"bodyText": "CI: https://ci.nodejs.org/job/node-test-commit-lite/246/"
5+
}
6+
]

test/fixtures/data.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ const requestedChangesReviewers = {
2323
const approvingReviews = readJSON('reviews_approved.json');
2424
const requestingChangesReviews = readJSON('reviews_requesting_changes.json');
2525

26+
const commentsWithLiteCI = readJSON('comments_with_lite_ci.json');
2627
const commentsWithCI = readJSON('comments_with_ci.json');
2728
const commentsWithLGTM = readJSON('comments_with_lgtm.json');
2829

@@ -79,6 +80,7 @@ module.exports = {
7980
approvingReviews,
8081
requestingChangesReviews,
8182
commentsWithCI,
83+
commentsWithLiteCI,
8284
commentsWithLGTM,
8385
oddCommits,
8486
incorrectGitConfigCommits,

test/unit/pr_checker.test.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ const {
1313
approvingReviews,
1414
requestingChangesReviews,
1515
commentsWithCI,
16+
commentsWithLiteCI,
1617
commentsWithLGTM,
1718
singleCommitAfterReview,
1819
multipleCommitsAfterReview,
@@ -548,6 +549,33 @@ describe('PRChecker', () => {
548549
assert(!status);
549550
cli.assertCalledWith(expectedLogs);
550551
});
552+
553+
it('should count LITE CI as valid ci requirement', () => {
554+
const cli = new TestCLI();
555+
556+
const expectedLogs = {
557+
info: [
558+
[
559+
'Last Lite CI on 2018-02-09T21:38:30Z: ' +
560+
'https://ci.nodejs.org/job/node-test-commit-lite/246/'
561+
]
562+
]
563+
};
564+
565+
const checker = new PRChecker(cli, {
566+
pr: firstTimerPR,
567+
reviewers: allGreenReviewers,
568+
comments: commentsWithLiteCI,
569+
reviews: approvingReviews,
570+
commits: [],
571+
collaborators,
572+
authorIsNew: () => true
573+
}, { maxCommits: 0 });
574+
575+
const status = checker.checkCI();
576+
assert(status);
577+
cli.assertCalledWith(expectedLogs);
578+
});
551579
});
552580

553581
describe('checkAuthor', () => {

0 commit comments

Comments
 (0)