Renamed the trace feature to debugLog[s]
"trace" was ambiguous and could easily be understood to have something to do with stack traces.
This commit is contained in:
+14
-12
@@ -234,7 +234,7 @@ describe('Spec', function() {
|
||||
pendingReason: '',
|
||||
duration: jasmine.any(Number),
|
||||
properties: null,
|
||||
trace: null
|
||||
debugLogs: null
|
||||
},
|
||||
'things'
|
||||
);
|
||||
@@ -562,13 +562,15 @@ describe('Spec', function() {
|
||||
t2 = 456;
|
||||
|
||||
spec.execute();
|
||||
expect(spec.result.trace).toBeNull();
|
||||
expect(spec.result.debugLogs).toBeNull();
|
||||
timer.elapsed.and.returnValue(t1);
|
||||
spec.trace('msg 1');
|
||||
expect(spec.result.trace).toEqual([{ message: 'msg 1', timestamp: t1 }]);
|
||||
spec.debugLog('msg 1');
|
||||
expect(spec.result.debugLogs).toEqual([
|
||||
{ message: 'msg 1', timestamp: t1 }
|
||||
]);
|
||||
timer.elapsed.and.returnValue(t2);
|
||||
spec.trace('msg 2');
|
||||
expect(spec.result.trace).toEqual([
|
||||
spec.debugLog('msg 2');
|
||||
expect(spec.result.debugLogs).toEqual([
|
||||
{ message: 'msg 1', timestamp: t1 },
|
||||
{ message: 'msg 2', timestamp: t2 }
|
||||
]);
|
||||
@@ -583,7 +585,7 @@ describe('Spec', function() {
|
||||
},
|
||||
resultCallback: resultCallback,
|
||||
queueRunnerFactory: function(config) {
|
||||
spec.trace('msg');
|
||||
spec.debugLog('msg');
|
||||
for (const fn of config.queueableFns) {
|
||||
fn.fn();
|
||||
}
|
||||
@@ -593,7 +595,7 @@ describe('Spec', function() {
|
||||
|
||||
spec.execute(function() {});
|
||||
expect(resultCallback).toHaveBeenCalledWith(
|
||||
jasmine.objectContaining({ trace: null }),
|
||||
jasmine.objectContaining({ debugLogs: null }),
|
||||
undefined
|
||||
);
|
||||
});
|
||||
@@ -606,7 +608,7 @@ describe('Spec', function() {
|
||||
},
|
||||
resultCallback: resultCallback,
|
||||
queueRunnerFactory: function(config) {
|
||||
spec.trace('msg');
|
||||
spec.debugLog('msg');
|
||||
for (const fn of config.queueableFns) {
|
||||
fn.fn();
|
||||
}
|
||||
@@ -616,7 +618,7 @@ describe('Spec', function() {
|
||||
|
||||
spec.execute(function() {});
|
||||
expect(resultCallback).toHaveBeenCalled();
|
||||
expect(spec.result.trace).toBeNull();
|
||||
expect(spec.result.debugLogs).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -630,7 +632,7 @@ describe('Spec', function() {
|
||||
},
|
||||
resultCallback: resultCallback,
|
||||
queueRunnerFactory: function(config) {
|
||||
spec.trace('msg');
|
||||
spec.debugLog('msg');
|
||||
spec.onException(new Error('nope'));
|
||||
for (const fn of config.queueableFns) {
|
||||
fn.fn();
|
||||
@@ -646,7 +648,7 @@ describe('Spec', function() {
|
||||
spec.execute(function() {});
|
||||
expect(resultCallback).toHaveBeenCalledWith(
|
||||
jasmine.objectContaining({
|
||||
trace: [{ message: 'msg', timestamp: timestamp }]
|
||||
debugLogs: [{ message: 'msg', timestamp: timestamp }]
|
||||
}),
|
||||
undefined
|
||||
);
|
||||
|
||||
@@ -199,11 +199,13 @@ describe('base helpers', function() {
|
||||
});
|
||||
});
|
||||
|
||||
describe('trace', function() {
|
||||
it("forwards to the current env's trace function", function() {
|
||||
spyOn(jasmineUnderTest.getEnv(), 'trace');
|
||||
jasmineUnderTest.trace('a message');
|
||||
expect(jasmineUnderTest.getEnv().trace).toHaveBeenCalledWith('a message');
|
||||
describe('debugLog', function() {
|
||||
it("forwards to the current env's debugLog function", function() {
|
||||
spyOn(jasmineUnderTest.getEnv(), 'debugLog');
|
||||
jasmineUnderTest.debugLog('a message');
|
||||
expect(jasmineUnderTest.getEnv().debugLog).toHaveBeenCalledWith(
|
||||
'a message'
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -3335,7 +3335,7 @@ describe('Env integration', function() {
|
||||
});
|
||||
});
|
||||
|
||||
it('sends traces to the reporter when the spec fails', function(done) {
|
||||
it('sends debug logs to the reporter when the spec fails', function(done) {
|
||||
var reporter = jasmine.createSpyObj('reporter', ['specDone']),
|
||||
startTime,
|
||||
endTime;
|
||||
@@ -3345,14 +3345,14 @@ describe('Env integration', function() {
|
||||
|
||||
env.it('fails', function() {
|
||||
startTime = new Date().getTime();
|
||||
env.trace('message 1');
|
||||
env.trace('message 2');
|
||||
env.debugLog('message 1');
|
||||
env.debugLog('message 2');
|
||||
env.expect(1).toBe(2);
|
||||
endTime = new Date().getTime();
|
||||
});
|
||||
|
||||
env.it('passes', function() {
|
||||
env.trace('message that should not be reported');
|
||||
env.debugLog('message that should not be reported');
|
||||
});
|
||||
|
||||
env.execute(null, function() {
|
||||
@@ -3373,7 +3373,7 @@ describe('Env integration', function() {
|
||||
duration = reporter.specDone.calls.argsFor(0)[0].duration;
|
||||
expect(reporter.specDone.calls.argsFor(0)[0]).toEqual(
|
||||
jasmine.objectContaining({
|
||||
trace: [
|
||||
debugLogs: [
|
||||
{
|
||||
timestamp: numberInRange(0, duration),
|
||||
message: 'message 1'
|
||||
@@ -3385,17 +3385,17 @@ describe('Env integration', function() {
|
||||
]
|
||||
})
|
||||
);
|
||||
expect(reporter.specDone.calls.argsFor(1)[0].trace).toBeFalsy();
|
||||
expect(reporter.specDone.calls.argsFor(1)[0].debugLogs).toBeFalsy();
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('reports an error when trace is used when a spec is not running', function(done) {
|
||||
it('reports an error when debugLog is used when a spec is not running', function(done) {
|
||||
var reporter = jasmine.createSpyObj('reporter', ['suiteDone']);
|
||||
|
||||
env.describe('a suite', function() {
|
||||
env.beforeAll(function() {
|
||||
env.trace('a message');
|
||||
env.debugLog('a message');
|
||||
});
|
||||
|
||||
env.it('a spec', function() {});
|
||||
@@ -3408,7 +3408,7 @@ describe('Env integration', function() {
|
||||
failedExpectations: [
|
||||
jasmine.objectContaining({
|
||||
message: jasmine.stringContaining(
|
||||
"'trace' was called when there was no current spec"
|
||||
"'debugLog' was called when there was no current spec"
|
||||
)
|
||||
})
|
||||
]
|
||||
|
||||
@@ -1510,7 +1510,7 @@ describe('HtmlReporter', function() {
|
||||
}
|
||||
]
|
||||
};
|
||||
var failingSpecResultWithTrace = {
|
||||
var failingSpecResultWithDebugLogs = {
|
||||
id: 567,
|
||||
status: 'failed',
|
||||
description: 'a failing spec',
|
||||
@@ -1522,7 +1522,7 @@ describe('HtmlReporter', function() {
|
||||
stack: 'a stack trace'
|
||||
}
|
||||
],
|
||||
trace: [
|
||||
debugLogs: [
|
||||
{ timestamp: 123, message: 'msg 1' },
|
||||
{ timestamp: 456, message: 'msg 1' }
|
||||
]
|
||||
@@ -1544,8 +1544,8 @@ describe('HtmlReporter', function() {
|
||||
reporter.suiteDone(passingSuiteResult);
|
||||
reporter.suiteDone(failingSuiteResult);
|
||||
reporter.suiteDone(passingSuiteResult);
|
||||
reporter.specStarted(failingSpecResultWithTrace);
|
||||
reporter.specDone(failingSpecResultWithTrace);
|
||||
reporter.specStarted(failingSpecResultWithDebugLogs);
|
||||
reporter.specDone(failingSpecResultWithDebugLogs);
|
||||
reporter.jasmineDone({});
|
||||
});
|
||||
|
||||
@@ -1602,11 +1602,11 @@ describe('HtmlReporter', function() {
|
||||
var specFailure = container.querySelectorAll(
|
||||
'.jasmine-spec-detail.jasmine-failed'
|
||||
)[2],
|
||||
trace = specFailure.querySelector('.jasmine-trace table'),
|
||||
debugLogs = specFailure.querySelector('.jasmine-debug-log table'),
|
||||
rows;
|
||||
|
||||
expect(trace).toBeTruthy();
|
||||
rows = trace.querySelectorAll('tbody tr');
|
||||
expect(debugLogs).toBeTruthy();
|
||||
rows = debugLogs.querySelectorAll('tbody tr');
|
||||
expect(rows.length).toEqual(2);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user