Fixed reporting of suites that are skipped due to a beforeAll failure
This commit is contained in:
@@ -1972,32 +1972,38 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
reporter.suiteStarted(child.result, resolve);
|
reporter.suiteStarted(child.result, resolve);
|
||||||
});
|
});
|
||||||
await reportChildrenOfBeforeAllFailure(child);
|
await reportChildrenOfBeforeAllFailure(child);
|
||||||
markNotRun(child);
|
|
||||||
|
// Marking the suite passed is consistent with how suites that
|
||||||
|
// contain failed specs but no suite-level failures are reported.
|
||||||
|
child.result.status = 'passed';
|
||||||
|
|
||||||
await new Promise(function(resolve) {
|
await new Promise(function(resolve) {
|
||||||
reporter.suiteDone(child.result, resolve);
|
reporter.suiteDone(child.result, resolve);
|
||||||
});
|
});
|
||||||
} /* a spec */ else {
|
} else {
|
||||||
|
/* a spec */
|
||||||
await new Promise(function(resolve) {
|
await new Promise(function(resolve) {
|
||||||
reporter.specStarted(child.result, resolve);
|
reporter.specStarted(child.result, resolve);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
child.addExpectationResult(
|
||||||
|
false,
|
||||||
|
{
|
||||||
|
passed: false,
|
||||||
|
message:
|
||||||
|
'Not run because a beforeAll function failed. The ' +
|
||||||
|
'beforeAll failure will be reported on the suite that ' +
|
||||||
|
'caused it.'
|
||||||
|
},
|
||||||
|
true
|
||||||
|
);
|
||||||
|
child.result.status = 'failed';
|
||||||
|
|
||||||
await new Promise(function(resolve) {
|
await new Promise(function(resolve) {
|
||||||
markNotRun(child);
|
|
||||||
reporter.specDone(child.result, resolve);
|
reporter.specDone(child.result, resolve);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function markNotRun(runnable) {
|
|
||||||
runnable.addExpectationResult(
|
|
||||||
false,
|
|
||||||
{
|
|
||||||
passed: false,
|
|
||||||
message: 'Not run because a beforeAll function failed'
|
|
||||||
},
|
|
||||||
true
|
|
||||||
);
|
|
||||||
runnable.result.status = 'failed';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1113,16 +1113,13 @@ describe('spec running', function() {
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// The child suite should be reported as passed, for consistency with
|
||||||
|
// suites that contain failing specs but no suite-level errors.
|
||||||
expect(reporter.suiteDone).toHaveBeenCalledWith(
|
expect(reporter.suiteDone).toHaveBeenCalledWith(
|
||||||
jasmine.objectContaining({
|
jasmine.objectContaining({
|
||||||
fullName: 'a nested suite',
|
fullName: 'a nested suite',
|
||||||
status: 'failed',
|
status: 'passed',
|
||||||
failedExpectations: [
|
failedExpectations: []
|
||||||
jasmine.objectContaining({
|
|
||||||
passed: false,
|
|
||||||
message: 'Not run because a beforeAll function failed'
|
|
||||||
})
|
|
||||||
]
|
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -1138,7 +1135,10 @@ describe('spec running', function() {
|
|||||||
failedExpectations: [
|
failedExpectations: [
|
||||||
jasmine.objectContaining({
|
jasmine.objectContaining({
|
||||||
passed: false,
|
passed: false,
|
||||||
message: 'Not run because a beforeAll function failed'
|
message:
|
||||||
|
'Not run because a beforeAll function failed. The ' +
|
||||||
|
'beforeAll failure will be reported on the suite that ' +
|
||||||
|
'caused it.'
|
||||||
})
|
})
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
@@ -1156,7 +1156,10 @@ describe('spec running', function() {
|
|||||||
failedExpectations: [
|
failedExpectations: [
|
||||||
jasmine.objectContaining({
|
jasmine.objectContaining({
|
||||||
passed: false,
|
passed: false,
|
||||||
message: 'Not run because a beforeAll function failed'
|
message:
|
||||||
|
'Not run because a beforeAll function failed. The ' +
|
||||||
|
'beforeAll failure will be reported on the suite that ' +
|
||||||
|
'caused it.'
|
||||||
})
|
})
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
@@ -1214,16 +1217,13 @@ describe('spec running', function() {
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// The child suite should be reported as passed, for consistency with
|
||||||
|
// suites that contain failing specs but no suite-level errors.
|
||||||
expect(reporter.suiteDone).toHaveBeenCalledWith(
|
expect(reporter.suiteDone).toHaveBeenCalledWith(
|
||||||
jasmine.objectContaining({
|
jasmine.objectContaining({
|
||||||
fullName: 'a suite a nested suite',
|
fullName: 'a suite a nested suite',
|
||||||
status: 'failed',
|
status: 'passed',
|
||||||
failedExpectations: [
|
failedExpectations: []
|
||||||
jasmine.objectContaining({
|
|
||||||
passed: false,
|
|
||||||
message: 'Not run because a beforeAll function failed'
|
|
||||||
})
|
|
||||||
]
|
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -1239,7 +1239,10 @@ describe('spec running', function() {
|
|||||||
failedExpectations: [
|
failedExpectations: [
|
||||||
jasmine.objectContaining({
|
jasmine.objectContaining({
|
||||||
passed: false,
|
passed: false,
|
||||||
message: 'Not run because a beforeAll function failed'
|
message:
|
||||||
|
'Not run because a beforeAll function failed. The ' +
|
||||||
|
'beforeAll failure will be reported on the suite that ' +
|
||||||
|
'caused it.'
|
||||||
})
|
})
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
@@ -1257,7 +1260,10 @@ describe('spec running', function() {
|
|||||||
failedExpectations: [
|
failedExpectations: [
|
||||||
jasmine.objectContaining({
|
jasmine.objectContaining({
|
||||||
passed: false,
|
passed: false,
|
||||||
message: 'Not run because a beforeAll function failed'
|
message:
|
||||||
|
'Not run because a beforeAll function failed. The ' +
|
||||||
|
'beforeAll failure will be reported on the suite that ' +
|
||||||
|
'caused it.'
|
||||||
})
|
})
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -831,32 +831,38 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
reporter.suiteStarted(child.result, resolve);
|
reporter.suiteStarted(child.result, resolve);
|
||||||
});
|
});
|
||||||
await reportChildrenOfBeforeAllFailure(child);
|
await reportChildrenOfBeforeAllFailure(child);
|
||||||
markNotRun(child);
|
|
||||||
|
// Marking the suite passed is consistent with how suites that
|
||||||
|
// contain failed specs but no suite-level failures are reported.
|
||||||
|
child.result.status = 'passed';
|
||||||
|
|
||||||
await new Promise(function(resolve) {
|
await new Promise(function(resolve) {
|
||||||
reporter.suiteDone(child.result, resolve);
|
reporter.suiteDone(child.result, resolve);
|
||||||
});
|
});
|
||||||
} /* a spec */ else {
|
} else {
|
||||||
|
/* a spec */
|
||||||
await new Promise(function(resolve) {
|
await new Promise(function(resolve) {
|
||||||
reporter.specStarted(child.result, resolve);
|
reporter.specStarted(child.result, resolve);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
child.addExpectationResult(
|
||||||
|
false,
|
||||||
|
{
|
||||||
|
passed: false,
|
||||||
|
message:
|
||||||
|
'Not run because a beforeAll function failed. The ' +
|
||||||
|
'beforeAll failure will be reported on the suite that ' +
|
||||||
|
'caused it.'
|
||||||
|
},
|
||||||
|
true
|
||||||
|
);
|
||||||
|
child.result.status = 'failed';
|
||||||
|
|
||||||
await new Promise(function(resolve) {
|
await new Promise(function(resolve) {
|
||||||
markNotRun(child);
|
|
||||||
reporter.specDone(child.result, resolve);
|
reporter.specDone(child.result, resolve);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function markNotRun(runnable) {
|
|
||||||
runnable.addExpectationResult(
|
|
||||||
false,
|
|
||||||
{
|
|
||||||
passed: false,
|
|
||||||
message: 'Not run because a beforeAll function failed'
|
|
||||||
},
|
|
||||||
true
|
|
||||||
);
|
|
||||||
runnable.result.status = 'failed';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user