HTML reporter: cache configuration throughout each run

This commit is contained in:
Steve Gravrock
2025-10-07 18:55:18 -07:00
parent 1f521f2a7f
commit 10ad40357a
2 changed files with 12 additions and 20 deletions

View File

@@ -126,6 +126,7 @@ jasmineRequire.HtmlReporter = function(j$) {
#urlBuilder;
#filterSpecs;
#stateBuilder;
#config;
#htmlReporterMain;
// Sub-views
@@ -157,13 +158,12 @@ jasmineRequire.HtmlReporter = function(j$) {
*/
initialize() {
this.#clearPrior();
this.#config = this.#env ? this.#env.configuration() : {};
this.#stateBuilder = new ResultsStateBuilder();
this.#alerts = new AlertsView(this.#domContext, this.#urlBuilder);
this.#symbols = new SymbolsView(
this.#domContext,
this.#config.bind(this)
);
this.#symbols = new SymbolsView(this.#domContext);
this.#banner = new Banner(this.#domContext, this.#navigateWithNewParam);
this.#failures = new FailuresView(this.#domContext, this.#urlBuilder);
this.#htmlReporterMain = this.#domContext.create(
@@ -197,7 +197,7 @@ jasmineRequire.HtmlReporter = function(j$) {
specDone(result) {
this.#stateBuilder.specDone(result);
this.#symbols.append(result, this.#config());
this.#symbols.append(result, this.#config);
if (noExpectations(result)) {
const noSpecMsg = "Spec '" + result.fullName + "' has no expectations.";
@@ -218,7 +218,7 @@ jasmineRequire.HtmlReporter = function(j$) {
jasmineDone(doneResult) {
this.#stateBuilder.jasmineDone(doneResult);
this.#alerts.addDuration(doneResult.totalTime);
this.#banner.showOptionsMenu(this.#config());
this.#banner.showOptionsMenu(this.#config);
if (
this.#stateBuilder.specsExecuted < this.#stateBuilder.totalSpecsDefined
@@ -261,10 +261,6 @@ jasmineRequire.HtmlReporter = function(j$) {
}
}
#config() {
return (this.#env && this.#env.configuration()) || {};
}
#find(selector) {
return this.#getContainer().querySelector(
'.jasmine_html-reporter ' + selector

View File

@@ -91,6 +91,7 @@ jasmineRequire.HtmlReporter = function(j$) {
#urlBuilder;
#filterSpecs;
#stateBuilder;
#config;
#htmlReporterMain;
// Sub-views
@@ -122,13 +123,12 @@ jasmineRequire.HtmlReporter = function(j$) {
*/
initialize() {
this.#clearPrior();
this.#config = this.#env ? this.#env.configuration() : {};
this.#stateBuilder = new ResultsStateBuilder();
this.#alerts = new AlertsView(this.#domContext, this.#urlBuilder);
this.#symbols = new SymbolsView(
this.#domContext,
this.#config.bind(this)
);
this.#symbols = new SymbolsView(this.#domContext);
this.#banner = new Banner(this.#domContext, this.#navigateWithNewParam);
this.#failures = new FailuresView(this.#domContext, this.#urlBuilder);
this.#htmlReporterMain = this.#domContext.create(
@@ -162,7 +162,7 @@ jasmineRequire.HtmlReporter = function(j$) {
specDone(result) {
this.#stateBuilder.specDone(result);
this.#symbols.append(result, this.#config());
this.#symbols.append(result, this.#config);
if (noExpectations(result)) {
const noSpecMsg = "Spec '" + result.fullName + "' has no expectations.";
@@ -183,7 +183,7 @@ jasmineRequire.HtmlReporter = function(j$) {
jasmineDone(doneResult) {
this.#stateBuilder.jasmineDone(doneResult);
this.#alerts.addDuration(doneResult.totalTime);
this.#banner.showOptionsMenu(this.#config());
this.#banner.showOptionsMenu(this.#config);
if (
this.#stateBuilder.specsExecuted < this.#stateBuilder.totalSpecsDefined
@@ -226,10 +226,6 @@ jasmineRequire.HtmlReporter = function(j$) {
}
}
#config() {
return (this.#env && this.#env.configuration()) || {};
}
#find(selector) {
return this.#getContainer().querySelector(
'.jasmine_html-reporter ' + selector