Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Commit 46453be

Browse files
committed
Diagnose tests failing only in CI
1 parent 0781b23 commit 46453be

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

lib/controllers/reviews-controller.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,15 +292,19 @@ export class BareReviewsController extends React.Component {
292292
addSingleComment = async (commentBody, threadID, replyToID, commentPath, position, callbacks = {}) => {
293293
let pendingReviewID = null;
294294
try {
295+
console.log(`setting state: postingToThreadID=${threadID}`);
295296
this.setState({postingToThreadID: threadID});
296297

298+
console.log('calling addReviewMutation');
297299
const reviewResult = await addReviewMutation(this.props.relay.environment, {
298300
pullRequestID: this.props.pullRequest.id,
299301
viewerID: this.props.viewer.id,
300302
});
301303
const reviewID = reviewResult.addPullRequestReview.reviewEdge.node.id;
302304
pendingReviewID = reviewID;
305+
console.log(`addReviewMutation returned: reviewID=${reviewID} pendingReviewID=${pendingReviewID}`);
303306

307+
console.log('calling addReviewCommentMutation');
304308
const commentPromise = addReviewCommentMutation(this.props.relay.environment, {
305309
body: commentBody,
306310
inReplyTo: replyToID,
@@ -310,28 +314,36 @@ export class BareReviewsController extends React.Component {
310314
path: commentPath,
311315
position,
312316
});
317+
console.log('firing didSubmitComment callback');
313318
if (callbacks.didSubmitComment) {
314319
callbacks.didSubmitComment();
315320
}
321+
console.log('awaiting comment promise');
316322
await commentPromise;
323+
console.log('comment promise resolved successfully');
317324
pendingReviewID = null;
318325

326+
console.log('calling submitReviewMutation');
319327
await submitReviewMutation(this.props.relay.environment, {
320328
event: 'COMMENT',
321329
reviewID,
322330
});
331+
console.log('submitReviewMutation resolved successfully');
323332
addEvent('add-single-comment', {package: 'github'});
324333
} catch (error) {
334+
console.log(`Caught an error: ${error.stack}`);
325335
if (callbacks.didFailComment) {
326336
callbacks.didFailComment();
327337
}
328338

329339
if (pendingReviewID !== null) {
330340
try {
341+
console.log('Calling deleteReviewMutation');
331342
await deleteReviewMutation(this.props.relay.environment, {
332343
reviewID: pendingReviewID,
333344
pullRequestID: this.props.pullRequest.id,
334345
});
346+
console.log('deleteReviewMutation completed');
335347
} catch (e) {
336348
/* istanbul ignore else */
337349
if (error.errors && e.errors) {

test/controllers/reviews-controller.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ describe('ReviewsController', function() {
291291
});
292292

293293
describe('adding a single comment', function() {
294-
it('creates a review, attaches the comment, and submits it', async function() {
294+
it.only('creates a review, attaches the comment, and submits it', async function() {
295295
expectRelayQuery({
296296
name: addPrReviewMutation.operation.name,
297297
variables: {
@@ -347,7 +347,7 @@ describe('ReviewsController', function() {
347347
assert.isFalse(didFailComment.called);
348348
});
349349

350-
it('creates a notification when the review cannot be created', async function() {
350+
it.only('creates a notification when the review cannot be created', async function() {
351351
const reportRelayError = sinon.spy();
352352

353353
expectRelayQuery({
@@ -378,7 +378,7 @@ describe('ReviewsController', function() {
378378
assert.isTrue(didFailComment.called);
379379
});
380380

381-
it('creates a notification and deletes the review when the comment cannot be added', async function() {
381+
it.only('creates a notification and deletes the review when the comment cannot be added', async function() {
382382
const reportRelayError = sinon.spy();
383383

384384
expectRelayQuery({

0 commit comments

Comments
 (0)