Skip to content

Commit 48560bf

Browse files
capajcpojer
authored andcommitted
fixes #5531 (#5532)
because we can have a "describe" block but no "it" blocks inside
1 parent 3f59552 commit 48560bf

2 files changed

Lines changed: 28 additions & 1 deletion

File tree

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/**
2+
* Copyright (c) 2015-present, Facebook, Inc. All rights reserved.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*
7+
*/
8+
9+
'use strict';
10+
11+
import Suite from '../jasmine/Suite';
12+
13+
describe('Suite', () => {
14+
let suite;
15+
16+
beforeEach(() => {
17+
suite = new Suite({
18+
getTestPath: () => '',
19+
});
20+
});
21+
22+
it("doesn't throw on addExpectationResult when there are no children", () => {
23+
expect(() => {
24+
suite.addExpectationResult();
25+
}).not.toThrow();
26+
});
27+
});

packages/jest-jasmine2/src/jasmine/Suite.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ function convertDescriptorToString(descriptor) {
210210
}
211211

212212
function isAfterAll(children) {
213-
return children && children[0].result.status;
213+
return children && children[0] && children[0].result.status;
214214
}
215215

216216
function isFailure(args) {

0 commit comments

Comments
 (0)