jasmine-core 5.11.0 → 5.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -38,12 +38,20 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
38
38
|
(function() {
|
|
39
39
|
const env = jasmine.getEnv();
|
|
40
40
|
|
|
41
|
+
/**
|
|
42
|
+
* ## Runner Parameters
|
|
43
|
+
*
|
|
44
|
+
* More browser specific code - wrap the query string in an object and to allow for getting/setting parameters from the runner user interface.
|
|
45
|
+
*/
|
|
46
|
+
|
|
41
47
|
const queryString = new jasmine.QueryString({
|
|
42
48
|
getWindowLocation: function() {
|
|
43
49
|
return window.location;
|
|
44
50
|
}
|
|
45
51
|
});
|
|
46
52
|
|
|
53
|
+
const filterSpecs = !!queryString.getParam('spec');
|
|
54
|
+
|
|
47
55
|
const config = {
|
|
48
56
|
stopOnSpecFailure: queryString.getParam('stopOnSpecFailure'),
|
|
49
57
|
stopSpecOnExpectationFailure: queryString.getParam(
|
|
@@ -85,7 +93,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
85
93
|
return document.createTextNode.apply(document, arguments);
|
|
86
94
|
},
|
|
87
95
|
timer: new jasmine.Timer(),
|
|
88
|
-
|
|
96
|
+
filterSpecs: filterSpecs
|
|
89
97
|
});
|
|
90
98
|
|
|
91
99
|
/**
|
|
@@ -97,9 +105,14 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
97
105
|
/**
|
|
98
106
|
* Filter which specs will be run by matching the start of the full name against the `spec` query param.
|
|
99
107
|
*/
|
|
100
|
-
const specFilter = new jasmine.
|
|
108
|
+
const specFilter = new jasmine.HtmlSpecFilter({
|
|
109
|
+
filterString: function() {
|
|
110
|
+
return queryString.getParam('spec');
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
|
|
101
114
|
config.specFilter = function(spec) {
|
|
102
|
-
return specFilter.matches(spec);
|
|
115
|
+
return specFilter.matches(spec.getFullName());
|
|
103
116
|
};
|
|
104
117
|
|
|
105
118
|
env.configure(config);
|
|
@@ -30,7 +30,6 @@ jasmineRequire.html = function(j$) {
|
|
|
30
30
|
j$.HtmlReporter = jasmineRequire.HtmlReporter(j$);
|
|
31
31
|
j$.QueryString = jasmineRequire.QueryString();
|
|
32
32
|
j$.HtmlSpecFilter = jasmineRequire.HtmlSpecFilter();
|
|
33
|
-
j$.HtmlExactSpecFilter = jasmineRequire.HtmlExactSpecFilter();
|
|
34
33
|
};
|
|
35
34
|
|
|
36
35
|
jasmineRequire.HtmlReporter = function(j$) {
|
|
@@ -40,13 +39,11 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|
|
40
39
|
this.specsExecuted = 0;
|
|
41
40
|
this.failureCount = 0;
|
|
42
41
|
this.pendingSpecCount = 0;
|
|
43
|
-
this.suitesById = [];
|
|
44
42
|
}
|
|
45
43
|
|
|
46
44
|
ResultsStateBuilder.prototype.suiteStarted = function(result) {
|
|
47
45
|
this.currentParent.addChild(result, 'suite');
|
|
48
46
|
this.currentParent = this.currentParent.last();
|
|
49
|
-
this.suitesById[result.id] = this.currentParent;
|
|
50
47
|
};
|
|
51
48
|
|
|
52
49
|
ResultsStateBuilder.prototype.suiteDone = function(result) {
|
|
@@ -99,14 +96,10 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|
|
99
96
|
const getContainer = options.getContainer;
|
|
100
97
|
const createElement = options.createElement;
|
|
101
98
|
const createTextNode = options.createTextNode;
|
|
102
|
-
// TODO: in the next major release, replace navigateWithNewParam and
|
|
103
|
-
// addToExistingQueryString with direct usage of options.queryString
|
|
104
99
|
const navigateWithNewParam = options.navigateWithNewParam || function() {};
|
|
105
100
|
const addToExistingQueryString =
|
|
106
101
|
options.addToExistingQueryString || defaultQueryString;
|
|
107
|
-
const filterSpecs = options.
|
|
108
|
-
? !!options.queryString.getParam('spec')
|
|
109
|
-
: options.filterSpecs; // For compatibility with pre-5.11 boot files
|
|
102
|
+
const filterSpecs = options.filterSpecs;
|
|
110
103
|
let htmlReporterMain;
|
|
111
104
|
let symbols;
|
|
112
105
|
const deprecationWarnings = [];
|
|
@@ -735,6 +728,21 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|
|
735
728
|
return wrapper;
|
|
736
729
|
}
|
|
737
730
|
|
|
731
|
+
function suiteHref(suite) {
|
|
732
|
+
const els = [];
|
|
733
|
+
|
|
734
|
+
while (suite && suite.parent) {
|
|
735
|
+
els.unshift(suite.result.description);
|
|
736
|
+
suite = suite.parent;
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
// include window.location.pathname to fix issue with karma-jasmine-html-reporter in angular: see https://github.com/jasmine/jasmine/issues/1906
|
|
740
|
+
return (
|
|
741
|
+
(window.location.pathname || '') +
|
|
742
|
+
addToExistingQueryString('spec', els.join(' '))
|
|
743
|
+
);
|
|
744
|
+
}
|
|
745
|
+
|
|
738
746
|
function addDeprecationWarnings(result, runnableType) {
|
|
739
747
|
if (result && result.deprecationWarnings) {
|
|
740
748
|
for (let i = 0; i < result.deprecationWarnings.length; i++) {
|
|
@@ -832,33 +840,11 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|
|
832
840
|
return '' + count + ' ' + word;
|
|
833
841
|
}
|
|
834
842
|
|
|
835
|
-
function suitePath(suite) {
|
|
836
|
-
const els = [];
|
|
837
|
-
|
|
838
|
-
while (suite && suite.parent) {
|
|
839
|
-
els.unshift(suite.result.description);
|
|
840
|
-
suite = suite.parent;
|
|
841
|
-
}
|
|
842
|
-
|
|
843
|
-
return els;
|
|
844
|
-
}
|
|
845
|
-
|
|
846
|
-
function suiteHref(suite) {
|
|
847
|
-
return pathHref(suitePath(suite));
|
|
848
|
-
}
|
|
849
|
-
|
|
850
843
|
function specHref(result) {
|
|
851
|
-
const suite = stateBuilder.suitesById[result.parentSuiteId];
|
|
852
|
-
const path = suitePath(suite);
|
|
853
|
-
path.push(result.description);
|
|
854
|
-
return pathHref(path);
|
|
855
|
-
}
|
|
856
|
-
|
|
857
|
-
function pathHref(path) {
|
|
858
844
|
// include window.location.pathname to fix issue with karma-jasmine-html-reporter in angular: see https://github.com/jasmine/jasmine/issues/1906
|
|
859
845
|
return (
|
|
860
846
|
(window.location.pathname || '') +
|
|
861
|
-
addToExistingQueryString('spec',
|
|
847
|
+
addToExistingQueryString('spec', result.fullName)
|
|
862
848
|
);
|
|
863
849
|
}
|
|
864
850
|
|
|
@@ -907,27 +893,13 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|
|
907
893
|
};
|
|
908
894
|
|
|
909
895
|
jasmineRequire.HtmlSpecFilter = function() {
|
|
910
|
-
/**
|
|
911
|
-
* @name HtmlSpecFilter
|
|
912
|
-
* @classdesc Legacy HTML spec filter, for backward compatibility
|
|
913
|
-
* with boot files that predate {@link HtmlExactSpecFilter}.
|
|
914
|
-
* @param options Object with a filterString method
|
|
915
|
-
* @constructor
|
|
916
|
-
* @deprecated
|
|
917
|
-
* @since 1.2.0
|
|
918
|
-
*/
|
|
919
896
|
// Legacy HTML spec filter, preserved for backward compatibility with
|
|
920
897
|
// boot files that predate HtmlExactSpecFilterV2
|
|
921
898
|
function HtmlSpecFilter(options) {
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
filterString = JSON.parse(filterString).join(' ');
|
|
927
|
-
}
|
|
928
|
-
|
|
929
|
-
filterString = filterString.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
|
|
930
|
-
|
|
899
|
+
const filterString =
|
|
900
|
+
options &&
|
|
901
|
+
options.filterString() &&
|
|
902
|
+
options.filterString().replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
|
|
931
903
|
const filterPattern = new RegExp(filterString);
|
|
932
904
|
|
|
933
905
|
/**
|
|
@@ -1052,56 +1024,3 @@ jasmineRequire.QueryString = function() {
|
|
|
1052
1024
|
|
|
1053
1025
|
return QueryString;
|
|
1054
1026
|
};
|
|
1055
|
-
|
|
1056
|
-
jasmineRequire.HtmlExactSpecFilter = function() {
|
|
1057
|
-
/**
|
|
1058
|
-
* Spec filter for use with {@link HtmlReporter}
|
|
1059
|
-
*
|
|
1060
|
-
* See lib/jasmine-core/boot1.js for usage.
|
|
1061
|
-
* @since 5.11.0
|
|
1062
|
-
*/
|
|
1063
|
-
class HtmlExactSpecFilter {
|
|
1064
|
-
#getFilterString;
|
|
1065
|
-
|
|
1066
|
-
/**
|
|
1067
|
-
* Create a filter instance.
|
|
1068
|
-
* @param options Object with a queryString property, which should be an
|
|
1069
|
-
* instance of {@link QueryString}.
|
|
1070
|
-
*/
|
|
1071
|
-
constructor(options) {
|
|
1072
|
-
this.#getFilterString = function() {
|
|
1073
|
-
return options.queryString.getParam('spec');
|
|
1074
|
-
};
|
|
1075
|
-
}
|
|
1076
|
-
|
|
1077
|
-
/**
|
|
1078
|
-
* Determines whether the specified spec should be executed.
|
|
1079
|
-
* @param {Spec} spec
|
|
1080
|
-
* @returns {boolean}
|
|
1081
|
-
*/
|
|
1082
|
-
matches(spec) {
|
|
1083
|
-
const filterString = this.#getFilterString();
|
|
1084
|
-
|
|
1085
|
-
if (!filterString) {
|
|
1086
|
-
return true;
|
|
1087
|
-
}
|
|
1088
|
-
|
|
1089
|
-
const filterPath = JSON.parse(this.#getFilterString());
|
|
1090
|
-
const specPath = spec.getPath();
|
|
1091
|
-
|
|
1092
|
-
if (filterPath.length > specPath.length) {
|
|
1093
|
-
return false;
|
|
1094
|
-
}
|
|
1095
|
-
|
|
1096
|
-
for (let i = 0; i < filterPath.length; i++) {
|
|
1097
|
-
if (specPath[i] !== filterPath[i]) {
|
|
1098
|
-
return false;
|
|
1099
|
-
}
|
|
1100
|
-
}
|
|
1101
|
-
|
|
1102
|
-
return true;
|
|
1103
|
-
}
|
|
1104
|
-
}
|
|
1105
|
-
|
|
1106
|
-
return HtmlExactSpecFilter;
|
|
1107
|
-
};
|
|
@@ -11514,7 +11514,10 @@ getJasmineRequireObj().TreeRunner = function(j$) {
|
|
|
11514
11514
|
_executeSpec(spec, specOverallDone) {
|
|
11515
11515
|
const onStart = next => {
|
|
11516
11516
|
this.#currentRunableTracker.setCurrentSpec(spec);
|
|
11517
|
-
this.#runableResources.initForRunable(
|
|
11517
|
+
this.#runableResources.initForRunable(
|
|
11518
|
+
spec.id,
|
|
11519
|
+
spec.parentSuiteId || this.#executionTree.topSuite.id
|
|
11520
|
+
);
|
|
11518
11521
|
this.#reportDispatcher.specStarted(spec.result).then(next);
|
|
11519
11522
|
};
|
|
11520
11523
|
const resultCallback = (result, next) => {
|
|
@@ -11788,5 +11791,5 @@ getJasmineRequireObj().UserContext = function(j$) {
|
|
|
11788
11791
|
};
|
|
11789
11792
|
|
|
11790
11793
|
getJasmineRequireObj().version = function() {
|
|
11791
|
-
return '5.
|
|
11794
|
+
return '5.12.1';
|
|
11792
11795
|
};
|