From e08d8c4a241756d8597cb17e9a347ed984f9271c Mon Sep 17 00:00:00 2001 From: johnjbarton Date: Tue, 13 Jun 2017 16:42:32 -0700 Subject: [PATCH] Remove incorrect function and its call. The string tested in the function isTopLevelSuite() is not used in jasmine. The correct string would be Jasmine__TopLevel__Suite (two underscores). So the function always returns false, and we negate it at the call site, to the child is always added. That's the correct behavior because we already have a root node matching the Jasmine top level suite. The test and the function is unnecessary. --- src/adapter.js | 12 +----------- test/adapter.spec.js | 17 ----------------- 2 files changed, 1 insertion(+), 28 deletions(-) diff --git a/src/adapter.js b/src/adapter.js index 7dc2dc1..4412042 100644 --- a/src/adapter.js +++ b/src/adapter.js @@ -162,14 +162,6 @@ function KarmaReporter (tc, jasmineEnv) { // because user can mock it var _Date = Date - /** - * @param suite - * @returns {boolean} Return true if it is system jasmine top level suite - */ - function isTopLevelSuite (suite) { - return suite.description === 'Jasmine_TopLevel_Suite' - } - function handleGlobalErrors (result) { if (result.failedExpectations && result.failedExpectations.length) { var message = 'An error was thrown in afterAll' @@ -214,9 +206,7 @@ function KarmaReporter (tc, jasmineEnv) { } this.suiteStarted = function (result) { - if (!isTopLevelSuite(result)) { - currentSuite = currentSuite.addChild(result.description) - } + currentSuite = currentSuite.addChild(result.description) } this.suiteDone = function (result) { diff --git a/test/adapter.spec.js b/test/adapter.spec.js index c8483e9..a14ae0b 100644 --- a/test/adapter.spec.js +++ b/test/adapter.spec.js @@ -233,23 +233,6 @@ describe('jasmine adapter', function () { expect(karma.result).toHaveBeenCalled() }) - it('should remove special top level suite from result', function () { - karma.result.and.callFake(function (result) { - expect(result.suite).toEqual(['Child Suite']) - }) - - reporter.suiteStarted({ - id: 'suite0', - description: 'Jasmine_TopLevel_Suite' - }) - reporter.suiteStarted(suite.result) - spec.result.failedExpectations.push({stack: 'stack'}) - - reporter.specDone(spec.result) - - expect(karma.result).toHaveBeenCalled() - }) - it('should report time for every spec', function () { var counter = 3