Revert "Move knowledge of query parameters out of boot1.js"
This reverts commit 6715f24fd0.
This commit is contained in:
@@ -38,12 +38,20 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||||||
(function() {
|
(function() {
|
||||||
const env = jasmine.getEnv();
|
const env = jasmine.getEnv();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ## Runner Parameters
|
||||||
|
*
|
||||||
|
* More browser specific code - wrap the query string in an object and to allow for getting/setting parameters from the runner user interface.
|
||||||
|
*/
|
||||||
|
|
||||||
const queryString = new jasmine.QueryString({
|
const queryString = new jasmine.QueryString({
|
||||||
getWindowLocation: function() {
|
getWindowLocation: function() {
|
||||||
return window.location;
|
return window.location;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const filterSpecs = !!queryString.getParam('spec');
|
||||||
|
|
||||||
const config = {
|
const config = {
|
||||||
stopOnSpecFailure: queryString.getParam('stopOnSpecFailure'),
|
stopOnSpecFailure: queryString.getParam('stopOnSpecFailure'),
|
||||||
stopSpecOnExpectationFailure: queryString.getParam(
|
stopSpecOnExpectationFailure: queryString.getParam(
|
||||||
@@ -85,7 +93,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||||||
return document.createTextNode.apply(document, arguments);
|
return document.createTextNode.apply(document, arguments);
|
||||||
},
|
},
|
||||||
timer: new jasmine.Timer(),
|
timer: new jasmine.Timer(),
|
||||||
queryString
|
filterSpecs: filterSpecs
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -97,7 +105,12 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||||||
/**
|
/**
|
||||||
* Filter which specs will be run by matching the start of the full name against the `spec` query param.
|
* Filter which specs will be run by matching the start of the full name against the `spec` query param.
|
||||||
*/
|
*/
|
||||||
const specFilter = new jasmine.HtmlExactSpecFilter({ queryString });
|
const specFilter = new jasmine.HtmlExactSpecFilter({
|
||||||
|
filterString: function() {
|
||||||
|
return queryString.getParam('spec');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
config.specFilter = function(spec) {
|
config.specFilter = function(spec) {
|
||||||
return specFilter.matches(spec);
|
return specFilter.matches(spec);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -99,14 +99,10 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|||||||
const getContainer = options.getContainer;
|
const getContainer = options.getContainer;
|
||||||
const createElement = options.createElement;
|
const createElement = options.createElement;
|
||||||
const createTextNode = options.createTextNode;
|
const createTextNode = options.createTextNode;
|
||||||
// TODO: in the next major release, replace navigateWithNewParam and
|
|
||||||
// addToExistingQueryString with direct usage of options.queryString
|
|
||||||
const navigateWithNewParam = options.navigateWithNewParam || function() {};
|
const navigateWithNewParam = options.navigateWithNewParam || function() {};
|
||||||
const addToExistingQueryString =
|
const addToExistingQueryString =
|
||||||
options.addToExistingQueryString || defaultQueryString;
|
options.addToExistingQueryString || defaultQueryString;
|
||||||
const filterSpecs = options.queryString
|
const filterSpecs = options.filterSpecs;
|
||||||
? !!options.queryString.getParam('spec')
|
|
||||||
: options.filterSpecs; // For compatibility with pre-5.11 boot files
|
|
||||||
let htmlReporterMain;
|
let htmlReporterMain;
|
||||||
let symbols;
|
let symbols;
|
||||||
const deprecationWarnings = [];
|
const deprecationWarnings = [];
|
||||||
@@ -1065,13 +1061,16 @@ jasmineRequire.HtmlExactSpecFilter = function() {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a filter instance.
|
* Create a filter instance.
|
||||||
* @param options Object with a queryString property, which should be an
|
* @param options Object with a filterString method, which should
|
||||||
* instance of {@link QueryString}.
|
* return the value of the "spec" query string parameter set by
|
||||||
|
* {@link HtmlReporter}.
|
||||||
*/
|
*/
|
||||||
constructor(options) {
|
constructor(options) {
|
||||||
this.#getFilterString = function() {
|
if (typeof options?.filterString !== 'function') {
|
||||||
return options.queryString.getParam('spec');
|
throw new Error('options.filterString must be a function');
|
||||||
};
|
}
|
||||||
|
|
||||||
|
this.#getFilterString = options.filterString;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,10 +1,8 @@
|
|||||||
describe('HtmlExactSpecFilter', function() {
|
describe('HtmlExactSpecFilter', function() {
|
||||||
it('matches everything when no string is provided', function() {
|
it('matches everything when no string is provided', function() {
|
||||||
const specFilter = new jasmineUnderTest.HtmlExactSpecFilter({
|
const specFilter = new jasmineUnderTest.HtmlExactSpecFilter({
|
||||||
queryString: {
|
filterString() {
|
||||||
getParam(name) {
|
return '';
|
||||||
return '';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -13,12 +11,8 @@ describe('HtmlExactSpecFilter', function() {
|
|||||||
|
|
||||||
it('matches a spec with the exact same path', function() {
|
it('matches a spec with the exact same path', function() {
|
||||||
const specFilter = new jasmineUnderTest.HtmlExactSpecFilter({
|
const specFilter = new jasmineUnderTest.HtmlExactSpecFilter({
|
||||||
queryString: {
|
filterString() {
|
||||||
getParam(name) {
|
return '["a","b","c"]';
|
||||||
if (name === 'spec') {
|
|
||||||
return '["a","b","c"]';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -27,12 +21,8 @@ describe('HtmlExactSpecFilter', function() {
|
|||||||
|
|
||||||
it('matches a spec whose path has the filter path as a prefix', function() {
|
it('matches a spec whose path has the filter path as a prefix', function() {
|
||||||
const specFilter = new jasmineUnderTest.HtmlExactSpecFilter({
|
const specFilter = new jasmineUnderTest.HtmlExactSpecFilter({
|
||||||
queryString: {
|
filterString() {
|
||||||
getParam(name) {
|
return '["a","b"]';
|
||||||
if (name === 'spec') {
|
|
||||||
return '["a","b"]';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -41,12 +31,8 @@ describe('HtmlExactSpecFilter', function() {
|
|||||||
|
|
||||||
it('does not match a spec with a different path', function() {
|
it('does not match a spec with a different path', function() {
|
||||||
const specFilter = new jasmineUnderTest.HtmlExactSpecFilter({
|
const specFilter = new jasmineUnderTest.HtmlExactSpecFilter({
|
||||||
queryString: {
|
filterString() {
|
||||||
getParam(name) {
|
return '["a","b","c"]';
|
||||||
if (name === 'spec') {
|
|
||||||
return '["a","b","c"]';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -1368,11 +1368,6 @@ describe('HtmlReporter', function() {
|
|||||||
},
|
},
|
||||||
createTextNode: function() {
|
createTextNode: function() {
|
||||||
return document.createTextNode.apply(document, arguments);
|
return document.createTextNode.apply(document, arguments);
|
||||||
},
|
|
||||||
queryString: {
|
|
||||||
getParam(name) {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
specStatus = {
|
specStatus = {
|
||||||
@@ -1387,12 +1382,7 @@ describe('HtmlReporter', function() {
|
|||||||
|
|
||||||
describe('when the specs are not filtered', function() {
|
describe('when the specs are not filtered', function() {
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
reporterConfig.queryString.getParam = function(name) {
|
reporterConfig.filterSpecs = false;
|
||||||
if (name !== 'spec') {
|
|
||||||
throw new Error('Unexpected query param ' + name);
|
|
||||||
}
|
|
||||||
return '';
|
|
||||||
};
|
|
||||||
reporter = new jasmineUnderTest.HtmlReporter(reporterConfig);
|
reporter = new jasmineUnderTest.HtmlReporter(reporterConfig);
|
||||||
reporter.initialize();
|
reporter.initialize();
|
||||||
reporter.jasmineStarted({ totalSpecsDefined: 1 });
|
reporter.jasmineStarted({ totalSpecsDefined: 1 });
|
||||||
@@ -1410,12 +1400,7 @@ describe('HtmlReporter', function() {
|
|||||||
|
|
||||||
describe('when the specs are filtered', function() {
|
describe('when the specs are filtered', function() {
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
reporterConfig.queryString.getParam = function(name) {
|
reporterConfig.filterSpecs = true;
|
||||||
if (name !== 'spec') {
|
|
||||||
throw new Error('Unexpected query param ' + name);
|
|
||||||
}
|
|
||||||
return 'not the empty string';
|
|
||||||
};
|
|
||||||
reporter = new jasmineUnderTest.HtmlReporter(reporterConfig);
|
reporter = new jasmineUnderTest.HtmlReporter(reporterConfig);
|
||||||
reporter.initialize();
|
reporter.initialize();
|
||||||
reporter.jasmineStarted({ totalSpecsDefined: 1 });
|
reporter.jasmineStarted({ totalSpecsDefined: 1 });
|
||||||
|
|||||||
@@ -14,12 +14,20 @@
|
|||||||
(function() {
|
(function() {
|
||||||
const env = jasmine.getEnv();
|
const env = jasmine.getEnv();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ## Runner Parameters
|
||||||
|
*
|
||||||
|
* More browser specific code - wrap the query string in an object and to allow for getting/setting parameters from the runner user interface.
|
||||||
|
*/
|
||||||
|
|
||||||
const queryString = new jasmine.QueryString({
|
const queryString = new jasmine.QueryString({
|
||||||
getWindowLocation: function() {
|
getWindowLocation: function() {
|
||||||
return window.location;
|
return window.location;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const filterSpecs = !!queryString.getParam('spec');
|
||||||
|
|
||||||
const config = {
|
const config = {
|
||||||
stopOnSpecFailure: queryString.getParam('stopOnSpecFailure'),
|
stopOnSpecFailure: queryString.getParam('stopOnSpecFailure'),
|
||||||
stopSpecOnExpectationFailure: queryString.getParam(
|
stopSpecOnExpectationFailure: queryString.getParam(
|
||||||
@@ -61,7 +69,7 @@
|
|||||||
return document.createTextNode.apply(document, arguments);
|
return document.createTextNode.apply(document, arguments);
|
||||||
},
|
},
|
||||||
timer: new jasmine.Timer(),
|
timer: new jasmine.Timer(),
|
||||||
queryString
|
filterSpecs: filterSpecs
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -73,7 +81,12 @@
|
|||||||
/**
|
/**
|
||||||
* Filter which specs will be run by matching the start of the full name against the `spec` query param.
|
* Filter which specs will be run by matching the start of the full name against the `spec` query param.
|
||||||
*/
|
*/
|
||||||
const specFilter = new jasmine.HtmlExactSpecFilter({ queryString });
|
const specFilter = new jasmine.HtmlExactSpecFilter({
|
||||||
|
filterString: function() {
|
||||||
|
return queryString.getParam('spec');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
config.specFilter = function(spec) {
|
config.specFilter = function(spec) {
|
||||||
return specFilter.matches(spec);
|
return specFilter.matches(spec);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -10,13 +10,16 @@ jasmineRequire.HtmlExactSpecFilter = function() {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a filter instance.
|
* Create a filter instance.
|
||||||
* @param options Object with a queryString property, which should be an
|
* @param options Object with a filterString method, which should
|
||||||
* instance of {@link QueryString}.
|
* return the value of the "spec" query string parameter set by
|
||||||
|
* {@link HtmlReporter}.
|
||||||
*/
|
*/
|
||||||
constructor(options) {
|
constructor(options) {
|
||||||
this.#getFilterString = function() {
|
if (typeof options?.filterString !== 'function') {
|
||||||
return options.queryString.getParam('spec');
|
throw new Error('options.filterString must be a function');
|
||||||
};
|
}
|
||||||
|
|
||||||
|
this.#getFilterString = options.filterString;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -64,14 +64,10 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|||||||
const getContainer = options.getContainer;
|
const getContainer = options.getContainer;
|
||||||
const createElement = options.createElement;
|
const createElement = options.createElement;
|
||||||
const createTextNode = options.createTextNode;
|
const createTextNode = options.createTextNode;
|
||||||
// TODO: in the next major release, replace navigateWithNewParam and
|
|
||||||
// addToExistingQueryString with direct usage of options.queryString
|
|
||||||
const navigateWithNewParam = options.navigateWithNewParam || function() {};
|
const navigateWithNewParam = options.navigateWithNewParam || function() {};
|
||||||
const addToExistingQueryString =
|
const addToExistingQueryString =
|
||||||
options.addToExistingQueryString || defaultQueryString;
|
options.addToExistingQueryString || defaultQueryString;
|
||||||
const filterSpecs = options.queryString
|
const filterSpecs = options.filterSpecs;
|
||||||
? !!options.queryString.getParam('spec')
|
|
||||||
: options.filterSpecs; // For compatibility with pre-5.11 boot files
|
|
||||||
let htmlReporterMain;
|
let htmlReporterMain;
|
||||||
let symbols;
|
let symbols;
|
||||||
const deprecationWarnings = [];
|
const deprecationWarnings = [];
|
||||||
|
|||||||
Reference in New Issue
Block a user