Converted ReportDispatcher to promises
This commit is contained in:
@@ -1843,12 +1843,12 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
function specStarted(spec, suite, next) {
|
function specStarted(spec, suite, next) {
|
||||||
runner.currentSpec = spec;
|
runner.currentSpec = spec;
|
||||||
runableResources.initForRunable(spec.id, suite.id);
|
runableResources.initForRunable(spec.id, suite.id);
|
||||||
reporter.specStarted(spec.result, next);
|
reporter.specStarted(spec.result).then(next);
|
||||||
}
|
}
|
||||||
|
|
||||||
function reportSpecDone(spec, result, next) {
|
function reportSpecDone(spec, result, next) {
|
||||||
spec.reportedDone = true;
|
spec.reportedDone = true;
|
||||||
reporter.specDone(result, next);
|
reporter.specDone(result).then(next);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.it = function(description, fn, timeout) {
|
this.it = function(description, fn, timeout) {
|
||||||
@@ -7700,7 +7700,7 @@ getJasmineRequireObj().ReportDispatcher = function(j$) {
|
|||||||
for (const method of dispatchedMethods) {
|
for (const method of dispatchedMethods) {
|
||||||
this[method] = (function(m) {
|
this[method] = (function(m) {
|
||||||
return function() {
|
return function() {
|
||||||
dispatch(m, arguments);
|
return dispatch(m, arguments);
|
||||||
};
|
};
|
||||||
})(method);
|
})(method);
|
||||||
}
|
}
|
||||||
@@ -7726,25 +7726,25 @@ getJasmineRequireObj().ReportDispatcher = function(j$) {
|
|||||||
if (reporters.length === 0 && fallbackReporter !== null) {
|
if (reporters.length === 0 && fallbackReporter !== null) {
|
||||||
reporters.push(fallbackReporter);
|
reporters.push(fallbackReporter);
|
||||||
}
|
}
|
||||||
const onComplete = args[args.length - 1];
|
|
||||||
args = Array.from(args).splice(0, args.length - 1);
|
|
||||||
const fns = [];
|
const fns = [];
|
||||||
for (const reporter of reporters) {
|
for (const reporter of reporters) {
|
||||||
addFn(fns, reporter, method, args);
|
addFn(fns, reporter, method, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
queueRunnerFactory({
|
return new Promise(function(resolve) {
|
||||||
queueableFns: fns,
|
queueRunnerFactory({
|
||||||
onComplete: onComplete,
|
queueableFns: fns,
|
||||||
isReporter: true,
|
onComplete: resolve,
|
||||||
onMultipleDone: function() {
|
isReporter: true,
|
||||||
onLateError(
|
onMultipleDone: function() {
|
||||||
new Error(
|
onLateError(
|
||||||
"An asynchronous reporter callback called its 'done' callback " +
|
new Error(
|
||||||
'more than once.'
|
"An asynchronous reporter callback called its 'done' callback " +
|
||||||
)
|
'more than once.'
|
||||||
);
|
)
|
||||||
}
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -8400,7 +8400,6 @@ getJasmineRequireObj().Runner = function(j$) {
|
|||||||
this.executedBefore_ = true;
|
this.executedBefore_ = true;
|
||||||
|
|
||||||
this.hasFailures = false;
|
this.hasFailures = false;
|
||||||
const totalSpecsDefined = this.totalSpecsDefined_();
|
|
||||||
const focusedRunables = this.focusedRunables_();
|
const focusedRunables = this.focusedRunables_();
|
||||||
const config = this.getConfig_();
|
const config = this.getConfig_();
|
||||||
|
|
||||||
@@ -8439,7 +8438,7 @@ getJasmineRequireObj().Runner = function(j$) {
|
|||||||
nodeStart: (suite, next) => {
|
nodeStart: (suite, next) => {
|
||||||
this.currentlyExecutingSuites_.push(suite);
|
this.currentlyExecutingSuites_.push(suite);
|
||||||
this.runableResources_.initForRunable(suite.id, suite.parentSuite.id);
|
this.runableResources_.initForRunable(suite.id, suite.parentSuite.id);
|
||||||
this.reporter_.suiteStarted(suite.result, next);
|
this.reporter_.suiteStarted(suite.result).then(next);
|
||||||
suite.startTimer();
|
suite.startTimer();
|
||||||
},
|
},
|
||||||
nodeComplete: (suite, result, next) => {
|
nodeComplete: (suite, result, next) => {
|
||||||
@@ -8477,106 +8476,95 @@ getJasmineRequireObj().Runner = function(j$) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return this.execute2_(runablesToRun, order, processor);
|
||||||
|
}
|
||||||
|
|
||||||
|
async execute2_(runablesToRun, order, processor) {
|
||||||
|
const totalSpecsDefined = this.totalSpecsDefined_();
|
||||||
|
|
||||||
this.runableResources_.initForRunable(this.topSuite_.id);
|
this.runableResources_.initForRunable(this.topSuite_.id);
|
||||||
const jasmineTimer = new j$.Timer();
|
const jasmineTimer = new j$.Timer();
|
||||||
jasmineTimer.start();
|
jasmineTimer.start();
|
||||||
|
|
||||||
|
await this.reporter_.jasmineStarted({
|
||||||
|
totalSpecsDefined,
|
||||||
|
order: order
|
||||||
|
});
|
||||||
|
|
||||||
|
this.currentlyExecutingSuites_.push(this.topSuite_);
|
||||||
|
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
/**
|
processor.execute(() => {
|
||||||
* Information passed to the {@link Reporter#jasmineStarted} event.
|
(async () => {
|
||||||
* @typedef JasmineStartedInfo
|
if (this.topSuite_.hadBeforeAllFailure) {
|
||||||
* @property {Int} totalSpecsDefined - The total number of specs defined in this suite.
|
await this.reportChildrenOfBeforeAllFailure_(this.topSuite_);
|
||||||
* @property {Order} order - Information about the ordering (random or not) of this execution of the suite.
|
}
|
||||||
* @since 2.0.0
|
|
||||||
*/
|
|
||||||
this.reporter_.jasmineStarted(
|
|
||||||
{
|
|
||||||
totalSpecsDefined,
|
|
||||||
order: order
|
|
||||||
},
|
|
||||||
() => {
|
|
||||||
this.currentlyExecutingSuites_.push(this.topSuite_);
|
|
||||||
|
|
||||||
processor.execute(() => {
|
this.runableResources_.clearForRunable(this.topSuite_.id);
|
||||||
(async () => {
|
this.currentlyExecutingSuites_.pop();
|
||||||
if (this.topSuite_.hadBeforeAllFailure) {
|
let overallStatus, incompleteReason;
|
||||||
await this.reportChildrenOfBeforeAllFailure_(this.topSuite_);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.runableResources_.clearForRunable(this.topSuite_.id);
|
if (
|
||||||
this.currentlyExecutingSuites_.pop();
|
this.hasFailures ||
|
||||||
let overallStatus, incompleteReason;
|
this.topSuite_.result.failedExpectations.length > 0
|
||||||
|
) {
|
||||||
|
overallStatus = 'failed';
|
||||||
|
} else if (this.focusedRunables_().length > 0) {
|
||||||
|
overallStatus = 'incomplete';
|
||||||
|
incompleteReason = 'fit() or fdescribe() was found';
|
||||||
|
} else if (totalSpecsDefined === 0) {
|
||||||
|
overallStatus = 'incomplete';
|
||||||
|
incompleteReason = 'No specs found';
|
||||||
|
} else {
|
||||||
|
overallStatus = 'passed';
|
||||||
|
}
|
||||||
|
|
||||||
if (
|
/**
|
||||||
this.hasFailures ||
|
* Information passed to the {@link Reporter#jasmineDone} event.
|
||||||
this.topSuite_.result.failedExpectations.length > 0
|
* @typedef JasmineDoneInfo
|
||||||
) {
|
* @property {OverallStatus} overallStatus - The overall result of the suite: 'passed', 'failed', or 'incomplete'.
|
||||||
overallStatus = 'failed';
|
* @property {Int} totalTime - The total time (in ms) that it took to execute the suite
|
||||||
} else if (focusedRunables.length > 0) {
|
* @property {IncompleteReason} incompleteReason - Explanation of why the suite was incomplete.
|
||||||
overallStatus = 'incomplete';
|
* @property {Order} order - Information about the ordering (random or not) of this execution of the suite.
|
||||||
incompleteReason = 'fit() or fdescribe() was found';
|
* @property {Expectation[]} failedExpectations - List of expectations that failed in an {@link afterAll} at the global level.
|
||||||
} else if (totalSpecsDefined === 0) {
|
* @property {Expectation[]} deprecationWarnings - List of deprecation warnings that occurred at the global level.
|
||||||
overallStatus = 'incomplete';
|
* @since 2.4.0
|
||||||
incompleteReason = 'No specs found';
|
*/
|
||||||
} else {
|
const jasmineDoneInfo = {
|
||||||
overallStatus = 'passed';
|
overallStatus: overallStatus,
|
||||||
}
|
totalTime: jasmineTimer.elapsed(),
|
||||||
|
incompleteReason: incompleteReason,
|
||||||
/**
|
order: order,
|
||||||
* Information passed to the {@link Reporter#jasmineDone} event.
|
failedExpectations: this.topSuite_.result.failedExpectations,
|
||||||
* @typedef JasmineDoneInfo
|
deprecationWarnings: this.topSuite_.result.deprecationWarnings
|
||||||
* @property {OverallStatus} overallStatus - The overall result of the suite: 'passed', 'failed', or 'incomplete'.
|
};
|
||||||
* @property {Int} totalTime - The total time (in ms) that it took to execute the suite
|
this.topSuite_.reportedDone = true;
|
||||||
* @property {IncompleteReason} incompleteReason - Explanation of why the suite was incomplete.
|
await this.reporter_.jasmineDone(jasmineDoneInfo);
|
||||||
* @property {Order} order - Information about the ordering (random or not) of this execution of the suite.
|
resolve(jasmineDoneInfo);
|
||||||
* @property {Expectation[]} failedExpectations - List of expectations that failed in an {@link afterAll} at the global level.
|
})();
|
||||||
* @property {Expectation[]} deprecationWarnings - List of deprecation warnings that occurred at the global level.
|
});
|
||||||
* @since 2.4.0
|
|
||||||
*/
|
|
||||||
const jasmineDoneInfo = {
|
|
||||||
overallStatus: overallStatus,
|
|
||||||
totalTime: jasmineTimer.elapsed(),
|
|
||||||
incompleteReason: incompleteReason,
|
|
||||||
order: order,
|
|
||||||
failedExpectations: this.topSuite_.result.failedExpectations,
|
|
||||||
deprecationWarnings: this.topSuite_.result.deprecationWarnings
|
|
||||||
};
|
|
||||||
this.topSuite_.reportedDone = true;
|
|
||||||
this.reporter_.jasmineDone(jasmineDoneInfo, function() {
|
|
||||||
resolve(jasmineDoneInfo);
|
|
||||||
});
|
|
||||||
})();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
reportSuiteDone_(suite, result, next) {
|
reportSuiteDone_(suite, result, next) {
|
||||||
suite.reportedDone = true;
|
suite.reportedDone = true;
|
||||||
this.reporter_.suiteDone(result, next);
|
this.reporter_.suiteDone(result).then(next);
|
||||||
}
|
}
|
||||||
|
|
||||||
async reportChildrenOfBeforeAllFailure_(suite) {
|
async reportChildrenOfBeforeAllFailure_(suite) {
|
||||||
for (const child of suite.children) {
|
for (const child of suite.children) {
|
||||||
if (child instanceof j$.Suite) {
|
if (child instanceof j$.Suite) {
|
||||||
await new Promise(resolve => {
|
await this.reporter_.suiteStarted(child.result);
|
||||||
this.reporter_.suiteStarted(child.result, resolve);
|
|
||||||
});
|
|
||||||
await this.reportChildrenOfBeforeAllFailure_(child);
|
await this.reportChildrenOfBeforeAllFailure_(child);
|
||||||
|
|
||||||
// Marking the suite passed is consistent with how suites that
|
// Marking the suite passed is consistent with how suites that
|
||||||
// contain failed specs but no suite-level failures are reported.
|
// contain failed specs but no suite-level failures are reported.
|
||||||
child.result.status = 'passed';
|
child.result.status = 'passed';
|
||||||
|
|
||||||
await new Promise(resolve => {
|
await this.reporter_.suiteDone(child.result);
|
||||||
this.reporter_.suiteDone(child.result, resolve);
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
/* a spec */
|
/* a spec */
|
||||||
await new Promise(resolve => {
|
await this.reporter_.specStarted(child.result);
|
||||||
this.reporter_.specStarted(child.result, resolve);
|
|
||||||
});
|
|
||||||
|
|
||||||
child.addExpectationResult(
|
child.addExpectationResult(
|
||||||
false,
|
false,
|
||||||
|
|||||||
@@ -18,13 +18,12 @@ describe('ReportDispatcher', function() {
|
|||||||
queueRunnerFactory
|
queueRunnerFactory
|
||||||
),
|
),
|
||||||
reporter = jasmine.createSpyObj('reporter', ['foo', 'bar']),
|
reporter = jasmine.createSpyObj('reporter', ['foo', 'bar']),
|
||||||
anotherReporter = jasmine.createSpyObj('reporter', ['foo', 'bar']),
|
anotherReporter = jasmine.createSpyObj('reporter', ['foo', 'bar']);
|
||||||
completeCallback = jasmine.createSpy('complete');
|
|
||||||
|
|
||||||
dispatcher.addReporter(reporter);
|
dispatcher.addReporter(reporter);
|
||||||
dispatcher.addReporter(anotherReporter);
|
dispatcher.addReporter(anotherReporter);
|
||||||
|
|
||||||
dispatcher.foo(123, 456, completeCallback);
|
dispatcher.foo(123, 456);
|
||||||
|
|
||||||
expect(queueRunnerFactory).toHaveBeenCalledWith(
|
expect(queueRunnerFactory).toHaveBeenCalledWith(
|
||||||
jasmine.objectContaining({
|
jasmine.objectContaining({
|
||||||
@@ -47,7 +46,7 @@ describe('ReportDispatcher', function() {
|
|||||||
|
|
||||||
queueRunnerFactory.calls.reset();
|
queueRunnerFactory.calls.reset();
|
||||||
|
|
||||||
dispatcher.bar('a', 'b', completeCallback);
|
dispatcher.bar('a', 'b');
|
||||||
|
|
||||||
expect(queueRunnerFactory).toHaveBeenCalledWith(
|
expect(queueRunnerFactory).toHaveBeenCalledWith(
|
||||||
jasmine.objectContaining({
|
jasmine.objectContaining({
|
||||||
@@ -91,11 +90,10 @@ describe('ReportDispatcher', function() {
|
|||||||
['foo', 'bar'],
|
['foo', 'bar'],
|
||||||
queueRunnerFactory
|
queueRunnerFactory
|
||||||
),
|
),
|
||||||
reporter = jasmine.createSpyObj('reporter', ['foo', 'bar']),
|
reporter = jasmine.createSpyObj('reporter', ['foo', 'bar']);
|
||||||
completeCallback = jasmine.createSpy('complete');
|
|
||||||
|
|
||||||
dispatcher.provideFallbackReporter(reporter);
|
dispatcher.provideFallbackReporter(reporter);
|
||||||
dispatcher.foo(123, 456, completeCallback);
|
dispatcher.foo(123, 456);
|
||||||
|
|
||||||
expect(queueRunnerFactory).toHaveBeenCalledWith(
|
expect(queueRunnerFactory).toHaveBeenCalledWith(
|
||||||
jasmine.objectContaining({
|
jasmine.objectContaining({
|
||||||
@@ -116,12 +114,11 @@ describe('ReportDispatcher', function() {
|
|||||||
queueRunnerFactory
|
queueRunnerFactory
|
||||||
),
|
),
|
||||||
reporter = jasmine.createSpyObj('reporter', ['foo', 'bar']),
|
reporter = jasmine.createSpyObj('reporter', ['foo', 'bar']),
|
||||||
fallbackReporter = jasmine.createSpyObj('otherReporter', ['foo', 'bar']),
|
fallbackReporter = jasmine.createSpyObj('otherReporter', ['foo', 'bar']);
|
||||||
completeCallback = jasmine.createSpy('complete');
|
|
||||||
|
|
||||||
dispatcher.provideFallbackReporter(fallbackReporter);
|
dispatcher.provideFallbackReporter(fallbackReporter);
|
||||||
dispatcher.addReporter(reporter);
|
dispatcher.addReporter(reporter);
|
||||||
dispatcher.foo(123, 456, completeCallback);
|
dispatcher.foo(123, 456);
|
||||||
|
|
||||||
expect(queueRunnerFactory).toHaveBeenCalledWith(
|
expect(queueRunnerFactory).toHaveBeenCalledWith(
|
||||||
jasmine.objectContaining({
|
jasmine.objectContaining({
|
||||||
@@ -143,11 +140,10 @@ describe('ReportDispatcher', function() {
|
|||||||
queueRunnerFactory
|
queueRunnerFactory
|
||||||
),
|
),
|
||||||
reporter1 = jasmine.createSpyObj('reporter1', ['foo', 'bar']),
|
reporter1 = jasmine.createSpyObj('reporter1', ['foo', 'bar']),
|
||||||
reporter2 = jasmine.createSpyObj('reporter2', ['foo', 'bar']),
|
reporter2 = jasmine.createSpyObj('reporter2', ['foo', 'bar']);
|
||||||
completeCallback = jasmine.createSpy('complete');
|
|
||||||
|
|
||||||
dispatcher.addReporter(reporter1);
|
dispatcher.addReporter(reporter1);
|
||||||
dispatcher.foo(123, completeCallback);
|
dispatcher.foo(123);
|
||||||
expect(queueRunnerFactory).toHaveBeenCalledWith(
|
expect(queueRunnerFactory).toHaveBeenCalledWith(
|
||||||
jasmine.objectContaining({
|
jasmine.objectContaining({
|
||||||
queueableFns: [{ fn: jasmine.any(Function) }],
|
queueableFns: [{ fn: jasmine.any(Function) }],
|
||||||
@@ -161,7 +157,7 @@ describe('ReportDispatcher', function() {
|
|||||||
|
|
||||||
dispatcher.clearReporters();
|
dispatcher.clearReporters();
|
||||||
dispatcher.addReporter(reporter2);
|
dispatcher.addReporter(reporter2);
|
||||||
dispatcher.bar(456, completeCallback);
|
dispatcher.bar(456);
|
||||||
|
|
||||||
expect(queueRunnerFactory).toHaveBeenCalledWith(
|
expect(queueRunnerFactory).toHaveBeenCalledWith(
|
||||||
jasmine.objectContaining({
|
jasmine.objectContaining({
|
||||||
|
|||||||
@@ -701,12 +701,12 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
function specStarted(spec, suite, next) {
|
function specStarted(spec, suite, next) {
|
||||||
runner.currentSpec = spec;
|
runner.currentSpec = spec;
|
||||||
runableResources.initForRunable(spec.id, suite.id);
|
runableResources.initForRunable(spec.id, suite.id);
|
||||||
reporter.specStarted(spec.result, next);
|
reporter.specStarted(spec.result).then(next);
|
||||||
}
|
}
|
||||||
|
|
||||||
function reportSpecDone(spec, result, next) {
|
function reportSpecDone(spec, result, next) {
|
||||||
spec.reportedDone = true;
|
spec.reportedDone = true;
|
||||||
reporter.specDone(result, next);
|
reporter.specDone(result).then(next);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.it = function(description, fn, timeout) {
|
this.it = function(description, fn, timeout) {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ getJasmineRequireObj().ReportDispatcher = function(j$) {
|
|||||||
for (const method of dispatchedMethods) {
|
for (const method of dispatchedMethods) {
|
||||||
this[method] = (function(m) {
|
this[method] = (function(m) {
|
||||||
return function() {
|
return function() {
|
||||||
dispatch(m, arguments);
|
return dispatch(m, arguments);
|
||||||
};
|
};
|
||||||
})(method);
|
})(method);
|
||||||
}
|
}
|
||||||
@@ -31,25 +31,25 @@ getJasmineRequireObj().ReportDispatcher = function(j$) {
|
|||||||
if (reporters.length === 0 && fallbackReporter !== null) {
|
if (reporters.length === 0 && fallbackReporter !== null) {
|
||||||
reporters.push(fallbackReporter);
|
reporters.push(fallbackReporter);
|
||||||
}
|
}
|
||||||
const onComplete = args[args.length - 1];
|
|
||||||
args = Array.from(args).splice(0, args.length - 1);
|
|
||||||
const fns = [];
|
const fns = [];
|
||||||
for (const reporter of reporters) {
|
for (const reporter of reporters) {
|
||||||
addFn(fns, reporter, method, args);
|
addFn(fns, reporter, method, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
queueRunnerFactory({
|
return new Promise(function(resolve) {
|
||||||
queueableFns: fns,
|
queueRunnerFactory({
|
||||||
onComplete: onComplete,
|
queueableFns: fns,
|
||||||
isReporter: true,
|
onComplete: resolve,
|
||||||
onMultipleDone: function() {
|
isReporter: true,
|
||||||
onLateError(
|
onMultipleDone: function() {
|
||||||
new Error(
|
onLateError(
|
||||||
"An asynchronous reporter callback called its 'done' callback " +
|
new Error(
|
||||||
'more than once.'
|
"An asynchronous reporter callback called its 'done' callback " +
|
||||||
)
|
'more than once.'
|
||||||
);
|
)
|
||||||
}
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,6 @@ getJasmineRequireObj().Runner = function(j$) {
|
|||||||
this.executedBefore_ = true;
|
this.executedBefore_ = true;
|
||||||
|
|
||||||
this.hasFailures = false;
|
this.hasFailures = false;
|
||||||
const totalSpecsDefined = this.totalSpecsDefined_();
|
|
||||||
const focusedRunables = this.focusedRunables_();
|
const focusedRunables = this.focusedRunables_();
|
||||||
const config = this.getConfig_();
|
const config = this.getConfig_();
|
||||||
|
|
||||||
@@ -76,7 +75,7 @@ getJasmineRequireObj().Runner = function(j$) {
|
|||||||
nodeStart: (suite, next) => {
|
nodeStart: (suite, next) => {
|
||||||
this.currentlyExecutingSuites_.push(suite);
|
this.currentlyExecutingSuites_.push(suite);
|
||||||
this.runableResources_.initForRunable(suite.id, suite.parentSuite.id);
|
this.runableResources_.initForRunable(suite.id, suite.parentSuite.id);
|
||||||
this.reporter_.suiteStarted(suite.result, next);
|
this.reporter_.suiteStarted(suite.result).then(next);
|
||||||
suite.startTimer();
|
suite.startTimer();
|
||||||
},
|
},
|
||||||
nodeComplete: (suite, result, next) => {
|
nodeComplete: (suite, result, next) => {
|
||||||
@@ -114,106 +113,95 @@ getJasmineRequireObj().Runner = function(j$) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return this.execute2_(runablesToRun, order, processor);
|
||||||
|
}
|
||||||
|
|
||||||
|
async execute2_(runablesToRun, order, processor) {
|
||||||
|
const totalSpecsDefined = this.totalSpecsDefined_();
|
||||||
|
|
||||||
this.runableResources_.initForRunable(this.topSuite_.id);
|
this.runableResources_.initForRunable(this.topSuite_.id);
|
||||||
const jasmineTimer = new j$.Timer();
|
const jasmineTimer = new j$.Timer();
|
||||||
jasmineTimer.start();
|
jasmineTimer.start();
|
||||||
|
|
||||||
|
await this.reporter_.jasmineStarted({
|
||||||
|
totalSpecsDefined,
|
||||||
|
order: order
|
||||||
|
});
|
||||||
|
|
||||||
|
this.currentlyExecutingSuites_.push(this.topSuite_);
|
||||||
|
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
/**
|
processor.execute(() => {
|
||||||
* Information passed to the {@link Reporter#jasmineStarted} event.
|
(async () => {
|
||||||
* @typedef JasmineStartedInfo
|
if (this.topSuite_.hadBeforeAllFailure) {
|
||||||
* @property {Int} totalSpecsDefined - The total number of specs defined in this suite.
|
await this.reportChildrenOfBeforeAllFailure_(this.topSuite_);
|
||||||
* @property {Order} order - Information about the ordering (random or not) of this execution of the suite.
|
}
|
||||||
* @since 2.0.0
|
|
||||||
*/
|
|
||||||
this.reporter_.jasmineStarted(
|
|
||||||
{
|
|
||||||
totalSpecsDefined,
|
|
||||||
order: order
|
|
||||||
},
|
|
||||||
() => {
|
|
||||||
this.currentlyExecutingSuites_.push(this.topSuite_);
|
|
||||||
|
|
||||||
processor.execute(() => {
|
this.runableResources_.clearForRunable(this.topSuite_.id);
|
||||||
(async () => {
|
this.currentlyExecutingSuites_.pop();
|
||||||
if (this.topSuite_.hadBeforeAllFailure) {
|
let overallStatus, incompleteReason;
|
||||||
await this.reportChildrenOfBeforeAllFailure_(this.topSuite_);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.runableResources_.clearForRunable(this.topSuite_.id);
|
if (
|
||||||
this.currentlyExecutingSuites_.pop();
|
this.hasFailures ||
|
||||||
let overallStatus, incompleteReason;
|
this.topSuite_.result.failedExpectations.length > 0
|
||||||
|
) {
|
||||||
|
overallStatus = 'failed';
|
||||||
|
} else if (this.focusedRunables_().length > 0) {
|
||||||
|
overallStatus = 'incomplete';
|
||||||
|
incompleteReason = 'fit() or fdescribe() was found';
|
||||||
|
} else if (totalSpecsDefined === 0) {
|
||||||
|
overallStatus = 'incomplete';
|
||||||
|
incompleteReason = 'No specs found';
|
||||||
|
} else {
|
||||||
|
overallStatus = 'passed';
|
||||||
|
}
|
||||||
|
|
||||||
if (
|
/**
|
||||||
this.hasFailures ||
|
* Information passed to the {@link Reporter#jasmineDone} event.
|
||||||
this.topSuite_.result.failedExpectations.length > 0
|
* @typedef JasmineDoneInfo
|
||||||
) {
|
* @property {OverallStatus} overallStatus - The overall result of the suite: 'passed', 'failed', or 'incomplete'.
|
||||||
overallStatus = 'failed';
|
* @property {Int} totalTime - The total time (in ms) that it took to execute the suite
|
||||||
} else if (focusedRunables.length > 0) {
|
* @property {IncompleteReason} incompleteReason - Explanation of why the suite was incomplete.
|
||||||
overallStatus = 'incomplete';
|
* @property {Order} order - Information about the ordering (random or not) of this execution of the suite.
|
||||||
incompleteReason = 'fit() or fdescribe() was found';
|
* @property {Expectation[]} failedExpectations - List of expectations that failed in an {@link afterAll} at the global level.
|
||||||
} else if (totalSpecsDefined === 0) {
|
* @property {Expectation[]} deprecationWarnings - List of deprecation warnings that occurred at the global level.
|
||||||
overallStatus = 'incomplete';
|
* @since 2.4.0
|
||||||
incompleteReason = 'No specs found';
|
*/
|
||||||
} else {
|
const jasmineDoneInfo = {
|
||||||
overallStatus = 'passed';
|
overallStatus: overallStatus,
|
||||||
}
|
totalTime: jasmineTimer.elapsed(),
|
||||||
|
incompleteReason: incompleteReason,
|
||||||
/**
|
order: order,
|
||||||
* Information passed to the {@link Reporter#jasmineDone} event.
|
failedExpectations: this.topSuite_.result.failedExpectations,
|
||||||
* @typedef JasmineDoneInfo
|
deprecationWarnings: this.topSuite_.result.deprecationWarnings
|
||||||
* @property {OverallStatus} overallStatus - The overall result of the suite: 'passed', 'failed', or 'incomplete'.
|
};
|
||||||
* @property {Int} totalTime - The total time (in ms) that it took to execute the suite
|
this.topSuite_.reportedDone = true;
|
||||||
* @property {IncompleteReason} incompleteReason - Explanation of why the suite was incomplete.
|
await this.reporter_.jasmineDone(jasmineDoneInfo);
|
||||||
* @property {Order} order - Information about the ordering (random or not) of this execution of the suite.
|
resolve(jasmineDoneInfo);
|
||||||
* @property {Expectation[]} failedExpectations - List of expectations that failed in an {@link afterAll} at the global level.
|
})();
|
||||||
* @property {Expectation[]} deprecationWarnings - List of deprecation warnings that occurred at the global level.
|
});
|
||||||
* @since 2.4.0
|
|
||||||
*/
|
|
||||||
const jasmineDoneInfo = {
|
|
||||||
overallStatus: overallStatus,
|
|
||||||
totalTime: jasmineTimer.elapsed(),
|
|
||||||
incompleteReason: incompleteReason,
|
|
||||||
order: order,
|
|
||||||
failedExpectations: this.topSuite_.result.failedExpectations,
|
|
||||||
deprecationWarnings: this.topSuite_.result.deprecationWarnings
|
|
||||||
};
|
|
||||||
this.topSuite_.reportedDone = true;
|
|
||||||
this.reporter_.jasmineDone(jasmineDoneInfo, function() {
|
|
||||||
resolve(jasmineDoneInfo);
|
|
||||||
});
|
|
||||||
})();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
reportSuiteDone_(suite, result, next) {
|
reportSuiteDone_(suite, result, next) {
|
||||||
suite.reportedDone = true;
|
suite.reportedDone = true;
|
||||||
this.reporter_.suiteDone(result, next);
|
this.reporter_.suiteDone(result).then(next);
|
||||||
}
|
}
|
||||||
|
|
||||||
async reportChildrenOfBeforeAllFailure_(suite) {
|
async reportChildrenOfBeforeAllFailure_(suite) {
|
||||||
for (const child of suite.children) {
|
for (const child of suite.children) {
|
||||||
if (child instanceof j$.Suite) {
|
if (child instanceof j$.Suite) {
|
||||||
await new Promise(resolve => {
|
await this.reporter_.suiteStarted(child.result);
|
||||||
this.reporter_.suiteStarted(child.result, resolve);
|
|
||||||
});
|
|
||||||
await this.reportChildrenOfBeforeAllFailure_(child);
|
await this.reportChildrenOfBeforeAllFailure_(child);
|
||||||
|
|
||||||
// Marking the suite passed is consistent with how suites that
|
// Marking the suite passed is consistent with how suites that
|
||||||
// contain failed specs but no suite-level failures are reported.
|
// contain failed specs but no suite-level failures are reported.
|
||||||
child.result.status = 'passed';
|
child.result.status = 'passed';
|
||||||
|
|
||||||
await new Promise(resolve => {
|
await this.reporter_.suiteDone(child.result);
|
||||||
this.reporter_.suiteDone(child.result, resolve);
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
/* a spec */
|
/* a spec */
|
||||||
await new Promise(resolve => {
|
await this.reporter_.specStarted(child.result);
|
||||||
this.reporter_.specStarted(child.result, resolve);
|
|
||||||
});
|
|
||||||
|
|
||||||
child.addExpectationResult(
|
child.addExpectationResult(
|
||||||
false,
|
false,
|
||||||
|
|||||||
Reference in New Issue
Block a user