From af41e5ea5c9d644a33802db85056781df52b77c1 Mon Sep 17 00:00:00 2001 From: Gregg Van Hove Date: Wed, 9 Aug 2017 11:43:55 -0700 Subject: [PATCH] Properly wait until test env has completed before moving on. --- spec/core/integration/EnvSpec.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/spec/core/integration/EnvSpec.js b/spec/core/integration/EnvSpec.js index ccbde18e..1d2878a5 100644 --- a/spec/core/integration/EnvSpec.js +++ b/spec/core/integration/EnvSpec.js @@ -928,7 +928,14 @@ describe("Env integration", function() { }); it("should run async specs in order, waiting for them to complete", function(done) { - var env = new jasmineUnderTest.Env(), mutatedVar; + var env = new jasmineUnderTest.Env(), + reporter = jasmine.createSpyObj('reporter', ['jasmineDone']), + mutatedVar; + + reporter.jasmineDone.and.callFake(function() { + done(); + }); + env.addReporter(reporter); env.describe("tests", function() { env.beforeEach(function() { @@ -939,7 +946,6 @@ describe("Env integration", function() { setTimeout(function() { expect(mutatedVar).toEqual(2); underTestCallback(); - done(); }, 0); });