Files
jasmine/spec/helpers/integrationMatchers.js
Steve Gravrock f12f4395f0 Redesigned moudule system
* Top level private APIs (e.g. jasmine.private.whatever) are no longer
  exposed
* jasmineRequire is no longer exposed
* core is self-booting
* Globals are automatically created in browsers. (They can subsequently
  be removed by user code if desired.)
* Globals are *not* automatically created in Node. An installGlobals
  function is exported instead. The jasmine package calls installGlobals
  unless configured not to do so.
* In Node, the same instance is returned each time jasmine-core is
  imported. A reset function is exported. It effectively resets all state
  by discarding the env and creating a new one. This allows mulitple
  sequential runs within the same process to be independent of each
  other, but does not allow multiple concurrent runs. (That probably never
  worked anyway.)

Fixes #2094
2026-02-15 20:16:45 -08:00

55 lines
1.8 KiB
JavaScript

(function() {
specHelpers.registerIntegrationMatchers = function() {
jasmine.addMatchers({
toHaveFailedExpectationsForRunnable: function() {
return {
compare: function(actual, fullName, expectedFailures) {
let foundRunnable = false,
expectations = true,
foundFailures = [];
for (let i = 0; i < actual.calls.count(); i++) {
const args = actual.calls.argsFor(i)[0];
if (args.fullName === fullName) {
foundRunnable = true;
for (let j = 0; j < args.failedExpectations.length; j++) {
foundFailures.push(args.failedExpectations[j].message);
}
for (let j = 0; j < expectedFailures.length; j++) {
const failure = foundFailures[j];
const expectedFailure = expectedFailures[j];
if (
Object.prototype.toString.call(expectedFailure) ===
'[object RegExp]'
) {
expectations =
expectations && expectedFailure.test(failure);
} else {
expectations = expectations && failure === expectedFailure;
}
}
break;
}
}
return {
pass: foundRunnable && expectations,
message: !foundRunnable
? 'The runnable "' + fullName + '" never finished'
: 'Expected runnable "' +
fullName +
'" to have failures ' +
jasmine.pp(expectedFailures) +
' but it had ' +
jasmine.pp(foundFailures)
};
}
};
}
});
};
})();