expect-webdriverio 4.9.3 → 4.9.4

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.
@@ -6,14 +6,7 @@ export async function toBeClickable(received, options = DEFAULT_OPTIONS) {
6
6
  matcherName: 'toBeClickable',
7
7
  options,
8
8
  });
9
- const result = await executeCommandBe.call(this, received, async (el) => {
10
- try {
11
- return el.isClickable();
12
- }
13
- catch {
14
- return false;
15
- }
16
- }, options);
9
+ const result = await executeCommandBe.call(this, received, el => el.isClickable(), options);
17
10
  await options.afterAssertion?.({
18
11
  matcherName: 'toBeClickable',
19
12
  options,
@@ -6,14 +6,7 @@ export async function toBeDisplayed(received, options = DEFAULT_OPTIONS) {
6
6
  matcherName: 'toBeDisplayed',
7
7
  options,
8
8
  });
9
- const result = await executeCommandBe.call(this, received, async (el) => {
10
- try {
11
- return el.isDisplayed();
12
- }
13
- catch {
14
- return false;
15
- }
16
- }, options);
9
+ const result = await executeCommandBe.call(this, received, el => el.isDisplayed(), options);
17
10
  await options.afterAssertion?.({
18
11
  matcherName: 'toBeDisplayed',
19
12
  options,
@@ -6,14 +6,7 @@ export async function toBeDisplayedInViewport(received, options = DEFAULT_OPTION
6
6
  matcherName: 'toBeDisplayedInViewport',
7
7
  options,
8
8
  });
9
- const result = await executeCommandBe.call(this, received, async (el) => {
10
- try {
11
- return el.isDisplayedInViewport();
12
- }
13
- catch {
14
- return false;
15
- }
16
- }, options);
9
+ const result = await executeCommandBe.call(this, received, el => el.isDisplayedInViewport(), options);
17
10
  await options.afterAssertion?.({
18
11
  matcherName: 'toBeDisplayedInViewport',
19
12
  options,
@@ -7,14 +7,7 @@ export async function toExist(received, options = DEFAULT_OPTIONS) {
7
7
  matcherName: 'toExist',
8
8
  options,
9
9
  });
10
- const result = await executeCommandBe.call(this, received, async (el) => {
11
- try {
12
- return el.isExisting();
13
- }
14
- catch {
15
- return false;
16
- }
17
- }, options);
10
+ const result = await executeCommandBe.call(this, received, el => el.isExisting(), options);
18
11
  await options.afterAssertion?.({
19
12
  matcherName: 'toExist',
20
13
  options,
package/lib/utils.js CHANGED
@@ -11,8 +11,8 @@ const waitUntil = async (condition, isNot = false, { wait = DEFAULT_OPTIONS.wait
11
11
  if (wait === 0) {
12
12
  return await condition();
13
13
  }
14
+ let error;
14
15
  try {
15
- let error;
16
16
  const start = Date.now();
17
17
  while (true) {
18
18
  if (Date.now() - start > wait) {
@@ -21,6 +21,7 @@ const waitUntil = async (condition, isNot = false, { wait = DEFAULT_OPTIONS.wait
21
21
  error = undefined;
22
22
  try {
23
23
  const result = isNot !== (await condition());
24
+ error = undefined;
24
25
  if (result) {
25
26
  break;
26
27
  }
@@ -37,6 +38,9 @@ const waitUntil = async (condition, isNot = false, { wait = DEFAULT_OPTIONS.wait
37
38
  return !isNot;
38
39
  }
39
40
  catch (err) {
41
+ if (error) {
42
+ throw error;
43
+ }
40
44
  return isNot;
41
45
  }
42
46
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expect-webdriverio",
3
- "version": "4.9.3",
3
+ "version": "4.9.4",
4
4
  "author": "Mykola Grybyk <mykola.grybyk@gmail.com>",
5
5
  "description": "WebdriverIO Assertion Library",
6
6
  "license": "MIT",
@@ -48,7 +48,7 @@
48
48
  "compile": "tsc --build tsconfig.build.json",
49
49
  "test": "run-s test:*",
50
50
  "test:lint": "eslint . --ext .js,.jsx,.ts,.tsx",
51
- "test:unit": "vitest",
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:*",
54
54
  "ts:default": "cd test-types/default && tsc -p ./tsconfig.json --incremental",
@@ -61,30 +61,30 @@
61
61
  "@types/debug": "^4.1.12",
62
62
  "@types/jest": "^29.5.11",
63
63
  "@types/lodash.isequal": "^4.5.8",
64
- "@types/node": "^20.10.6",
65
- "@typescript-eslint/eslint-plugin": "^6.17.0",
66
- "@typescript-eslint/parser": "^6.17.0",
67
- "@vitest/coverage-v8": "^1.1.3",
68
- "c8": "^9.0.0",
64
+ "@types/node": "^20.11.14",
65
+ "@typescript-eslint/eslint-plugin": "^6.20.0",
66
+ "@typescript-eslint/parser": "^6.20.0",
67
+ "@vitest/coverage-v8": "^1.2.2",
68
+ "c8": "^9.1.0",
69
69
  "eslint": "^8.56.0",
70
70
  "eslint-plugin-import": "^2.29.1",
71
71
  "eslint-plugin-unicorn": "^50.0.1",
72
- "husky": "^8.0.3",
72
+ "husky": "^9.0.7",
73
73
  "npm-run-all": "^4.1.5",
74
- "release-it": "^17.0.1",
74
+ "release-it": "^17.0.3",
75
75
  "rimraf": "^5.0.5",
76
76
  "shelljs": "^0.8.5",
77
77
  "typescript": "^5.3.3",
78
- "vitest": "1.2.0",
79
- "webdriverio": "8.27.2"
78
+ "vitest": "1.2.2",
79
+ "webdriverio": "8.29.1"
80
80
  },
81
81
  "optionalDependencies": {
82
- "@wdio/globals": "^8.27.0",
83
- "@wdio/logger": "^8.24.12",
84
- "webdriverio": "^8.27.0"
82
+ "@wdio/globals": "^8.29.3",
83
+ "@wdio/logger": "^8.28.0",
84
+ "webdriverio": "^8.29.3"
85
85
  },
86
86
  "dependencies": {
87
- "@vitest/snapshot": "^1.2.1",
87
+ "@vitest/snapshot": "^1.2.2",
88
88
  "expect": "^29.7.0",
89
89
  "jest-matcher-utils": "^29.7.0",
90
90
  "lodash.isequal": "^4.5.0"