diff --git a/lib/jasmine-core/jasmine.js b/lib/jasmine-core/jasmine.js index d7ce7df9..fc540e76 100644 --- a/lib/jasmine-core/jasmine.js +++ b/lib/jasmine-core/jasmine.js @@ -793,6 +793,9 @@ getJasmineRequireObj().Env = function(j$) { this.describe = function(description, specDefinitions) { var suite = suiteFactory(description); + if (specDefinitions.length > 0) { + throw new Error('describe does not expect a done parameter'); + } if (currentDeclarationSuite.markedPending) { suite.pend(); } diff --git a/spec/core/EnvSpec.js b/spec/core/EnvSpec.js index 3f0ecd02..8cffd067 100644 --- a/spec/core/EnvSpec.js +++ b/spec/core/EnvSpec.js @@ -26,6 +26,15 @@ describe("Env", function() { }); }); + describe('#describe', function () { + var spec = function(done){}; + it("throws the error", function() { + expect(function() { + env.describe('done method', spec); + }).toThrow(new Error('describe does not expect a done parameter')); + }); + }); + it('can configure specs to throw errors on expectation failures', function() { env.throwOnExpectationFailure(true); diff --git a/src/core/Env.js b/src/core/Env.js index b70b0a06..9b90335c 100644 --- a/src/core/Env.js +++ b/src/core/Env.js @@ -291,6 +291,9 @@ getJasmineRequireObj().Env = function(j$) { this.describe = function(description, specDefinitions) { var suite = suiteFactory(description); + if (specDefinitions.length > 0) { + throw new Error('describe does not expect a done parameter'); + } if (currentDeclarationSuite.markedPending) { suite.pend(); }