Remove HtmlReporter, HtmlSpecFilter, and supporting internal code
This commit is contained in:
@@ -32,310 +32,16 @@ jasmineRequire.html = function(j$) {
|
||||
j$.private.AlertsView = jasmineRequire.AlertsView(j$);
|
||||
j$.private.OverallStatusBar = jasmineRequire.OverallStatusBar(j$);
|
||||
j$.private.Banner = jasmineRequire.Banner(j$);
|
||||
j$.private.SymbolsView = jasmineRequire.SymbolsView(j$);
|
||||
j$.private.SummaryTreeView = jasmineRequire.SummaryTreeView(j$);
|
||||
j$.private.FailuresView = jasmineRequire.FailuresView(j$);
|
||||
j$.private.PerformanceView = jasmineRequire.PerformanceView(j$);
|
||||
j$.private.TabBar = jasmineRequire.TabBar(j$);
|
||||
j$.HtmlReporter = jasmineRequire.HtmlReporter(j$);
|
||||
j$.HtmlReporterV2Urls = jasmineRequire.HtmlReporterV2Urls(j$);
|
||||
j$.HtmlReporterV2 = jasmineRequire.HtmlReporterV2(j$);
|
||||
j$.QueryString = jasmineRequire.QueryString();
|
||||
j$.HtmlSpecFilter = jasmineRequire.HtmlSpecFilter(j$);
|
||||
j$.private.HtmlSpecFilterV2 = jasmineRequire.HtmlSpecFilterV2();
|
||||
};
|
||||
|
||||
jasmineRequire.HtmlReporter = function(j$) {
|
||||
'use strict';
|
||||
|
||||
const { createDom, noExpectations } = j$.private.htmlReporterUtils;
|
||||
|
||||
/**
|
||||
* @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
|
||||
* @deprecated Use {@link HtmlReporterV2} instead.
|
||||
*/
|
||||
class HtmlReporter {
|
||||
#env;
|
||||
#getContainer;
|
||||
#navigateWithNewParam;
|
||||
#urlBuilder;
|
||||
#filterSpecs;
|
||||
#stateBuilder;
|
||||
#config;
|
||||
#htmlReporterMain;
|
||||
|
||||
// Sub-views
|
||||
#alerts;
|
||||
#symbols;
|
||||
#banner;
|
||||
#failures;
|
||||
|
||||
constructor(options) {
|
||||
this.#env = options.env;
|
||||
|
||||
this.#getContainer = options.getContainer;
|
||||
this.#navigateWithNewParam =
|
||||
options.navigateWithNewParam || function() {};
|
||||
this.#urlBuilder = new UrlBuilder(
|
||||
options.addToExistingQueryString || defaultQueryString
|
||||
);
|
||||
this.#filterSpecs = options.filterSpecs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the reporter. Should be called before {@link Env#execute}.
|
||||
* @function
|
||||
* @name HtmlReporter#initialize
|
||||
*/
|
||||
initialize() {
|
||||
this.#env.deprecated(
|
||||
'HtmlReporter and HtmlSpecFilter are deprecated. Use HtmlReporterV2 instead.'
|
||||
);
|
||||
this.#clearPrior();
|
||||
this.#config = this.#env ? this.#env.configuration() : {};
|
||||
|
||||
this.#stateBuilder = new j$.private.ResultsStateBuilder();
|
||||
|
||||
this.#alerts = new j$.private.AlertsView(this.#urlBuilder);
|
||||
this.#symbols = new j$.private.SymbolsView();
|
||||
this.#banner = new j$.private.Banner(this.#navigateWithNewParam);
|
||||
this.#failures = new j$.private.FailuresView(this.#urlBuilder);
|
||||
this.#htmlReporterMain = createDom(
|
||||
'div',
|
||||
{ className: 'jasmine_html-reporter' },
|
||||
this.#banner.rootEl,
|
||||
this.#symbols.rootEl,
|
||||
this.#alerts.rootEl,
|
||||
this.#failures.rootEl
|
||||
);
|
||||
this.#getContainer().appendChild(this.#htmlReporterMain);
|
||||
}
|
||||
|
||||
jasmineStarted(options) {
|
||||
this.#stateBuilder.jasmineStarted(options);
|
||||
}
|
||||
|
||||
suiteStarted(result) {
|
||||
this.#stateBuilder.suiteStarted(result);
|
||||
}
|
||||
|
||||
suiteDone(result) {
|
||||
this.#stateBuilder.suiteDone(result);
|
||||
|
||||
if (result.status === 'failed') {
|
||||
this.#failures.append(result, this.#stateBuilder.currentParent);
|
||||
}
|
||||
}
|
||||
|
||||
specStarted() {}
|
||||
|
||||
specDone(result) {
|
||||
this.#stateBuilder.specDone(result);
|
||||
this.#symbols.append(result, this.#config);
|
||||
|
||||
if (noExpectations(result)) {
|
||||
const noSpecMsg = "Spec '" + result.fullName + "' has no expectations.";
|
||||
if (result.status === 'failed') {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(noSpecMsg);
|
||||
} else {
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn(noSpecMsg);
|
||||
}
|
||||
}
|
||||
|
||||
if (result.status === 'failed') {
|
||||
this.#failures.append(result, this.#stateBuilder.currentParent);
|
||||
}
|
||||
}
|
||||
|
||||
jasmineDone(doneResult) {
|
||||
this.#stateBuilder.jasmineDone(doneResult);
|
||||
this.#banner.showOptionsMenu(this.#config);
|
||||
|
||||
if (
|
||||
this.#stateBuilder.specsExecuted < this.#stateBuilder.totalSpecsDefined
|
||||
) {
|
||||
this.#alerts.addSkipped(
|
||||
this.#stateBuilder.specsExecuted,
|
||||
this.#stateBuilder.totalSpecsDefined
|
||||
);
|
||||
}
|
||||
|
||||
const statusBar = new j$.private.OverallStatusBar(this.#urlBuilder);
|
||||
statusBar.showDone(doneResult, this.#stateBuilder);
|
||||
this.#alerts.addBar(statusBar.rootEl);
|
||||
|
||||
if (doneResult.failedExpectations) {
|
||||
for (const f of doneResult.failedExpectations) {
|
||||
this.#alerts.addGlobalFailure(f);
|
||||
}
|
||||
}
|
||||
|
||||
for (const dw of this.#stateBuilder.deprecationWarnings) {
|
||||
this.#alerts.addDeprecationWarning(dw);
|
||||
}
|
||||
|
||||
const results = this.#find('.jasmine-results');
|
||||
const summary = new j$.private.SummaryTreeView(
|
||||
this.#urlBuilder,
|
||||
this.#filterSpecs
|
||||
);
|
||||
summary.addResults(this.#stateBuilder.topResults);
|
||||
results.appendChild(summary.rootEl);
|
||||
|
||||
if (this.#stateBuilder.anyNonTopSuiteFailures) {
|
||||
this.#addFailureToggle();
|
||||
this.#setMenuModeTo('jasmine-failure-list');
|
||||
this.#failures.show();
|
||||
}
|
||||
}
|
||||
|
||||
#addFailureToggle() {
|
||||
const onClickFailures = () => this.#setMenuModeTo('jasmine-failure-list');
|
||||
const onClickSpecList = () => this.#setMenuModeTo('jasmine-spec-list');
|
||||
const failuresLink = createDom(
|
||||
'a',
|
||||
{ className: 'jasmine-failures-menu', href: '#' },
|
||||
'Failures'
|
||||
);
|
||||
let specListLink = createDom(
|
||||
'a',
|
||||
{ className: 'jasmine-spec-list-menu', href: '#' },
|
||||
'Spec List'
|
||||
);
|
||||
|
||||
failuresLink.onclick = function() {
|
||||
onClickFailures();
|
||||
return false;
|
||||
};
|
||||
|
||||
specListLink.onclick = function() {
|
||||
onClickSpecList();
|
||||
return false;
|
||||
};
|
||||
|
||||
this.#alerts.addBar(
|
||||
createDom(
|
||||
'span',
|
||||
{ className: 'jasmine-menu jasmine-bar jasmine-spec-list' },
|
||||
[createDom('span', {}, 'Spec List | '), failuresLink]
|
||||
)
|
||||
);
|
||||
this.#alerts.addBar(
|
||||
createDom(
|
||||
'span',
|
||||
{ className: 'jasmine-menu jasmine-bar jasmine-failure-list' },
|
||||
[specListLink, createDom('span', {}, ' | Failures ')]
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
#find(selector) {
|
||||
return this.#getContainer().querySelector(
|
||||
'.jasmine_html-reporter ' + selector
|
||||
);
|
||||
}
|
||||
|
||||
#clearPrior() {
|
||||
const oldReporter = this.#find('');
|
||||
|
||||
if (oldReporter) {
|
||||
this.#getContainer().removeChild(oldReporter);
|
||||
}
|
||||
}
|
||||
|
||||
#setMenuModeTo(mode) {
|
||||
this.#htmlReporterMain.setAttribute(
|
||||
'class',
|
||||
'jasmine_html-reporter ' + mode
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class UrlBuilder {
|
||||
#addToExistingQueryString;
|
||||
|
||||
constructor(addToExistingQueryString) {
|
||||
this.#addToExistingQueryString = function(k, v) {
|
||||
// include window.location.pathname to fix issue with karma-jasmine-html-reporter in angular: see https://github.com/jasmine/jasmine/issues/1906
|
||||
return (
|
||||
(window.location.pathname || '') + addToExistingQueryString(k, v)
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
suiteHref(suite) {
|
||||
const els = [];
|
||||
|
||||
while (suite && suite.parent) {
|
||||
els.unshift(suite.result.description);
|
||||
suite = suite.parent;
|
||||
}
|
||||
|
||||
return this.#addToExistingQueryString('spec', els.join(' '));
|
||||
}
|
||||
|
||||
specHref(result) {
|
||||
return this.#addToExistingQueryString('spec', result.fullName);
|
||||
}
|
||||
|
||||
runAllHref() {
|
||||
return this.#addToExistingQueryString('spec', '');
|
||||
}
|
||||
|
||||
seedHref(seed) {
|
||||
return this.#addToExistingQueryString('seed', seed);
|
||||
}
|
||||
}
|
||||
|
||||
function defaultQueryString(key, value) {
|
||||
return '?' + key + '=' + value;
|
||||
}
|
||||
|
||||
return HtmlReporter;
|
||||
};
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
jasmineRequire.ResultsNode = function() {
|
||||
'use strict';
|
||||
|
||||
@@ -1744,46 +1450,6 @@ jasmineRequire.SummaryTreeView = function(j$) {
|
||||
return SummaryTreeView;
|
||||
};
|
||||
|
||||
jasmineRequire.SymbolsView = function(j$) {
|
||||
'use strict';
|
||||
|
||||
const { createDom, noExpectations } = j$.private.htmlReporterUtils;
|
||||
|
||||
class SymbolsView {
|
||||
constructor() {
|
||||
this.rootEl = createDom('ul', {
|
||||
className: 'jasmine-symbol-summary'
|
||||
});
|
||||
}
|
||||
|
||||
append(result, config) {
|
||||
this.rootEl.appendChild(
|
||||
createDom('li', {
|
||||
className: this.#className(result, config),
|
||||
id: 'spec_' + result.id,
|
||||
title: result.fullName
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
#className(result, config) {
|
||||
if (noExpectations(result) && result.status === 'passed') {
|
||||
return 'jasmine-empty';
|
||||
} else if (result.status === 'excluded') {
|
||||
if (config.hideDisabled) {
|
||||
return 'jasmine-excluded-no-display';
|
||||
} else {
|
||||
return 'jasmine-excluded';
|
||||
}
|
||||
} else {
|
||||
return 'jasmine-' + result.status;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return SymbolsView;
|
||||
};
|
||||
|
||||
jasmineRequire.TabBar = function(j$) {
|
||||
const createDom = j$.private.htmlReporterUtils.createDom;
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@ body {
|
||||
line-height: 14px;
|
||||
}
|
||||
.jasmine_html-reporter .jasmine-banner,
|
||||
.jasmine_html-reporter .jasmine-symbol-summary,
|
||||
.jasmine_html-reporter .jasmine-summary,
|
||||
.jasmine_html-reporter .jasmine-result-message,
|
||||
.jasmine_html-reporter .jasmine-spec .jasmine-description,
|
||||
@@ -65,57 +64,6 @@ body {
|
||||
padding-right: 9px;
|
||||
font-size: 12px;
|
||||
}
|
||||
.jasmine_html-reporter .jasmine-symbol-summary {
|
||||
overflow: hidden;
|
||||
margin: 14px 0;
|
||||
}
|
||||
.jasmine_html-reporter .jasmine-symbol-summary li {
|
||||
display: inline-block;
|
||||
height: 10px;
|
||||
width: 14px;
|
||||
font-size: 16px;
|
||||
}
|
||||
.jasmine_html-reporter .jasmine-symbol-summary li.jasmine-passed {
|
||||
font-size: 14px;
|
||||
}
|
||||
.jasmine_html-reporter .jasmine-symbol-summary li.jasmine-passed:before {
|
||||
color: #007069;
|
||||
content: "•";
|
||||
}
|
||||
.jasmine_html-reporter .jasmine-symbol-summary li.jasmine-failed {
|
||||
line-height: 9px;
|
||||
}
|
||||
.jasmine_html-reporter .jasmine-symbol-summary li.jasmine-failed:before {
|
||||
color: #ca3a11;
|
||||
content: "×";
|
||||
font-weight: bold;
|
||||
margin-left: -1px;
|
||||
}
|
||||
.jasmine_html-reporter .jasmine-symbol-summary li.jasmine-excluded {
|
||||
font-size: 14px;
|
||||
}
|
||||
.jasmine_html-reporter .jasmine-symbol-summary li.jasmine-excluded:before {
|
||||
color: #bababa;
|
||||
content: "•";
|
||||
}
|
||||
.jasmine_html-reporter .jasmine-symbol-summary li.jasmine-excluded-no-display {
|
||||
font-size: 14px;
|
||||
display: none;
|
||||
}
|
||||
.jasmine_html-reporter .jasmine-symbol-summary li.jasmine-pending {
|
||||
line-height: 17px;
|
||||
}
|
||||
.jasmine_html-reporter .jasmine-symbol-summary li.jasmine-pending:before {
|
||||
color: #ba9d37;
|
||||
content: "*";
|
||||
}
|
||||
.jasmine_html-reporter .jasmine-symbol-summary li.jasmine-empty {
|
||||
font-size: 14px;
|
||||
}
|
||||
.jasmine_html-reporter .jasmine-symbol-summary li.jasmine-empty:before {
|
||||
color: #ba9d37;
|
||||
content: "•";
|
||||
}
|
||||
.jasmine_html-reporter progress {
|
||||
width: 100%;
|
||||
}
|
||||
@@ -197,12 +145,10 @@ body {
|
||||
.jasmine_html-reporter .jasmine-bar a {
|
||||
color: white;
|
||||
}
|
||||
.jasmine_html-reporter.jasmine-spec-list .jasmine-bar.jasmine-menu.jasmine-failure-list,
|
||||
.jasmine_html-reporter.jasmine-spec-list .jasmine-results .jasmine-failures,
|
||||
.jasmine_html-reporter.jasmine-spec-list .jasmine-performance-view {
|
||||
display: none;
|
||||
}
|
||||
.jasmine_html-reporter.jasmine-failure-list .jasmine-bar.jasmine-menu.jasmine-spec-list,
|
||||
.jasmine_html-reporter.jasmine-failure-list .jasmine-summary,
|
||||
.jasmine_html-reporter.jasmine-failure-list .jasmine-performance-view {
|
||||
display: none;
|
||||
|
||||
@@ -35,8 +35,6 @@ function concatFiles() {
|
||||
{
|
||||
src: [
|
||||
'src/html/requireHtml.js',
|
||||
'src/html/HtmlReporter.js',
|
||||
'src/html/HtmlSpecFilter.js',
|
||||
'src/html/ResultsNode.js',
|
||||
'src/html/QueryString.js',
|
||||
'src/html/**/*.js'
|
||||
|
||||
@@ -118,10 +118,8 @@ describe('The jasmine namespace', function() {
|
||||
|
||||
if (includeHtml) {
|
||||
// jasmine-html.js
|
||||
result.add('HtmlReporter');
|
||||
result.add('HtmlReporterV2');
|
||||
result.add('HtmlReporterV2Urls');
|
||||
result.add('HtmlSpecFilter');
|
||||
result.add('QueryString');
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,43 +0,0 @@
|
||||
describe('HtmlSpecFilter', function() {
|
||||
let env, deprecator;
|
||||
|
||||
beforeEach(function() {
|
||||
deprecator = jasmine.createSpyObj('deprecator', [
|
||||
'verboseDeprecations',
|
||||
'addDeprecationWarning'
|
||||
]);
|
||||
env = new privateUnderTest.Env({ deprecator });
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
env.cleanup_();
|
||||
});
|
||||
|
||||
it('emits a deprecation warning', function() {
|
||||
new jasmineUnderTest.HtmlSpecFilter({ env });
|
||||
expect(deprecator.addDeprecationWarning).toHaveBeenCalledWith(
|
||||
jasmine.anything(),
|
||||
'HtmlReporter and HtmlSpecFilter are deprecated. Use HtmlReporterV2 instead.',
|
||||
undefined
|
||||
);
|
||||
});
|
||||
|
||||
it('should match when no string is provided', function() {
|
||||
const specFilter = new jasmineUnderTest.HtmlSpecFilter({ env });
|
||||
|
||||
expect(specFilter.matches('foo')).toBe(true);
|
||||
expect(specFilter.matches('*bar')).toBe(true);
|
||||
});
|
||||
|
||||
it('should only match the provided string', function() {
|
||||
const specFilter = new jasmineUnderTest.HtmlSpecFilter({
|
||||
env,
|
||||
filterString: function() {
|
||||
return 'foo';
|
||||
}
|
||||
});
|
||||
|
||||
expect(specFilter.matches('foo')).toBe(true);
|
||||
expect(specFilter.matches('bar')).toBe(false);
|
||||
});
|
||||
});
|
||||
@@ -1,254 +0,0 @@
|
||||
jasmineRequire.HtmlReporter = function(j$) {
|
||||
'use strict';
|
||||
|
||||
const { createDom, noExpectations } = j$.private.htmlReporterUtils;
|
||||
|
||||
/**
|
||||
* @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
|
||||
* @deprecated Use {@link HtmlReporterV2} instead.
|
||||
*/
|
||||
class HtmlReporter {
|
||||
#env;
|
||||
#getContainer;
|
||||
#navigateWithNewParam;
|
||||
#urlBuilder;
|
||||
#filterSpecs;
|
||||
#stateBuilder;
|
||||
#config;
|
||||
#htmlReporterMain;
|
||||
|
||||
// Sub-views
|
||||
#alerts;
|
||||
#symbols;
|
||||
#banner;
|
||||
#failures;
|
||||
|
||||
constructor(options) {
|
||||
this.#env = options.env;
|
||||
|
||||
this.#getContainer = options.getContainer;
|
||||
this.#navigateWithNewParam =
|
||||
options.navigateWithNewParam || function() {};
|
||||
this.#urlBuilder = new UrlBuilder(
|
||||
options.addToExistingQueryString || defaultQueryString
|
||||
);
|
||||
this.#filterSpecs = options.filterSpecs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the reporter. Should be called before {@link Env#execute}.
|
||||
* @function
|
||||
* @name HtmlReporter#initialize
|
||||
*/
|
||||
initialize() {
|
||||
this.#env.deprecated(
|
||||
'HtmlReporter and HtmlSpecFilter are deprecated. Use HtmlReporterV2 instead.'
|
||||
);
|
||||
this.#clearPrior();
|
||||
this.#config = this.#env ? this.#env.configuration() : {};
|
||||
|
||||
this.#stateBuilder = new j$.private.ResultsStateBuilder();
|
||||
|
||||
this.#alerts = new j$.private.AlertsView(this.#urlBuilder);
|
||||
this.#symbols = new j$.private.SymbolsView();
|
||||
this.#banner = new j$.private.Banner(this.#navigateWithNewParam);
|
||||
this.#failures = new j$.private.FailuresView(this.#urlBuilder);
|
||||
this.#htmlReporterMain = createDom(
|
||||
'div',
|
||||
{ className: 'jasmine_html-reporter' },
|
||||
this.#banner.rootEl,
|
||||
this.#symbols.rootEl,
|
||||
this.#alerts.rootEl,
|
||||
this.#failures.rootEl
|
||||
);
|
||||
this.#getContainer().appendChild(this.#htmlReporterMain);
|
||||
}
|
||||
|
||||
jasmineStarted(options) {
|
||||
this.#stateBuilder.jasmineStarted(options);
|
||||
}
|
||||
|
||||
suiteStarted(result) {
|
||||
this.#stateBuilder.suiteStarted(result);
|
||||
}
|
||||
|
||||
suiteDone(result) {
|
||||
this.#stateBuilder.suiteDone(result);
|
||||
|
||||
if (result.status === 'failed') {
|
||||
this.#failures.append(result, this.#stateBuilder.currentParent);
|
||||
}
|
||||
}
|
||||
|
||||
specStarted() {}
|
||||
|
||||
specDone(result) {
|
||||
this.#stateBuilder.specDone(result);
|
||||
this.#symbols.append(result, this.#config);
|
||||
|
||||
if (noExpectations(result)) {
|
||||
const noSpecMsg = "Spec '" + result.fullName + "' has no expectations.";
|
||||
if (result.status === 'failed') {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(noSpecMsg);
|
||||
} else {
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn(noSpecMsg);
|
||||
}
|
||||
}
|
||||
|
||||
if (result.status === 'failed') {
|
||||
this.#failures.append(result, this.#stateBuilder.currentParent);
|
||||
}
|
||||
}
|
||||
|
||||
jasmineDone(doneResult) {
|
||||
this.#stateBuilder.jasmineDone(doneResult);
|
||||
this.#banner.showOptionsMenu(this.#config);
|
||||
|
||||
if (
|
||||
this.#stateBuilder.specsExecuted < this.#stateBuilder.totalSpecsDefined
|
||||
) {
|
||||
this.#alerts.addSkipped(
|
||||
this.#stateBuilder.specsExecuted,
|
||||
this.#stateBuilder.totalSpecsDefined
|
||||
);
|
||||
}
|
||||
|
||||
const statusBar = new j$.private.OverallStatusBar(this.#urlBuilder);
|
||||
statusBar.showDone(doneResult, this.#stateBuilder);
|
||||
this.#alerts.addBar(statusBar.rootEl);
|
||||
|
||||
if (doneResult.failedExpectations) {
|
||||
for (const f of doneResult.failedExpectations) {
|
||||
this.#alerts.addGlobalFailure(f);
|
||||
}
|
||||
}
|
||||
|
||||
for (const dw of this.#stateBuilder.deprecationWarnings) {
|
||||
this.#alerts.addDeprecationWarning(dw);
|
||||
}
|
||||
|
||||
const results = this.#find('.jasmine-results');
|
||||
const summary = new j$.private.SummaryTreeView(
|
||||
this.#urlBuilder,
|
||||
this.#filterSpecs
|
||||
);
|
||||
summary.addResults(this.#stateBuilder.topResults);
|
||||
results.appendChild(summary.rootEl);
|
||||
|
||||
if (this.#stateBuilder.anyNonTopSuiteFailures) {
|
||||
this.#addFailureToggle();
|
||||
this.#setMenuModeTo('jasmine-failure-list');
|
||||
this.#failures.show();
|
||||
}
|
||||
}
|
||||
|
||||
#addFailureToggle() {
|
||||
const onClickFailures = () => this.#setMenuModeTo('jasmine-failure-list');
|
||||
const onClickSpecList = () => this.#setMenuModeTo('jasmine-spec-list');
|
||||
const failuresLink = createDom(
|
||||
'a',
|
||||
{ className: 'jasmine-failures-menu', href: '#' },
|
||||
'Failures'
|
||||
);
|
||||
let specListLink = createDom(
|
||||
'a',
|
||||
{ className: 'jasmine-spec-list-menu', href: '#' },
|
||||
'Spec List'
|
||||
);
|
||||
|
||||
failuresLink.onclick = function() {
|
||||
onClickFailures();
|
||||
return false;
|
||||
};
|
||||
|
||||
specListLink.onclick = function() {
|
||||
onClickSpecList();
|
||||
return false;
|
||||
};
|
||||
|
||||
this.#alerts.addBar(
|
||||
createDom(
|
||||
'span',
|
||||
{ className: 'jasmine-menu jasmine-bar jasmine-spec-list' },
|
||||
[createDom('span', {}, 'Spec List | '), failuresLink]
|
||||
)
|
||||
);
|
||||
this.#alerts.addBar(
|
||||
createDom(
|
||||
'span',
|
||||
{ className: 'jasmine-menu jasmine-bar jasmine-failure-list' },
|
||||
[specListLink, createDom('span', {}, ' | Failures ')]
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
#find(selector) {
|
||||
return this.#getContainer().querySelector(
|
||||
'.jasmine_html-reporter ' + selector
|
||||
);
|
||||
}
|
||||
|
||||
#clearPrior() {
|
||||
const oldReporter = this.#find('');
|
||||
|
||||
if (oldReporter) {
|
||||
this.#getContainer().removeChild(oldReporter);
|
||||
}
|
||||
}
|
||||
|
||||
#setMenuModeTo(mode) {
|
||||
this.#htmlReporterMain.setAttribute(
|
||||
'class',
|
||||
'jasmine_html-reporter ' + mode
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class UrlBuilder {
|
||||
#addToExistingQueryString;
|
||||
|
||||
constructor(addToExistingQueryString) {
|
||||
this.#addToExistingQueryString = function(k, v) {
|
||||
// include window.location.pathname to fix issue with karma-jasmine-html-reporter in angular: see https://github.com/jasmine/jasmine/issues/1906
|
||||
return (
|
||||
(window.location.pathname || '') + addToExistingQueryString(k, v)
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
suiteHref(suite) {
|
||||
const els = [];
|
||||
|
||||
while (suite && suite.parent) {
|
||||
els.unshift(suite.result.description);
|
||||
suite = suite.parent;
|
||||
}
|
||||
|
||||
return this.#addToExistingQueryString('spec', els.join(' '));
|
||||
}
|
||||
|
||||
specHref(result) {
|
||||
return this.#addToExistingQueryString('spec', result.fullName);
|
||||
}
|
||||
|
||||
runAllHref() {
|
||||
return this.#addToExistingQueryString('spec', '');
|
||||
}
|
||||
|
||||
seedHref(seed) {
|
||||
return this.#addToExistingQueryString('seed', seed);
|
||||
}
|
||||
}
|
||||
|
||||
function defaultQueryString(key, value) {
|
||||
return '?' + key + '=' + value;
|
||||
}
|
||||
|
||||
return HtmlReporter;
|
||||
};
|
||||
@@ -1,35 +0,0 @@
|
||||
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;
|
||||
};
|
||||
@@ -1,39 +0,0 @@
|
||||
jasmineRequire.SymbolsView = function(j$) {
|
||||
'use strict';
|
||||
|
||||
const { createDom, noExpectations } = j$.private.htmlReporterUtils;
|
||||
|
||||
class SymbolsView {
|
||||
constructor() {
|
||||
this.rootEl = createDom('ul', {
|
||||
className: 'jasmine-symbol-summary'
|
||||
});
|
||||
}
|
||||
|
||||
append(result, config) {
|
||||
this.rootEl.appendChild(
|
||||
createDom('li', {
|
||||
className: this.#className(result, config),
|
||||
id: 'spec_' + result.id,
|
||||
title: result.fullName
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
#className(result, config) {
|
||||
if (noExpectations(result) && result.status === 'passed') {
|
||||
return 'jasmine-empty';
|
||||
} else if (result.status === 'excluded') {
|
||||
if (config.hideDisabled) {
|
||||
return 'jasmine-excluded-no-display';
|
||||
} else {
|
||||
return 'jasmine-excluded';
|
||||
}
|
||||
} else {
|
||||
return 'jasmine-' + result.status;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return SymbolsView;
|
||||
};
|
||||
@@ -55,7 +55,6 @@ body {
|
||||
}
|
||||
|
||||
.jasmine-banner,
|
||||
.jasmine-symbol-summary,
|
||||
.jasmine-summary,
|
||||
.jasmine-result-message,
|
||||
.jasmine-spec .jasmine-description,
|
||||
@@ -107,73 +106,7 @@ body {
|
||||
font-size: $font-size;
|
||||
}
|
||||
|
||||
//--- Symbol summary (v1 reporter) ---//
|
||||
|
||||
.jasmine-symbol-summary {
|
||||
overflow: hidden;
|
||||
margin: $line-height 0;
|
||||
|
||||
li {
|
||||
display: inline-block;
|
||||
height: math.div($line-height, 2) + 3;
|
||||
width: $line-height;
|
||||
|
||||
font-size: 16px;
|
||||
|
||||
&.jasmine-passed {
|
||||
font-size: 14px;
|
||||
|
||||
&:before {
|
||||
color: $passing-color;
|
||||
content: $passing-mark;
|
||||
}
|
||||
}
|
||||
|
||||
&.jasmine-failed {
|
||||
line-height: math.div($line-height, 2) + 2;
|
||||
|
||||
&:before {
|
||||
color: $failing-color;
|
||||
content: $failing-mark;
|
||||
font-weight: bold;
|
||||
margin-left: -1px;
|
||||
}
|
||||
}
|
||||
|
||||
&.jasmine-excluded {
|
||||
font-size: 14px;
|
||||
|
||||
&:before {
|
||||
color: $neutral-color;
|
||||
content: $passing-mark;
|
||||
}
|
||||
}
|
||||
|
||||
&.jasmine-excluded-no-display {
|
||||
font-size: 14px;
|
||||
display: none;
|
||||
}
|
||||
|
||||
&.jasmine-pending {
|
||||
line-height: 17px;
|
||||
&:before {
|
||||
color: $pending-color;
|
||||
content: $pending-mark;
|
||||
}
|
||||
}
|
||||
|
||||
&.jasmine-empty {
|
||||
font-size: 14px;
|
||||
|
||||
&:before {
|
||||
color: $pending-color;
|
||||
content: $passing-mark;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--- Progress bar (v2 reporter) ---//
|
||||
//--- Progress bar ---//
|
||||
|
||||
progress {
|
||||
width: 100%;
|
||||
@@ -279,10 +212,8 @@ body {
|
||||
}
|
||||
}
|
||||
|
||||
// simplify toggle control between the two menu bars
|
||||
// TODO: clean this up once HtmlReporter is removed
|
||||
// Switch between the three tabs
|
||||
&.jasmine-spec-list {
|
||||
.jasmine-bar.jasmine-menu.jasmine-failure-list,
|
||||
.jasmine-results .jasmine-failures,
|
||||
.jasmine-performance-view {
|
||||
display: none;
|
||||
@@ -290,7 +221,6 @@ body {
|
||||
}
|
||||
|
||||
&.jasmine-failure-list {
|
||||
.jasmine-bar.jasmine-menu.jasmine-spec-list,
|
||||
.jasmine-summary,
|
||||
.jasmine-performance-view {
|
||||
display: none;
|
||||
|
||||
@@ -8,15 +8,12 @@ jasmineRequire.html = function(j$) {
|
||||
j$.private.AlertsView = jasmineRequire.AlertsView(j$);
|
||||
j$.private.OverallStatusBar = jasmineRequire.OverallStatusBar(j$);
|
||||
j$.private.Banner = jasmineRequire.Banner(j$);
|
||||
j$.private.SymbolsView = jasmineRequire.SymbolsView(j$);
|
||||
j$.private.SummaryTreeView = jasmineRequire.SummaryTreeView(j$);
|
||||
j$.private.FailuresView = jasmineRequire.FailuresView(j$);
|
||||
j$.private.PerformanceView = jasmineRequire.PerformanceView(j$);
|
||||
j$.private.TabBar = jasmineRequire.TabBar(j$);
|
||||
j$.HtmlReporter = jasmineRequire.HtmlReporter(j$);
|
||||
j$.HtmlReporterV2Urls = jasmineRequire.HtmlReporterV2Urls(j$);
|
||||
j$.HtmlReporterV2 = jasmineRequire.HtmlReporterV2(j$);
|
||||
j$.QueryString = jasmineRequire.QueryString();
|
||||
j$.HtmlSpecFilter = jasmineRequire.HtmlSpecFilter(j$);
|
||||
j$.private.HtmlSpecFilterV2 = jasmineRequire.HtmlSpecFilterV2();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user