@sprucelabs/test-utils 4.0.134 → 4.0.136

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.
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.NULL_PLACEHOLDER = exports.CIRCULAR_PLACEHOLDER = exports.FUNCTION_PLACEHOLDER = exports.UNDEFINED_PLACEHOLDER = void 0;
7
7
  const chalk_1 = __importDefault(require("chalk"));
8
+ const escapeRegExp_1 = __importDefault(require("lodash/escapeRegExp"));
8
9
  const get_1 = __importDefault(require("lodash/get"));
9
10
  const includes_1 = __importDefault(require("lodash/includes"));
10
11
  const isObject_1 = __importDefault(require("lodash/isObject"));
@@ -165,15 +166,16 @@ const assertUtil = {
165
166
  },
166
167
  foundUsing3rdPartyIncludes(haystack, needle, isHaystackObject) {
167
168
  let passed = false;
169
+ const escapedNeedle = typeof needle === 'string' ? (0, escapeRegExp_1.default)(needle) : needle;
168
170
  if (typeof haystack === 'string' &&
169
171
  typeof needle === 'string' &&
170
- haystack.search(needle) > -1) {
172
+ haystack.search(escapedNeedle) > -1) {
171
173
  passed = true;
172
174
  }
173
- if (isHaystackObject && (0, includes_1.default)(haystack, needle)) {
175
+ if (isHaystackObject && (0, includes_1.default)(haystack, escapedNeedle)) {
174
176
  passed = true;
175
177
  }
176
- if (isHaystackObject && this.partialContains(haystack, needle)) {
178
+ if (isHaystackObject && this.partialContains(haystack, escapedNeedle)) {
177
179
  passed = true;
178
180
  }
179
181
  return passed;
@@ -1,4 +1,5 @@
1
1
  import chalk from 'chalk';
2
+ import escapeRegExp from 'lodash/escapeRegExp.js';
2
3
  import get from 'lodash/get.js';
3
4
  import includes from 'lodash/includes.js';
4
5
  import isObject from 'lodash/isObject.js';
@@ -159,15 +160,16 @@ const assertUtil = {
159
160
  },
160
161
  foundUsing3rdPartyIncludes(haystack, needle, isHaystackObject) {
161
162
  let passed = false;
163
+ const escapedNeedle = typeof needle === 'string' ? escapeRegExp(needle) : needle;
162
164
  if (typeof haystack === 'string' &&
163
165
  typeof needle === 'string' &&
164
- haystack.search(needle) > -1) {
166
+ haystack.search(escapedNeedle) > -1) {
165
167
  passed = true;
166
168
  }
167
- if (isHaystackObject && includes(haystack, needle)) {
169
+ if (isHaystackObject && includes(haystack, escapedNeedle)) {
168
170
  passed = true;
169
171
  }
170
- if (isHaystackObject && this.partialContains(haystack, needle)) {
172
+ if (isHaystackObject && this.partialContains(haystack, escapedNeedle)) {
171
173
  passed = true;
172
174
  }
173
175
  return passed;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "4.0.134",
6
+ "version": "4.0.136",
7
7
  "files": [
8
8
  "build"
9
9
  ],
@@ -63,7 +63,7 @@
63
63
  "watch.tsc": "tsc -w"
64
64
  },
65
65
  "dependencies": {
66
- "@sprucelabs/error": "^5.1.87",
66
+ "@sprucelabs/error": "^5.1.89",
67
67
  "deep-equal": "^2.2.3",
68
68
  "just-clone": "^6.2.0",
69
69
  "lodash": "^4.17.21",
@@ -71,8 +71,8 @@
71
71
  "variable-diff": "^2.0.2"
72
72
  },
73
73
  "devDependencies": {
74
- "@sprucelabs/esm-postbuild": "^5.0.181",
75
- "@sprucelabs/jest-json-reporter": "^7.0.191",
74
+ "@sprucelabs/esm-postbuild": "^5.0.183",
75
+ "@sprucelabs/jest-json-reporter": "^7.0.193",
76
76
  "@sprucelabs/jest-sheets-reporter": "^2.0.20",
77
77
  "@sprucelabs/semantic-release": "^4.0.8",
78
78
  "@sprucelabs/test": "^8.0.47",