API reference docs for HTML reporter and spec filters
This commit is contained in:
@@ -84,6 +84,13 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @class HtmlReporter
|
||||||
|
* @classdesc Displays results and allows re-running individual specs and suites.
|
||||||
|
* @implements {Reporter}
|
||||||
|
* @param options Options object. See lib/jasmine-core/boot1.js for details.
|
||||||
|
* @since 1.2.0
|
||||||
|
*/
|
||||||
function HtmlReporter(options) {
|
function HtmlReporter(options) {
|
||||||
function config() {
|
function config() {
|
||||||
return (options.env && options.env.configuration()) || {};
|
return (options.env && options.env.configuration()) || {};
|
||||||
@@ -101,6 +108,11 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|||||||
const deprecationWarnings = [];
|
const deprecationWarnings = [];
|
||||||
const failures = [];
|
const failures = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes the reporter. Should be called before {@link Env#execute}.
|
||||||
|
* @function
|
||||||
|
* @name HtmlReporter#initialize
|
||||||
|
*/
|
||||||
this.initialize = function() {
|
this.initialize = function() {
|
||||||
clearPrior();
|
clearPrior();
|
||||||
htmlReporterMain = createDom(
|
htmlReporterMain = createDom(
|
||||||
@@ -891,6 +903,15 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
jasmineRequire.HtmlSpecFilter = function() {
|
jasmineRequire.HtmlSpecFilter = function() {
|
||||||
|
/**
|
||||||
|
* @name HtmlSpecFilter
|
||||||
|
* @classdesc Legacy HTML spec filter, for backward compatibility
|
||||||
|
* with boot files that predate {@link HtmlExactSpecFilter}.
|
||||||
|
* @param options Object with a filterString method
|
||||||
|
* @constructor
|
||||||
|
* @deprecated
|
||||||
|
* @since 1.2.0
|
||||||
|
*/
|
||||||
// Legacy HTML spec filter, preserved for backward compatibility with
|
// Legacy HTML spec filter, preserved for backward compatibility with
|
||||||
// boot files that predate HtmlExactSpecFilterV2
|
// boot files that predate HtmlExactSpecFilterV2
|
||||||
function HtmlSpecFilter(options) {
|
function HtmlSpecFilter(options) {
|
||||||
@@ -905,6 +926,13 @@ jasmineRequire.HtmlSpecFilter = function() {
|
|||||||
|
|
||||||
const filterPattern = new RegExp(filterString);
|
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) {
|
this.matches = function(specName) {
|
||||||
return filterPattern.test(specName);
|
return filterPattern.test(specName);
|
||||||
};
|
};
|
||||||
@@ -993,9 +1021,21 @@ jasmineRequire.QueryString = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
jasmineRequire.HtmlExactSpecFilter = function() {
|
jasmineRequire.HtmlExactSpecFilter = function() {
|
||||||
|
/**
|
||||||
|
* Spec filter for use with {@link HtmlReporter}
|
||||||
|
*
|
||||||
|
* See lib/jasmine-core/boot1.js for usage.
|
||||||
|
* @since 5.11.0
|
||||||
|
*/
|
||||||
class HtmlExactSpecFilter {
|
class HtmlExactSpecFilter {
|
||||||
#getFilterString;
|
#getFilterString;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a filter instance.
|
||||||
|
* @param options Object with a filterString method, which should
|
||||||
|
* return the value of the "spec" query string parameter set by
|
||||||
|
* {@link HtmlReporter}.
|
||||||
|
*/
|
||||||
constructor(options) {
|
constructor(options) {
|
||||||
if (typeof options?.filterString !== 'function') {
|
if (typeof options?.filterString !== 'function') {
|
||||||
throw new Error('options.filterString must be a function');
|
throw new Error('options.filterString must be a function');
|
||||||
@@ -1004,6 +1044,11 @@ jasmineRequire.HtmlExactSpecFilter = function() {
|
|||||||
this.#getFilterString = options.filterString;
|
this.#getFilterString = options.filterString;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determines whether the specified spec should be executed.
|
||||||
|
* @param {Spec} spec
|
||||||
|
* @returns {boolean}
|
||||||
|
*/
|
||||||
matches(spec) {
|
matches(spec) {
|
||||||
const filterString = this.#getFilterString();
|
const filterString = this.#getFilterString();
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,19 @@
|
|||||||
jasmineRequire.HtmlExactSpecFilter = function() {
|
jasmineRequire.HtmlExactSpecFilter = function() {
|
||||||
|
/**
|
||||||
|
* Spec filter for use with {@link HtmlReporter}
|
||||||
|
*
|
||||||
|
* See lib/jasmine-core/boot1.js for usage.
|
||||||
|
* @since 5.11.0
|
||||||
|
*/
|
||||||
class HtmlExactSpecFilter {
|
class HtmlExactSpecFilter {
|
||||||
#getFilterString;
|
#getFilterString;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a filter instance.
|
||||||
|
* @param options Object with a filterString method, which should
|
||||||
|
* return the value of the "spec" query string parameter set by
|
||||||
|
* {@link HtmlReporter}.
|
||||||
|
*/
|
||||||
constructor(options) {
|
constructor(options) {
|
||||||
if (typeof options?.filterString !== 'function') {
|
if (typeof options?.filterString !== 'function') {
|
||||||
throw new Error('options.filterString must be a function');
|
throw new Error('options.filterString must be a function');
|
||||||
@@ -10,6 +22,11 @@ jasmineRequire.HtmlExactSpecFilter = function() {
|
|||||||
this.#getFilterString = options.filterString;
|
this.#getFilterString = options.filterString;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determines whether the specified spec should be executed.
|
||||||
|
* @param {Spec} spec
|
||||||
|
* @returns {boolean}
|
||||||
|
*/
|
||||||
matches(spec) {
|
matches(spec) {
|
||||||
const filterString = this.#getFilterString();
|
const filterString = this.#getFilterString();
|
||||||
|
|
||||||
|
|||||||
@@ -49,6 +49,13 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @class HtmlReporter
|
||||||
|
* @classdesc Displays results and allows re-running individual specs and suites.
|
||||||
|
* @implements {Reporter}
|
||||||
|
* @param options Options object. See lib/jasmine-core/boot1.js for details.
|
||||||
|
* @since 1.2.0
|
||||||
|
*/
|
||||||
function HtmlReporter(options) {
|
function HtmlReporter(options) {
|
||||||
function config() {
|
function config() {
|
||||||
return (options.env && options.env.configuration()) || {};
|
return (options.env && options.env.configuration()) || {};
|
||||||
@@ -66,6 +73,11 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|||||||
const deprecationWarnings = [];
|
const deprecationWarnings = [];
|
||||||
const failures = [];
|
const failures = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes the reporter. Should be called before {@link Env#execute}.
|
||||||
|
* @function
|
||||||
|
* @name HtmlReporter#initialize
|
||||||
|
*/
|
||||||
this.initialize = function() {
|
this.initialize = function() {
|
||||||
clearPrior();
|
clearPrior();
|
||||||
htmlReporterMain = createDom(
|
htmlReporterMain = createDom(
|
||||||
|
|||||||
@@ -1,4 +1,13 @@
|
|||||||
jasmineRequire.HtmlSpecFilter = function() {
|
jasmineRequire.HtmlSpecFilter = function() {
|
||||||
|
/**
|
||||||
|
* @name HtmlSpecFilter
|
||||||
|
* @classdesc Legacy HTML spec filter, for backward compatibility
|
||||||
|
* with boot files that predate {@link HtmlExactSpecFilter}.
|
||||||
|
* @param options Object with a filterString method
|
||||||
|
* @constructor
|
||||||
|
* @deprecated
|
||||||
|
* @since 1.2.0
|
||||||
|
*/
|
||||||
// Legacy HTML spec filter, preserved for backward compatibility with
|
// Legacy HTML spec filter, preserved for backward compatibility with
|
||||||
// boot files that predate HtmlExactSpecFilterV2
|
// boot files that predate HtmlExactSpecFilterV2
|
||||||
function HtmlSpecFilter(options) {
|
function HtmlSpecFilter(options) {
|
||||||
@@ -13,6 +22,13 @@ jasmineRequire.HtmlSpecFilter = function() {
|
|||||||
|
|
||||||
const filterPattern = new RegExp(filterString);
|
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) {
|
this.matches = function(specName) {
|
||||||
return filterPattern.test(specName);
|
return filterPattern.test(specName);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user