Files
jasmine/src/html/HtmlSpecFilter.js
Steve Gravrock 23894c1a0a Detect monkey patching and emit a deprecation warning.
This isn't comprehensive but it should be broad enough to ensure that most
people who would be affected by blocking monkey patching see a warning.
Covers the jasmine namespace as well as classes that are monkey patched by
zone.js.

Replacing globals (describe/it/etc) doesn't trigger a warning because they
belong to the user and are expected to be replaced.
2025-11-27 07:23:57 -08:00

36 lines
1019 B
JavaScript

jasmineRequire.HtmlSpecFilter = function(j$) {
'use strict';
/**
* @class HtmlSpecFilter
* @param options Options object. See lib/jasmine-core/boot1.js for details.
* @deprecated Use {@link HtmlReporterV2Urls} instead.
*/
function HtmlSpecFilter(options) {
const env = options?.env ?? j$.getEnv();
env.deprecated(
'HtmlReporter and HtmlSpecFilter are deprecated. Use HtmlReporterV2 instead.'
);
const filterString =
options &&
options.filterString &&
options.filterString() &&
options.filterString().replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
const filterPattern = new RegExp(filterString);
/**
* Determines whether the spec with the specified name should be executed.
* @name HtmlSpecFilter#matches
* @function
* @param {string} specName The full name of the spec
* @returns {boolean}
*/
this.matches = function(specName) {
return filterPattern.test(specName);
};
}
return HtmlSpecFilter;
};