Merge remote-tracking branch 'origin/main' into 5.0
This commit is contained in:
@@ -80,7 +80,8 @@ getJasmineRequireObj().clearStack = function(j$) {
|
||||
SAFARI ||
|
||||
j$.util.isUndefined(global.MessageChannel) /* tests */
|
||||
) {
|
||||
// queueMicrotask is dramatically faster than MessageChannel in Safari.
|
||||
// queueMicrotask is dramatically faster than MessageChannel in Safari,
|
||||
// at least through version 16.
|
||||
// Some of our own integration tests provide a mock queueMicrotask in all
|
||||
// environments because it's simpler to mock than MessageChannel.
|
||||
return browserQueueMicrotaskImpl(global);
|
||||
|
||||
@@ -44,18 +44,38 @@ getJasmineRequireObj().ExceptionFormatter = function(j$) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const stackTrace = new j$.StackTrace(error);
|
||||
const lines = filterJasmine(stackTrace);
|
||||
let result = '';
|
||||
const lines = this.stack_(error, {
|
||||
messageHandling: omitMessage ? 'omit' : undefined
|
||||
});
|
||||
return lines.join('\n');
|
||||
};
|
||||
|
||||
if (stackTrace.message && !omitMessage) {
|
||||
// messageHandling can be falsy (unspecified), 'omit', or 'require'
|
||||
this.stack_ = function(error, { messageHandling }) {
|
||||
let lines = formatProperties(error).split('\n');
|
||||
|
||||
if (lines[lines.length - 1] === '') {
|
||||
lines.pop();
|
||||
}
|
||||
|
||||
const stackTrace = new j$.StackTrace(error);
|
||||
lines = lines.concat(filterJasmine(stackTrace));
|
||||
|
||||
if (messageHandling === 'require') {
|
||||
lines.unshift(stackTrace.message || 'Error: ' + error.message);
|
||||
} else if (messageHandling !== 'omit' && stackTrace.message) {
|
||||
lines.unshift(stackTrace.message);
|
||||
}
|
||||
|
||||
result += formatProperties(error);
|
||||
result += lines.join('\n');
|
||||
if (error.cause) {
|
||||
const substack = this.stack_(error.cause, {
|
||||
messageHandling: 'require'
|
||||
});
|
||||
substack[0] = 'Caused by: ' + substack[0];
|
||||
lines = lines.concat(substack);
|
||||
}
|
||||
|
||||
return result;
|
||||
return lines;
|
||||
};
|
||||
|
||||
function filterJasmine(stackTrace) {
|
||||
|
||||
@@ -39,7 +39,7 @@ getJasmineRequireObj().Spec = function(j$) {
|
||||
|
||||
/**
|
||||
* @typedef SpecResult
|
||||
* @property {Int} id - The unique id of this spec.
|
||||
* @property {String} id - The unique id of this spec.
|
||||
* @property {String} description - The description passed to the {@link it} that created this spec.
|
||||
* @property {String} fullName - The full description including all ancestors of this spec.
|
||||
* @property {Expectation[]} failedExpectations - The list of expectations that failed during execution of this spec.
|
||||
|
||||
@@ -106,7 +106,7 @@ getJasmineRequireObj().Suite = function(j$) {
|
||||
Suite.prototype.reset = function() {
|
||||
/**
|
||||
* @typedef SuiteResult
|
||||
* @property {Int} id - The unique id of this suite.
|
||||
* @property {String} id - The unique id of this suite.
|
||||
* @property {String} description - The description text passed to the {@link describe} that made this suite.
|
||||
* @property {String} fullName - The full description including all ancestors of this suite.
|
||||
* @property {Expectation[]} failedExpectations - The list of expectations that failed in an {@link afterAll} for this suite.
|
||||
|
||||
@@ -652,7 +652,7 @@ getJasmineRequireObj().MatchersUtil = function(j$) {
|
||||
* };
|
||||
* }
|
||||
*
|
||||
* var actual = {
|
||||
* const actual = {
|
||||
* n: 2,
|
||||
* otherFields: "don't care"
|
||||
* };
|
||||
|
||||
@@ -6,7 +6,7 @@ getJasmineRequireObj().toHaveClass = function(j$) {
|
||||
* @since 3.0.0
|
||||
* @param {Object} expected - The class name to test for
|
||||
* @example
|
||||
* var el = document.createElement('div');
|
||||
* const el = document.createElement('div');
|
||||
* el.className = 'foo bar baz';
|
||||
* expect(el).toHaveClass('bar');
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user