expect-webdriverio 5.0.4 → 5.0.5
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/jasmine.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/// <reference types="expect-webdriverio/types/expect-webdriverio"/>
|
|
2
2
|
|
|
3
|
-
declare
|
|
3
|
+
declare namespace jasmine {
|
|
4
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
4
5
|
interface AsyncMatchers<T, U> extends ExpectWebdriverIO.Matchers<Promise<void>, T> {}
|
|
5
6
|
}
|
|
@@ -5,9 +5,7 @@ async function conditionAttr(el, attribute) {
|
|
|
5
5
|
if (typeof attr !== 'string') {
|
|
6
6
|
return { result: false, value: attr };
|
|
7
7
|
}
|
|
8
|
-
|
|
9
|
-
return { result: true, value: attr };
|
|
10
|
-
}
|
|
8
|
+
return { result: true, value: attr };
|
|
11
9
|
}
|
|
12
10
|
async function conditionAttrAndValue(el, attribute, value, options) {
|
|
13
11
|
const attr = await el.getAttribute(attribute);
|
|
@@ -89,7 +89,13 @@ const headersMatcher = (headers, expected) => {
|
|
|
89
89
|
return equals(headers, expected);
|
|
90
90
|
};
|
|
91
91
|
const isMatcher = (filter) => {
|
|
92
|
-
return typeof filter
|
|
92
|
+
return (typeof filter === 'object' &&
|
|
93
|
+
filter !== null &&
|
|
94
|
+
'__proto__' in filter &&
|
|
95
|
+
typeof filter.__proto__ === 'object' &&
|
|
96
|
+
filter.__proto__ &&
|
|
97
|
+
'asymmetricMatch' in filter.__proto__ &&
|
|
98
|
+
typeof filter.__proto__.asymmetricMatch === 'function');
|
|
93
99
|
};
|
|
94
100
|
const minifyRequestMock = (requestMock, requestedWith) => {
|
|
95
101
|
if (typeof requestMock === 'undefined') {
|
|
@@ -42,14 +42,9 @@ export const enhanceError = (subject, expected, actual, context, verb, expectati
|
|
|
42
42
|
if (verb) {
|
|
43
43
|
verb += ' ';
|
|
44
44
|
}
|
|
45
|
-
let diffString
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
`${RECEIVED_LABEL}: ${printReceived(actual)}`;
|
|
49
|
-
}
|
|
50
|
-
else {
|
|
51
|
-
diffString = printDiffOrStringify(expected, actual, EXPECTED_LABEL, RECEIVED_LABEL, true);
|
|
52
|
-
}
|
|
45
|
+
let diffString = isNot && equals(actual, expected)
|
|
46
|
+
? `${EXPECTED_LABEL}: ${printExpected(expected)}\n${RECEIVED_LABEL}: ${printReceived(actual)}`
|
|
47
|
+
: printDiffOrStringify(expected, actual, EXPECTED_LABEL, RECEIVED_LABEL, true);
|
|
53
48
|
if (isNot) {
|
|
54
49
|
diffString = diffString
|
|
55
50
|
.replace(EXPECTED_LABEL, NOT_EXPECTED_LABEL)
|
|
@@ -80,5 +75,5 @@ export const numberError = (options = {}) => {
|
|
|
80
75
|
if (options.lte) {
|
|
81
76
|
return ` <= ${options.lte}`;
|
|
82
77
|
}
|
|
83
|
-
return
|
|
78
|
+
return 'no params';
|
|
84
79
|
};
|
package/lib/utils.js
CHANGED
|
@@ -9,7 +9,13 @@ const asymmetricMatcher = typeof Symbol === 'function' && Symbol.for
|
|
|
9
9
|
? Symbol.for('jest.asymmetricMatcher')
|
|
10
10
|
: 1267621;
|
|
11
11
|
export function isAsymmeyricMatcher(expected) {
|
|
12
|
-
return typeof expected === 'object' &&
|
|
12
|
+
return (typeof expected === 'object' &&
|
|
13
|
+
typeof expected === 'object' &&
|
|
14
|
+
expected &&
|
|
15
|
+
'$$typeof' in expected &&
|
|
16
|
+
'asymmetricMatch' in expected &&
|
|
17
|
+
expected.$$typeof === asymmetricMatcher &&
|
|
18
|
+
Boolean(expected.asymmetricMatch));
|
|
13
19
|
}
|
|
14
20
|
function isStringContainingMatcher(expected) {
|
|
15
21
|
return isAsymmeyricMatcher(expected) && ['StringContaining', 'StringNotContaining'].includes(expected.toString());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expect-webdriverio",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.5",
|
|
4
4
|
"author": "Mykola Grybyk <mykola.grybyk@gmail.com>",
|
|
5
5
|
"description": "WebdriverIO Assertion Library",
|
|
6
6
|
"license": "MIT",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"clean:tests": "rimraf test-types/**/node_modules && rimraf test-types/**/dist",
|
|
48
48
|
"compile": "tsc --build tsconfig.build.json",
|
|
49
49
|
"test": "run-s test:*",
|
|
50
|
-
"test:lint": "eslint .
|
|
50
|
+
"test:lint": "eslint .",
|
|
51
51
|
"test:unit": "vitest --run",
|
|
52
52
|
"test:types": "node test-types/copy && npm run ts && npm run clean:tests",
|
|
53
53
|
"ts": "run-s ts:*",
|
|
@@ -68,13 +68,10 @@
|
|
|
68
68
|
"@types/jest": "^29.5.12",
|
|
69
69
|
"@types/lodash.isequal": "^4.5.8",
|
|
70
70
|
"@types/node": "^22.9.0",
|
|
71
|
-
"@typescript-eslint/eslint-plugin": "^8.13.0",
|
|
72
|
-
"@typescript-eslint/parser": "^8.13.0",
|
|
73
71
|
"@vitest/coverage-v8": "^2.1.4",
|
|
72
|
+
"@wdio/eslint": "^0.0.3",
|
|
74
73
|
"c8": "^10.1.2",
|
|
75
|
-
"eslint": "^
|
|
76
|
-
"eslint-plugin-import": "^2.29.1",
|
|
77
|
-
"eslint-plugin-unicorn": "^56.0.0",
|
|
74
|
+
"eslint": "^9.15.0",
|
|
78
75
|
"husky": "^9.1.5",
|
|
79
76
|
"npm-run-all2": "^7.0.1",
|
|
80
77
|
"release-it": "^17.6.0",
|