Add ability to report deprecation warnings from within the suite

[#154746527]
This commit is contained in:
Gregg Van Hove
2018-02-05 11:19:15 -08:00
parent 70bce55721
commit 5afe1222f4
6 changed files with 101 additions and 4 deletions

View File

@@ -2004,4 +2004,56 @@ describe("Env integration", function() {
env.execute();
});
it('should report deprecation warnings on the correct specs and suites', function(done) {
var env = new jasmineUnderTest.Env(),
reporter = jasmine.createSpyObj('reporter', ['jasmineDone', 'suiteDone', 'specDone']);
reporter.jasmineDone.and.callFake(function(result) {
expect(result.deprecationWarnings).toEqual([
jasmine.objectContaining({
message: 'top level deprecation',
stack: jasmine.any(String)
})
]);
expect(reporter.suiteDone).toHaveBeenCalledWith(jasmine.objectContaining({
fullName: 'suite',
deprecationWarnings: [
jasmine.objectContaining({
message: 'suite level deprecation',
stack: jasmine.any(String)
})
]
}));
expect(reporter.specDone).toHaveBeenCalledWith(jasmine.objectContaining({
fullName: 'suite spec',
deprecationWarnings: [
jasmine.objectContaining({
message: 'spec level deprecation',
stack: jasmine.any(String)
})
]
}));
done();
});
env.addReporter(reporter);
env.deprecated('top level deprecation');
env.describe('suite', function() {
env.beforeAll(function() {
env.deprecated('suite level deprecation');
});
env.it('spec', function() {
env.deprecated('spec level deprecation');
});
});
env.execute();
});
});