Clicking a link in HtmlReporterV2 does exact filtering
This commit is contained in:
@@ -1010,7 +1010,10 @@ jasmineRequire.HtmlReporterV2 = function(j$) {
|
|||||||
return window.location;
|
return window.location;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.#urlBuilder = new UrlBuilder(this.#queryString);
|
this.#urlBuilder = new UrlBuilder({
|
||||||
|
queryString: this.#queryString,
|
||||||
|
getSuiteById: id => this.#stateBuilder.suitesById[id]
|
||||||
|
});
|
||||||
this.#filterSpecs = options.urls.filteringSpecs();
|
this.#filterSpecs = options.urls.filteringSpecs();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1147,34 +1150,48 @@ jasmineRequire.HtmlReporterV2 = function(j$) {
|
|||||||
|
|
||||||
class UrlBuilder {
|
class UrlBuilder {
|
||||||
#queryString;
|
#queryString;
|
||||||
|
#getSuiteById;
|
||||||
|
|
||||||
constructor(queryString) {
|
constructor(options) {
|
||||||
this.#queryString = queryString;
|
this.#queryString = options.queryString;
|
||||||
|
this.#getSuiteById = options.getSuiteById;
|
||||||
}
|
}
|
||||||
|
|
||||||
suiteHref(suite) {
|
suiteHref(suite) {
|
||||||
const els = [];
|
const path = this.#suitePath(suite);
|
||||||
|
return this.#specPathHref(path);
|
||||||
while (suite && suite.parent) {
|
|
||||||
els.unshift(suite.result.description);
|
|
||||||
suite = suite.parent;
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.#addToExistingQueryString('spec', els.join(' '));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
specHref(result) {
|
specHref(specResult) {
|
||||||
return this.#addToExistingQueryString('spec', result.fullName);
|
const suite = this.#getSuiteById(specResult.parentSuiteId);
|
||||||
|
const path = this.#suitePath(suite);
|
||||||
|
path.push(specResult.description);
|
||||||
|
return this.#specPathHref(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
runAllHref() {
|
runAllHref() {
|
||||||
return this.#addToExistingQueryString('spec', '');
|
return this.#addToExistingQueryString('path', '');
|
||||||
}
|
}
|
||||||
|
|
||||||
seedHref(seed) {
|
seedHref(seed) {
|
||||||
return this.#addToExistingQueryString('seed', seed);
|
return this.#addToExistingQueryString('seed', seed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#suitePath(suite) {
|
||||||
|
const path = [];
|
||||||
|
|
||||||
|
while (suite && suite.parent) {
|
||||||
|
path.unshift(suite.result.description);
|
||||||
|
suite = suite.parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
|
#specPathHref(specPath) {
|
||||||
|
return this.#addToExistingQueryString('path', JSON.stringify(specPath));
|
||||||
|
}
|
||||||
|
|
||||||
#addToExistingQueryString(k, v) {
|
#addToExistingQueryString(k, v) {
|
||||||
// include window.location.pathname to fix issue with karma-jasmine-html-reporter in angular: see https://github.com/jasmine/jasmine/issues/1906
|
// include window.location.pathname to fix issue with karma-jasmine-html-reporter in angular: see https://github.com/jasmine/jasmine/issues/1906
|
||||||
return (
|
return (
|
||||||
@@ -1190,6 +1207,7 @@ jasmineRequire.HtmlReporterV2 = function(j$) {
|
|||||||
jasmineRequire.HtmlReporterV2Urls = function(j$) {
|
jasmineRequire.HtmlReporterV2Urls = function(j$) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
// TODO unify with V2 UrlBuilder?
|
||||||
// TODO jsdoc
|
// TODO jsdoc
|
||||||
class HtmlReporterV2Urls {
|
class HtmlReporterV2Urls {
|
||||||
constructor(options = {}) {
|
constructor(options = {}) {
|
||||||
@@ -1227,19 +1245,19 @@ jasmineRequire.HtmlReporterV2Urls = function(j$) {
|
|||||||
|
|
||||||
const specFilter = new j$.private.HtmlSpecFilterV2({
|
const specFilter = new j$.private.HtmlSpecFilterV2({
|
||||||
filterString: () => {
|
filterString: () => {
|
||||||
return this.queryString.getParam('spec');
|
return this.queryString.getParam('path');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
config.specFilter = function(spec) {
|
config.specFilter = function(spec) {
|
||||||
return specFilter.matches(spec.getFullName());
|
return specFilter.matches(spec);
|
||||||
};
|
};
|
||||||
|
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
|
|
||||||
filteringSpecs() {
|
filteringSpecs() {
|
||||||
return !!this.queryString.getParam('spec');
|
return !!this.queryString.getParam('path');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1247,25 +1265,42 @@ jasmineRequire.HtmlReporterV2Urls = function(j$) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
jasmineRequire.HtmlSpecFilterV2 = function() {
|
jasmineRequire.HtmlSpecFilterV2 = function() {
|
||||||
'use strict';
|
class HtmlSpecFilterV2 {
|
||||||
|
#getFilterString;
|
||||||
|
|
||||||
function HtmlSpecFilterV2(options) {
|
constructor(options) {
|
||||||
const filterString =
|
this.#getFilterString = options.filterString;
|
||||||
options &&
|
}
|
||||||
options.filterString() &&
|
|
||||||
options.filterString().replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
|
|
||||||
const filterPattern = new RegExp(filterString);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines whether the spec with the specified name should be executed.
|
* Determines whether the spec with the specified name should be executed.
|
||||||
* @name HtmlSpecFilter#matches
|
* @name HtmlSpecFilterV2#matches
|
||||||
* @function
|
* @function
|
||||||
* @param {string} specName The full name of the spec
|
* @param {Spec} spec
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
this.matches = function(specName) {
|
matches(spec) {
|
||||||
return filterPattern.test(specName);
|
const filterString = this.#getFilterString();
|
||||||
};
|
|
||||||
|
if (!filterString) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
const filterPath = JSON.parse(this.#getFilterString());
|
||||||
|
const specPath = spec.getPath();
|
||||||
|
|
||||||
|
if (filterPath.length > specPath.length) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let i = 0; i < filterPath.length; i++) {
|
||||||
|
if (specPath[i] !== filterPath[i]) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return HtmlSpecFilterV2;
|
return HtmlSpecFilterV2;
|
||||||
@@ -1278,6 +1313,7 @@ jasmineRequire.ResultsStateBuilder = function(j$) {
|
|||||||
constructor() {
|
constructor() {
|
||||||
this.topResults = new j$.private.ResultsNode({}, '', null);
|
this.topResults = new j$.private.ResultsNode({}, '', null);
|
||||||
this.currentParent = this.topResults;
|
this.currentParent = this.topResults;
|
||||||
|
this.suitesById = {};
|
||||||
this.totalSpecsDefined = 0;
|
this.totalSpecsDefined = 0;
|
||||||
this.specsExecuted = 0;
|
this.specsExecuted = 0;
|
||||||
this.failureCount = 0;
|
this.failureCount = 0;
|
||||||
@@ -1288,6 +1324,7 @@ jasmineRequire.ResultsStateBuilder = function(j$) {
|
|||||||
suiteStarted(result) {
|
suiteStarted(result) {
|
||||||
this.currentParent.addChild(result, 'suite');
|
this.currentParent.addChild(result, 'suite');
|
||||||
this.currentParent = this.currentParent.last();
|
this.currentParent = this.currentParent.last();
|
||||||
|
this.suitesById[result.id] = this.currentParent;
|
||||||
}
|
}
|
||||||
|
|
||||||
suiteDone(result) {
|
suiteDone(result) {
|
||||||
|
|||||||
@@ -349,6 +349,7 @@ describe('HtmlReporterV2', function() {
|
|||||||
|
|
||||||
let specResult = {
|
let specResult = {
|
||||||
id: 123,
|
id: 123,
|
||||||
|
parentSuiteId: 1,
|
||||||
description: 'with a spec',
|
description: 'with a spec',
|
||||||
fullName: 'A Suite with a spec',
|
fullName: 'A Suite with a spec',
|
||||||
status: 'passed',
|
status: 'passed',
|
||||||
@@ -423,7 +424,9 @@ describe('HtmlReporterV2', function() {
|
|||||||
const suiteDetail = outerSuite.childNodes[0];
|
const suiteDetail = outerSuite.childNodes[0];
|
||||||
const suiteLink = suiteDetail.childNodes[0];
|
const suiteLink = suiteDetail.childNodes[0];
|
||||||
expect(suiteLink.innerHTML).toEqual('A Suite');
|
expect(suiteLink.innerHTML).toEqual('A Suite');
|
||||||
expect(suiteLink.getAttribute('href')).toEqual('/?spec=A%20Suite');
|
expect(suiteLink.getAttribute('href')).toEqual(
|
||||||
|
`/?path=${encodeURIComponent('["A Suite"]')}`
|
||||||
|
);
|
||||||
|
|
||||||
const specs = outerSuite.childNodes[1];
|
const specs = outerSuite.childNodes[1];
|
||||||
const spec = specs.childNodes[0];
|
const spec = specs.childNodes[0];
|
||||||
@@ -433,7 +436,7 @@ describe('HtmlReporterV2', function() {
|
|||||||
const specLink = spec.childNodes[0];
|
const specLink = spec.childNodes[0];
|
||||||
expect(specLink.innerHTML).toEqual('with a spec');
|
expect(specLink.innerHTML).toEqual('with a spec');
|
||||||
expect(specLink.getAttribute('href')).toEqual(
|
expect(specLink.getAttribute('href')).toEqual(
|
||||||
'/?spec=A%20Suite%20with%20a%20spec'
|
`/?path=${encodeURIComponent('["A Suite","with a spec"]')}`
|
||||||
);
|
);
|
||||||
|
|
||||||
const specDuration = spec.childNodes[1];
|
const specDuration = spec.childNodes[1];
|
||||||
@@ -779,7 +782,7 @@ describe('HtmlReporterV2', function() {
|
|||||||
reporter.jasmineDone({ order: { random: true } });
|
reporter.jasmineDone({ order: { random: true } });
|
||||||
|
|
||||||
const skippedLink = container.querySelector('.jasmine-skipped a');
|
const skippedLink = container.querySelector('.jasmine-skipped a');
|
||||||
expect(skippedLink.getAttribute('href')).toEqual('/?spec=');
|
expect(skippedLink.getAttribute('href')).toEqual('/?path=');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -985,6 +988,7 @@ describe('HtmlReporterV2', function() {
|
|||||||
|
|
||||||
const failingSpecResult = {
|
const failingSpecResult = {
|
||||||
id: 124,
|
id: 124,
|
||||||
|
parentSuiteId: 2,
|
||||||
status: 'failed',
|
status: 'failed',
|
||||||
description: 'a failing spec',
|
description: 'a failing spec',
|
||||||
fullName: 'a suite inner suite a failing spec',
|
fullName: 'a suite inner suite a failing spec',
|
||||||
@@ -1106,16 +1110,20 @@ describe('HtmlReporterV2', function() {
|
|||||||
expect(links.length).toEqual(3);
|
expect(links.length).toEqual(3);
|
||||||
expect(links[0].textContent).toEqual('A suite');
|
expect(links[0].textContent).toEqual('A suite');
|
||||||
|
|
||||||
expect(links[0].getAttribute('href')).toMatch(/\?spec=A%20suite/);
|
expect(links[0].getAttribute('href')).toEqual(
|
||||||
|
`/?path=${encodeURIComponent('["A suite"]')}`
|
||||||
|
);
|
||||||
|
|
||||||
expect(links[1].textContent).toEqual('inner suite');
|
expect(links[1].textContent).toEqual('inner suite');
|
||||||
expect(links[1].getAttribute('href')).toMatch(
|
expect(links[1].getAttribute('href')).toEqual(
|
||||||
/\?spec=A%20suite%20inner%20suite/
|
`/?path=${encodeURIComponent('["A suite","inner suite"]')}`
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(links[2].textContent).toEqual('a failing spec');
|
expect(links[2].textContent).toEqual('a failing spec');
|
||||||
expect(links[2].getAttribute('href')).toMatch(
|
expect(links[2].getAttribute('href')).toEqual(
|
||||||
/\?spec=a%20suite%20inner%20suite%20a%20failing%20spec/
|
`/?path=${encodeURIComponent(
|
||||||
|
'["A suite","inner suite","a failing spec"]'
|
||||||
|
)}`
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -10,17 +10,17 @@ describe('HtmlReporterV2Urls', function() {
|
|||||||
|
|
||||||
it('configures a matching spec filter', function() {
|
it('configures a matching spec filter', function() {
|
||||||
const queryString = mockQueryString();
|
const queryString = mockQueryString();
|
||||||
queryString.getParam.withArgs('spec').and.returnValue('foo');
|
queryString.getParam.withArgs('path').and.returnValue('["foo","bar"]');
|
||||||
const subject = new jasmineUnderTest.HtmlReporterV2Urls({ queryString });
|
const subject = new jasmineUnderTest.HtmlReporterV2Urls({ queryString });
|
||||||
const config = subject.configFromCurrentUrl();
|
const config = subject.configFromCurrentUrl();
|
||||||
const matching = {
|
const matching = {
|
||||||
getFullName() {
|
getPath() {
|
||||||
return 'foobar';
|
return ['foo', 'bar'];
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const nonMatching = {
|
const nonMatching = {
|
||||||
getFullName() {
|
getPath() {
|
||||||
return 'baz';
|
return ['foobar'];
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
expect(config.specFilter(matching)).toEqual(true);
|
expect(config.specFilter(matching)).toEqual(true);
|
||||||
|
|||||||
@@ -1,19 +1,49 @@
|
|||||||
describe('HtmlSpecFilterV2', function() {
|
describe('HtmlSpecFilterV2', function() {
|
||||||
it('should match when no string is provided', function() {
|
it('matches everything when no string is provided', function() {
|
||||||
const specFilter = new privateUnderTest.HtmlSpecFilterV2();
|
|
||||||
|
|
||||||
expect(specFilter.matches('foo')).toBe(true);
|
|
||||||
expect(specFilter.matches('*bar')).toBe(true);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should only match the provided string', function() {
|
|
||||||
const specFilter = new privateUnderTest.HtmlSpecFilterV2({
|
const specFilter = new privateUnderTest.HtmlSpecFilterV2({
|
||||||
filterString: function() {
|
filterString() {
|
||||||
return 'foo';
|
return '';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(specFilter.matches('foo')).toBe(true);
|
expect(specFilter.matches({})).toBeTrue();
|
||||||
expect(specFilter.matches('bar')).toBe(false);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('matches a spec with the exact same path', function() {
|
||||||
|
const specFilter = new privateUnderTest.HtmlSpecFilterV2({
|
||||||
|
filterString() {
|
||||||
|
return '["a","b","c"]';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(specFilter.matches(stubSpec(['a', 'b', 'c']))).toBeTrue();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('matches a spec whose path has the filter path as a prefix', function() {
|
||||||
|
const specFilter = new privateUnderTest.HtmlSpecFilterV2({
|
||||||
|
filterString() {
|
||||||
|
return '["a","b"]';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(specFilter.matches(stubSpec(['a', 'b', 'c']))).toBeTrue();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('does not match a spec with a different path', function() {
|
||||||
|
const specFilter = new privateUnderTest.HtmlSpecFilterV2({
|
||||||
|
filterString() {
|
||||||
|
return '["a","b","c"]';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(specFilter.matches(stubSpec(['a', 'd', 'c']))).toBeFalse();
|
||||||
|
});
|
||||||
|
|
||||||
|
function stubSpec(path) {
|
||||||
|
return {
|
||||||
|
getPath() {
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -37,7 +37,10 @@ jasmineRequire.HtmlReporterV2 = function(j$) {
|
|||||||
return window.location;
|
return window.location;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.#urlBuilder = new UrlBuilder(this.#queryString);
|
this.#urlBuilder = new UrlBuilder({
|
||||||
|
queryString: this.#queryString,
|
||||||
|
getSuiteById: id => this.#stateBuilder.suitesById[id]
|
||||||
|
});
|
||||||
this.#filterSpecs = options.urls.filteringSpecs();
|
this.#filterSpecs = options.urls.filteringSpecs();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -174,34 +177,48 @@ jasmineRequire.HtmlReporterV2 = function(j$) {
|
|||||||
|
|
||||||
class UrlBuilder {
|
class UrlBuilder {
|
||||||
#queryString;
|
#queryString;
|
||||||
|
#getSuiteById;
|
||||||
|
|
||||||
constructor(queryString) {
|
constructor(options) {
|
||||||
this.#queryString = queryString;
|
this.#queryString = options.queryString;
|
||||||
|
this.#getSuiteById = options.getSuiteById;
|
||||||
}
|
}
|
||||||
|
|
||||||
suiteHref(suite) {
|
suiteHref(suite) {
|
||||||
const els = [];
|
const path = this.#suitePath(suite);
|
||||||
|
return this.#specPathHref(path);
|
||||||
while (suite && suite.parent) {
|
|
||||||
els.unshift(suite.result.description);
|
|
||||||
suite = suite.parent;
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.#addToExistingQueryString('spec', els.join(' '));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
specHref(result) {
|
specHref(specResult) {
|
||||||
return this.#addToExistingQueryString('spec', result.fullName);
|
const suite = this.#getSuiteById(specResult.parentSuiteId);
|
||||||
|
const path = this.#suitePath(suite);
|
||||||
|
path.push(specResult.description);
|
||||||
|
return this.#specPathHref(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
runAllHref() {
|
runAllHref() {
|
||||||
return this.#addToExistingQueryString('spec', '');
|
return this.#addToExistingQueryString('path', '');
|
||||||
}
|
}
|
||||||
|
|
||||||
seedHref(seed) {
|
seedHref(seed) {
|
||||||
return this.#addToExistingQueryString('seed', seed);
|
return this.#addToExistingQueryString('seed', seed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#suitePath(suite) {
|
||||||
|
const path = [];
|
||||||
|
|
||||||
|
while (suite && suite.parent) {
|
||||||
|
path.unshift(suite.result.description);
|
||||||
|
suite = suite.parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
|
#specPathHref(specPath) {
|
||||||
|
return this.#addToExistingQueryString('path', JSON.stringify(specPath));
|
||||||
|
}
|
||||||
|
|
||||||
#addToExistingQueryString(k, v) {
|
#addToExistingQueryString(k, v) {
|
||||||
// include window.location.pathname to fix issue with karma-jasmine-html-reporter in angular: see https://github.com/jasmine/jasmine/issues/1906
|
// include window.location.pathname to fix issue with karma-jasmine-html-reporter in angular: see https://github.com/jasmine/jasmine/issues/1906
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
jasmineRequire.HtmlReporterV2Urls = function(j$) {
|
jasmineRequire.HtmlReporterV2Urls = function(j$) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
// TODO unify with V2 UrlBuilder?
|
||||||
// TODO jsdoc
|
// TODO jsdoc
|
||||||
class HtmlReporterV2Urls {
|
class HtmlReporterV2Urls {
|
||||||
constructor(options = {}) {
|
constructor(options = {}) {
|
||||||
@@ -38,19 +39,19 @@ jasmineRequire.HtmlReporterV2Urls = function(j$) {
|
|||||||
|
|
||||||
const specFilter = new j$.private.HtmlSpecFilterV2({
|
const specFilter = new j$.private.HtmlSpecFilterV2({
|
||||||
filterString: () => {
|
filterString: () => {
|
||||||
return this.queryString.getParam('spec');
|
return this.queryString.getParam('path');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
config.specFilter = function(spec) {
|
config.specFilter = function(spec) {
|
||||||
return specFilter.matches(spec.getFullName());
|
return specFilter.matches(spec);
|
||||||
};
|
};
|
||||||
|
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
|
|
||||||
filteringSpecs() {
|
filteringSpecs() {
|
||||||
return !!this.queryString.getParam('spec');
|
return !!this.queryString.getParam('path');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,23 +1,40 @@
|
|||||||
jasmineRequire.HtmlSpecFilterV2 = function() {
|
jasmineRequire.HtmlSpecFilterV2 = function() {
|
||||||
'use strict';
|
class HtmlSpecFilterV2 {
|
||||||
|
#getFilterString;
|
||||||
|
|
||||||
function HtmlSpecFilterV2(options) {
|
constructor(options) {
|
||||||
const filterString =
|
this.#getFilterString = options.filterString;
|
||||||
options &&
|
}
|
||||||
options.filterString() &&
|
|
||||||
options.filterString().replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
|
|
||||||
const filterPattern = new RegExp(filterString);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines whether the spec with the specified name should be executed.
|
* Determines whether the spec with the specified name should be executed.
|
||||||
* @name HtmlSpecFilter#matches
|
* @name HtmlSpecFilterV2#matches
|
||||||
* @function
|
* @function
|
||||||
* @param {string} specName The full name of the spec
|
* @param {Spec} spec
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
this.matches = function(specName) {
|
matches(spec) {
|
||||||
return filterPattern.test(specName);
|
const filterString = this.#getFilterString();
|
||||||
};
|
|
||||||
|
if (!filterString) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
const filterPath = JSON.parse(this.#getFilterString());
|
||||||
|
const specPath = spec.getPath();
|
||||||
|
|
||||||
|
if (filterPath.length > specPath.length) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let i = 0; i < filterPath.length; i++) {
|
||||||
|
if (specPath[i] !== filterPath[i]) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return HtmlSpecFilterV2;
|
return HtmlSpecFilterV2;
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ jasmineRequire.ResultsStateBuilder = function(j$) {
|
|||||||
constructor() {
|
constructor() {
|
||||||
this.topResults = new j$.private.ResultsNode({}, '', null);
|
this.topResults = new j$.private.ResultsNode({}, '', null);
|
||||||
this.currentParent = this.topResults;
|
this.currentParent = this.topResults;
|
||||||
|
this.suitesById = {};
|
||||||
this.totalSpecsDefined = 0;
|
this.totalSpecsDefined = 0;
|
||||||
this.specsExecuted = 0;
|
this.specsExecuted = 0;
|
||||||
this.failureCount = 0;
|
this.failureCount = 0;
|
||||||
@@ -15,6 +16,7 @@ jasmineRequire.ResultsStateBuilder = function(j$) {
|
|||||||
suiteStarted(result) {
|
suiteStarted(result) {
|
||||||
this.currentParent.addChild(result, 'suite');
|
this.currentParent.addChild(result, 'suite');
|
||||||
this.currentParent = this.currentParent.last();
|
this.currentParent = this.currentParent.last();
|
||||||
|
this.suitesById[result.id] = this.currentParent;
|
||||||
}
|
}
|
||||||
|
|
||||||
suiteDone(result) {
|
suiteDone(result) {
|
||||||
|
|||||||
Reference in New Issue
Block a user