Deprecate describes with no children

This commit is contained in:
Steve Gravrock
2020-02-12 16:44:44 -08:00
parent 18b2646d1d
commit c39c110eca
5 changed files with 36 additions and 2 deletions
+14 -1
View File
@@ -141,11 +141,24 @@ describe('Env', function() {
);
expect(function() {
env.describe('fn arg', function() {});
env.describe('fn arg', function() {
env.it('has a spec', function() {});
});
}).not.toThrowError(
'describe expects a function argument; received [object Function]'
);
});
it('logs a deprecation when it has no children', function() {
spyOn(env, 'deprecated');
env.describe('no children', function() {});
expect(env.deprecated).toHaveBeenCalledWith(
'describe with no children' +
' (describe() or it()) is deprecated and will be removed in a future ' +
'version of Jasmine. Please either remove the describe or add ' +
'children to it.'
);
});
});
describe('#it', function() {
+5 -1
View File
@@ -34,7 +34,11 @@ describe('Exceptions:', function() {
});
it('should handle exceptions thrown directly in top-level describe blocks and continue', function(done) {
var secondDescribe = jasmine.createSpy('second describe');
var secondDescribe = jasmine
.createSpy('second describe')
.and.callFake(function() {
env.it('has a test', function() {});
});
env.describe('a suite that throws an exception', function() {
env.it('is a test that should pass', function() {
this.expect(true).toEqual(true);
+3
View File
@@ -1863,6 +1863,7 @@ describe("Env integration", function() {
} catch(e) {
exception = e;
}
env.it('has a test', function() {});
});
var assertions = function() {
@@ -1885,6 +1886,7 @@ describe("Env integration", function() {
} catch(e) {
exception = e;
}
env.it('has a test', function() {});
});
var assertions = function() {
@@ -1907,6 +1909,7 @@ describe("Env integration", function() {
} catch(e) {
exception = e;
}
env.it('has a test', function() {});
});
var assertions = function() {