expect-webdriverio 6.0.1 → 6.0.3

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/lib/index.js CHANGED
@@ -5,6 +5,17 @@ import createSoftExpect from './softExpect.js';
5
5
  import { SoftAssertService } from './softAssert.js';
6
6
  import { oneOf } from './matchers/asymmetrics/oneOf.js';
7
7
  import { some as wdioSome } from './matchers/modifiers/some.js';
8
+ const wdioExpect = expectLib;
9
+ const MATCHERS_VERSION = '6.0.3';
10
+ if ((wdioExpect.__wdio_version && wdioExpect.__wdio_version !== MATCHERS_VERSION) || (!wdioExpect.__wdio_version && wdioExpect.soft !== undefined)) {
11
+ if (wdioExpect.__wdio_version) {
12
+ console.warn(`[expect-webdriverio] Conflict: Initializing v${MATCHERS_VERSION}, but v${wdioExpect.__wdio_version} is already loaded.`);
13
+ }
14
+ else {
15
+ console.warn(`[expect-webdriverio] Conflict: Initializing v${MATCHERS_VERSION}, but an older version of expect-webdriverio is already loaded.`);
16
+ }
17
+ }
18
+ wdioExpect.__wdio_version = MATCHERS_VERSION;
8
19
  export const wdioCustomMatchers = {};
9
20
  export const matchers = new Map();
10
21
  const extend = expectLib.extend;
@@ -24,21 +35,22 @@ Object.entries(wdioMatchers).forEach(([matcher, value]) => {
24
35
  filteredWdioMatchers[matcher] = value;
25
36
  }
26
37
  });
27
- const wdioExpect = expectLib;
28
38
  wdioExpect.extend(filteredWdioMatchers);
29
39
  wdioExpect.oneOf = oneOf;
30
- Object.defineProperty(wdioExpect, 'soft', {
31
- value: (actual) => createSoftExpect(actual)
32
- });
33
- Object.defineProperty(wdioExpect, 'getSoftFailures', {
34
- value: (testId) => SoftAssertService.getInstance().getFailures(testId)
35
- });
36
- Object.defineProperty(wdioExpect, 'assertSoftFailures', {
37
- value: (testId) => SoftAssertService.getInstance().assertNoFailures(testId)
38
- });
39
- Object.defineProperty(wdioExpect, 'clearSoftFailures', {
40
- value: (testId) => SoftAssertService.getInstance().clearFailures(testId)
41
- });
40
+ if (wdioExpect.soft === undefined) {
41
+ Object.defineProperty(wdioExpect, 'soft', {
42
+ value: (actual) => createSoftExpect(actual)
43
+ });
44
+ Object.defineProperty(wdioExpect, 'getSoftFailures', {
45
+ value: (testId) => SoftAssertService.getInstance().getFailures(testId)
46
+ });
47
+ Object.defineProperty(wdioExpect, 'assertSoftFailures', {
48
+ value: (testId) => SoftAssertService.getInstance().assertNoFailures(testId)
49
+ });
50
+ Object.defineProperty(wdioExpect, 'clearSoftFailures', {
51
+ value: (testId) => SoftAssertService.getInstance().clearFailures(testId)
52
+ });
53
+ }
42
54
  export const expect = wdioExpect;
43
55
  export const some = wdioSome;
44
56
  export const getDefaultOptions = () => DEFAULT_OPTIONS;
@@ -14,10 +14,9 @@ export const fillSingleExpectedForElementArray = (subject, value) => {
14
14
  export const isArray = (obj) => {
15
15
  return Array.isArray(obj);
16
16
  };
17
- export const isSelector = (obj) => {
17
+ const isSelector = (obj) => {
18
18
  return !!obj
19
19
  && typeof obj === 'object'
20
- && 'selector' in obj
21
20
  && 'parent' in obj;
22
21
  };
23
22
  export const isElementArray = (obj) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expect-webdriverio",
3
- "version": "6.0.1",
3
+ "version": "6.0.3",
4
4
  "author": "Mykola Grybyk <mykola.grybyk@gmail.com>",
5
5
  "description": "WebdriverIO Assertion Library",
6
6
  "license": "MIT",
@@ -72,7 +72,8 @@
72
72
  "checks:all": "npm run build && npm run compile && npm run tsc:root-types && npm run test && npm run ts",
73
73
  "watch": "npm run compile -- --watch",
74
74
  "prepare": "husky",
75
- "playgrounds:setup": "cd playgrounds && npm run setup",
75
+ "playgrounds:clean": "rimraf --glob '**/node_modules'",
76
+ "playgrounds:setup": "npm run playgrounds:clean; npm i && cd playgrounds && npm run setup",
76
77
  "playgrounds:checks:all": "cd playgrounds && npm run checks:all",
77
78
  "playgrounds:snapshots:update": "cd playgrounds && npm run snapshots:update"
78
79
  },
@@ -96,7 +97,7 @@
96
97
  "eslint": "^9.39.5",
97
98
  "husky": "^9.1.7",
98
99
  "npm-run-all2": "^9.0.3",
99
- "release-it": "^21.0.1",
100
+ "release-it": "^21.0.2",
100
101
  "rimraf": "^6.1.3",
101
102
  "strip-ansi": "^7.2.0",
102
103
  "typescript": "^5.9.3",