jasmine-core 5.10.0 → 5.12.0

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.
package/README.md CHANGED
@@ -30,7 +30,7 @@ Microsoft Edge) as well as Node.
30
30
  | Environment | Supported versions |
31
31
  |-------------------|----------------------------------|
32
32
  | Node | 18.20.5+*, 20, 22, 24 |
33
- | Safari | 15*, 16*, 17* |
33
+ | Safari | 16*, 17* |
34
34
  | Chrome | Evergreen |
35
35
  | Firefox | Evergreen, 102*, 115*, 128*, 140 |
36
36
  | Edge | Evergreen |
@@ -81,6 +81,13 @@ jasmineRequire.HtmlReporter = function(j$) {
81
81
  }
82
82
  };
83
83
 
84
+ /**
85
+ * @class HtmlReporter
86
+ * @classdesc Displays results and allows re-running individual specs and suites.
87
+ * @implements {Reporter}
88
+ * @param options Options object. See lib/jasmine-core/boot1.js for details.
89
+ * @since 1.2.0
90
+ */
84
91
  function HtmlReporter(options) {
85
92
  function config() {
86
93
  return (options.env && options.env.configuration()) || {};
@@ -98,6 +105,11 @@ jasmineRequire.HtmlReporter = function(j$) {
98
105
  const deprecationWarnings = [];
99
106
  const failures = [];
100
107
 
108
+ /**
109
+ * Initializes the reporter. Should be called before {@link Env#execute}.
110
+ * @function
111
+ * @name HtmlReporter#initialize
112
+ */
101
113
  this.initialize = function() {
102
114
  clearPrior();
103
115
  htmlReporterMain = createDom(
@@ -881,6 +893,8 @@ jasmineRequire.HtmlReporter = function(j$) {
881
893
  };
882
894
 
883
895
  jasmineRequire.HtmlSpecFilter = function() {
896
+ // Legacy HTML spec filter, preserved for backward compatibility with
897
+ // boot files that predate HtmlExactSpecFilterV2
884
898
  function HtmlSpecFilter(options) {
885
899
  const filterString =
886
900
  options &&
@@ -888,6 +902,13 @@ jasmineRequire.HtmlSpecFilter = function() {
888
902
  options.filterString().replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
889
903
  const filterPattern = new RegExp(filterString);
890
904
 
905
+ /**
906
+ * Determines whether the spec with the specified name should be executed.
907
+ * @name HtmlSpecFilter#matches
908
+ * @function
909
+ * @param {string} specName The full name of the spec
910
+ * @returns {boolean}
911
+ */
891
912
  this.matches = function(specName) {
892
913
  return filterPattern.test(specName);
893
914
  };
@@ -921,38 +942,57 @@ jasmineRequire.ResultsNode = function() {
921
942
  };
922
943
 
923
944
  jasmineRequire.QueryString = function() {
924
- function QueryString(options) {
925
- this.navigateWithNewParam = function(key, value) {
926
- options.getWindowLocation().search = this.fullStringWithNewParam(
945
+ /**
946
+ * Reads and manipulates the query string.
947
+ * @since 2.0.0
948
+ */
949
+ class QueryString {
950
+ #getWindowLocation;
951
+
952
+ /**
953
+ * @param options Object with a getWindowLocation property, which should be
954
+ * a function returning the current value of window.location.
955
+ */
956
+ constructor(options) {
957
+ this.#getWindowLocation = options.getWindowLocation;
958
+ }
959
+
960
+ /**
961
+ * Sets the specified query parameter and navigates to the resulting URL.
962
+ * @param {string} key
963
+ * @param {string} value
964
+ */
965
+ navigateWithNewParam(key, value) {
966
+ this.#getWindowLocation().search = this.fullStringWithNewParam(
927
967
  key,
928
968
  value
929
969
  );
930
- };
970
+ }
931
971
 
932
- this.fullStringWithNewParam = function(key, value) {
933
- const paramMap = queryStringToParamMap();
972
+ /**
973
+ * Returns a new URL based on the current location, with the specified
974
+ * query parameter set.
975
+ * @param {string} key
976
+ * @param {string} value
977
+ * @return {string}
978
+ */
979
+ fullStringWithNewParam(key, value) {
980
+ const paramMap = this.#queryStringToParamMap();
934
981
  paramMap[key] = value;
935
982
  return toQueryString(paramMap);
936
- };
937
-
938
- this.getParam = function(key) {
939
- return queryStringToParamMap()[key];
940
- };
941
-
942
- return this;
983
+ }
943
984
 
944
- function toQueryString(paramMap) {
945
- const qStrPairs = [];
946
- for (const prop in paramMap) {
947
- qStrPairs.push(
948
- encodeURIComponent(prop) + '=' + encodeURIComponent(paramMap[prop])
949
- );
950
- }
951
- return '?' + qStrPairs.join('&');
985
+ /**
986
+ * Gets the value of the specified query parameter.
987
+ * @param {string} key
988
+ * @return {string}
989
+ */
990
+ getParam(key) {
991
+ return this.#queryStringToParamMap()[key];
952
992
  }
953
993
 
954
- function queryStringToParamMap() {
955
- const paramStr = options.getWindowLocation().search.substring(1);
994
+ #queryStringToParamMap() {
995
+ const paramStr = this.#getWindowLocation().search.substring(1);
956
996
  let params = [];
957
997
  const paramMap = {};
958
998
 
@@ -972,5 +1012,15 @@ jasmineRequire.QueryString = function() {
972
1012
  }
973
1013
  }
974
1014
 
1015
+ function toQueryString(paramMap) {
1016
+ const qStrPairs = [];
1017
+ for (const prop in paramMap) {
1018
+ qStrPairs.push(
1019
+ encodeURIComponent(prop) + '=' + encodeURIComponent(paramMap[prop])
1020
+ );
1021
+ }
1022
+ return '?' + qStrPairs.join('&');
1023
+ }
1024
+
975
1025
  return QueryString;
976
1026
  };