Skip to content

Commit

Permalink
fixes #5531 (#5532)
Browse files Browse the repository at this point in the history
because we can have a "describe" block but no "it" blocks inside
  • Loading branch information
capaj authored and cpojer committed Feb 28, 2018
1 parent 3f59552 commit 48560bf
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
27 changes: 27 additions & 0 deletions packages/jest-jasmine2/src/__tests__/Suite.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/**
* Copyright (c) 2015-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/

'use strict';

import Suite from '../jasmine/Suite';

describe('Suite', () => {
let suite;

beforeEach(() => {
suite = new Suite({
getTestPath: () => '',
});
});

it("doesn't throw on addExpectationResult when there are no children", () => {
expect(() => {
suite.addExpectationResult();
}).not.toThrow();
});
});
2 changes: 1 addition & 1 deletion packages/jest-jasmine2/src/jasmine/Suite.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ function convertDescriptorToString(descriptor) {
}

function isAfterAll(children) {
return children && children[0].result.status;
return children && children[0] && children[0].result.status;
}

function isFailure(args) {
Expand Down

0 comments on commit 48560bf

Please sign in to comment.