add tests
This commit is contained in:
@@ -2303,6 +2303,9 @@ describe("Env integration", function() {
|
|||||||
var env = new jasmineUnderTest.Env(),
|
var env = new jasmineUnderTest.Env(),
|
||||||
reporter = jasmine.createSpyObj('reporter', ['jasmineDone', 'suiteDone', 'specDone']);
|
reporter = jasmine.createSpyObj('reporter', ['jasmineDone', 'suiteDone', 'specDone']);
|
||||||
|
|
||||||
|
// prevent deprecation from being desplayed
|
||||||
|
spyOn(console, "error");
|
||||||
|
|
||||||
reporter.jasmineDone.and.callFake(function(result) {
|
reporter.jasmineDone.and.callFake(function(result) {
|
||||||
expect(result.deprecationWarnings).toEqual([
|
expect(result.deprecationWarnings).toEqual([
|
||||||
jasmine.objectContaining({ message: 'top level deprecation' })
|
jasmine.objectContaining({ message: 'top level deprecation' })
|
||||||
@@ -2341,4 +2344,67 @@ describe("Env integration", function() {
|
|||||||
|
|
||||||
env.execute();
|
env.execute();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should report deprecation stack with an error object', function(done) {
|
||||||
|
var env = new jasmineUnderTest.Env(),
|
||||||
|
exceptionFormatter = new jasmineUnderTest.ExceptionFormatter(),
|
||||||
|
reporter = jasmine.createSpyObj('reporter', ['jasmineDone', 'suiteDone', 'specDone']),
|
||||||
|
topLevelError = new Error('top level deprecation'),
|
||||||
|
suiteLevelError = new Error('suite level deprecation'),
|
||||||
|
specLevelError = new Error('spec level deprecation');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// prevent deprecation from being desplayed
|
||||||
|
spyOn(console, "error");
|
||||||
|
|
||||||
|
reporter.jasmineDone.and.callFake(function(result) {
|
||||||
|
expect(result.deprecationWarnings).toEqual([
|
||||||
|
jasmine.objectContaining({
|
||||||
|
message: topLevelError.message,
|
||||||
|
stack: exceptionFormatter.stack(topLevelError)
|
||||||
|
})
|
||||||
|
]);
|
||||||
|
|
||||||
|
expect(reporter.suiteDone).toHaveBeenCalledWith(jasmine.objectContaining({
|
||||||
|
fullName: 'suite',
|
||||||
|
deprecationWarnings: [
|
||||||
|
jasmine.objectContaining({
|
||||||
|
message: suiteLevelError.message,
|
||||||
|
stack: exceptionFormatter.stack(suiteLevelError)
|
||||||
|
})
|
||||||
|
]
|
||||||
|
}));
|
||||||
|
|
||||||
|
expect(reporter.specDone).toHaveBeenCalledWith(jasmine.objectContaining({
|
||||||
|
fullName: 'suite spec',
|
||||||
|
deprecationWarnings: [
|
||||||
|
jasmine.objectContaining({
|
||||||
|
message: specLevelError.message,
|
||||||
|
stack: exceptionFormatter.stack(specLevelError)
|
||||||
|
})
|
||||||
|
]
|
||||||
|
}));
|
||||||
|
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
env.addReporter(reporter);
|
||||||
|
|
||||||
|
env.deprecated(topLevelError);
|
||||||
|
|
||||||
|
env.describe('suite', function() {
|
||||||
|
env.beforeAll(function() {
|
||||||
|
env.deprecated(suiteLevelError);
|
||||||
|
});
|
||||||
|
|
||||||
|
env.it('spec', function() {
|
||||||
|
env.deprecated(specLevelError);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log(env.topSuite());
|
||||||
|
|
||||||
|
env.execute();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user