expect-webdriverio 3.1.4 → 3.3.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.
Files changed (41) hide show
  1. package/README.md +29 -9
  2. package/lib/addMatchers.js +3 -3
  3. package/lib/index.js +1 -1
  4. package/lib/matchers/browser/toHaveTitle.js +4 -4
  5. package/lib/matchers/browser/toHaveTitleContaining.js +1 -1
  6. package/lib/matchers/browser/toHaveUrl.js +4 -4
  7. package/lib/matchers/browser/toHaveUrlContaining.js +1 -1
  8. package/lib/matchers/element/toBeClickable.js +1 -1
  9. package/lib/matchers/element/toBeDisabled.js +1 -1
  10. package/lib/matchers/element/toBeDisplayed.js +1 -1
  11. package/lib/matchers/element/toBeDisplayedInViewport.js +1 -1
  12. package/lib/matchers/element/toBeEnabled.js +1 -1
  13. package/lib/matchers/element/toBeExisting.js +1 -1
  14. package/lib/matchers/element/toBeFocused.js +1 -1
  15. package/lib/matchers/element/toBeSelected.js +2 -2
  16. package/lib/matchers/element/toHaveAttribute.js +10 -10
  17. package/lib/matchers/element/toHaveAttributeContaining.js +1 -1
  18. package/lib/matchers/element/toHaveChildren.js +10 -8
  19. package/lib/matchers/element/toHaveElementClass.js +5 -5
  20. package/lib/matchers/element/toHaveElementClassContaining.js +2 -2
  21. package/lib/matchers/element/toHaveElementProperty.js +7 -7
  22. package/lib/matchers/element/toHaveHref.js +1 -1
  23. package/lib/matchers/element/toHaveHrefContaining.js +1 -1
  24. package/lib/matchers/element/toHaveId.js +1 -1
  25. package/lib/matchers/element/toHaveStyle.js +5 -5
  26. package/lib/matchers/element/toHaveText.js +6 -6
  27. package/lib/matchers/element/toHaveTextContaining.js +1 -1
  28. package/lib/matchers/element/toHaveValue.js +1 -1
  29. package/lib/matchers/element/toHaveValueContaining.js +1 -1
  30. package/lib/matchers/elements/toBeElementsArrayOfSize.js +7 -7
  31. package/lib/matchers/mock/toBeRequested.js +1 -1
  32. package/lib/matchers/mock/toBeRequestedTimes.js +5 -5
  33. package/lib/matchers/mock/toBeRequestedWith.js +6 -6
  34. package/lib/matchers/mock/toBeRequestedWithResponse.js +1 -1
  35. package/lib/util/executeCommand.js +1 -1
  36. package/lib/util/expectAdapter.js +6 -6
  37. package/lib/util/formatMessage.js +9 -9
  38. package/lib/util/refetchElements.js +1 -1
  39. package/lib/utils.js +18 -14
  40. package/package.json +14 -14
  41. package/types/standalone-global.d.ts +3 -0
package/README.md CHANGED
@@ -22,21 +22,41 @@ NOTE: [WebdriverIO](https://github.com/webdriverio/webdriverio) `v5.16.11` or hi
22
22
 
23
23
  ## Usage
24
24
 
25
- In your `wdio.conf.js`
26
- ```js
27
- before () { // not needed in WebdriverIO v6
28
- require('expect-webdriverio')
29
- },
30
- ```
25
+ ### Using WebdriverIO Testrunner
26
+
27
+ If you run your tests through the [WDIO testrunner](https://webdriver.io/docs/clioptions) no additional setup is needed. WebdriverIO initialises `expect-webdriverio` and makes `expect` available in the global scope. So you can use it directly in your tests:
31
28
 
32
- In your test
33
29
  ```js
34
- const $button = $('button')
35
- expect($button).toBeDisplayed()
30
+ const $button = await $('button')
31
+ await expect($button).toBeDisplayed()
36
32
  ```
37
33
 
38
34
  See more [Examples](docs/Examples.md)
39
35
 
36
+ ### Using in a standalone script
37
+
38
+ If you embed WebdriverIO in a standalone script, make sure you import `expect-webdriverio` before you use it anywhere.
39
+
40
+ ```js
41
+ const { remote } = require('webdriverio');
42
+ require('expect-webdriverio')
43
+
44
+ ;(async () => {
45
+ const browser = await remote({
46
+ capabilities: {
47
+ browserName: 'chrome'
48
+ }
49
+ })
50
+
51
+ await browser.url('https://webdriver.io')
52
+
53
+ const $button = await browser.$('button')
54
+ await expect($button).toBeDisplayed()
55
+
56
+ await browser.deleteSession()
57
+ })().catch(console.error)
58
+ ```
59
+
40
60
  ## API
41
61
 
42
62
  Please see [API doc](docs/API.md)
@@ -17,7 +17,7 @@ const loadExpect = () => {
17
17
  exports.loadExpect = loadExpect;
18
18
  const addMatchers = () => {
19
19
  if (global.expect === undefined) {
20
- if (!exports.loadExpect()) {
20
+ if (!(0, exports.loadExpect)()) {
21
21
  return;
22
22
  }
23
23
  global.expect = expectLib;
@@ -25,8 +25,8 @@ const addMatchers = () => {
25
25
  else {
26
26
  expectLib = global.expect;
27
27
  }
28
- if (!global.expect.extend && !exports.isJasmine()) {
29
- if (!exports.loadExpect()) {
28
+ if (!global.expect.extend && !(0, exports.isJasmine)()) {
29
+ if (!(0, exports.loadExpect)()) {
30
30
  return;
31
31
  }
32
32
  global.expectWdio = expectLib;
package/lib/index.js CHANGED
@@ -2,5 +2,5 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.setOptions = void 0;
4
4
  const addMatchers_1 = require("./addMatchers");
5
- addMatchers_1.addMatchers();
5
+ (0, addMatchers_1.addMatchers)();
6
6
  exports.setOptions = require('./options').setDefaultOptions;
@@ -8,11 +8,11 @@ function toHaveTitleFn(browser, title, options = {}) {
8
8
  const { expectation = 'title', verb = 'have' } = this;
9
9
  return browser.call(async () => {
10
10
  let actual;
11
- const pass = await utils_1.waitUntil(async () => {
11
+ const pass = await (0, utils_1.waitUntil)(async () => {
12
12
  actual = await browser.getTitle();
13
- return utils_1.compareText(actual, title, options).result;
13
+ return (0, utils_1.compareText)(actual, title, options).result;
14
14
  }, isNot, options);
15
- const message = utils_1.enhanceError('window', title, actual, this, verb, expectation, '', options);
15
+ const message = (0, utils_1.enhanceError)('window', title, actual, this, verb, expectation, '', options);
16
16
  return {
17
17
  pass,
18
18
  message: () => message
@@ -21,6 +21,6 @@ function toHaveTitleFn(browser, title, options = {}) {
21
21
  }
22
22
  exports.toHaveTitleFn = toHaveTitleFn;
23
23
  function toHaveTitle(...args) {
24
- return expectAdapter_1.runExpect.call(this, toHaveTitleFn, args);
24
+ return expectAdapter_1.runExpect.call(this || {}, toHaveTitleFn, args);
25
25
  }
26
26
  exports.toHaveTitle = toHaveTitle;
@@ -10,6 +10,6 @@ function toHaveTitleContainingFn(browser, title, options = {}) {
10
10
  });
11
11
  }
12
12
  function toHaveTitleContaining(...args) {
13
- return expectAdapter_1.runExpect.call(this, toHaveTitleContainingFn, args);
13
+ return expectAdapter_1.runExpect.call(this || {}, toHaveTitleContainingFn, args);
14
14
  }
15
15
  exports.toHaveTitleContaining = toHaveTitleContaining;
@@ -8,11 +8,11 @@ function toHaveUrlFn(browser, url, options = {}) {
8
8
  const { expectation = 'url', verb = 'have' } = this;
9
9
  return browser.call(async () => {
10
10
  let actual;
11
- const pass = await utils_1.waitUntil(async () => {
11
+ const pass = await (0, utils_1.waitUntil)(async () => {
12
12
  actual = await browser.getUrl();
13
- return utils_1.compareText(actual, url, options).result;
13
+ return (0, utils_1.compareText)(actual, url, options).result;
14
14
  }, isNot, options);
15
- const message = utils_1.enhanceError('window', url, actual, this, verb, expectation, '', options);
15
+ const message = (0, utils_1.enhanceError)('window', url, actual, this, verb, expectation, '', options);
16
16
  return {
17
17
  pass,
18
18
  message: () => message
@@ -21,6 +21,6 @@ function toHaveUrlFn(browser, url, options = {}) {
21
21
  }
22
22
  exports.toHaveUrlFn = toHaveUrlFn;
23
23
  function toHaveUrl(...args) {
24
- return expectAdapter_1.runExpect.call(this, toHaveUrlFn, args);
24
+ return expectAdapter_1.runExpect.call(this || {}, toHaveUrlFn, args);
25
25
  }
26
26
  exports.toHaveUrl = toHaveUrl;
@@ -10,6 +10,6 @@ function toHaveUrlContainingFn(browser, url, options = {}) {
10
10
  });
11
11
  }
12
12
  function toHaveUrlContaining(...args) {
13
- return expectAdapter_1.runExpect.call(this, toHaveUrlContainingFn, args);
13
+ return expectAdapter_1.runExpect.call(this || {}, toHaveUrlContainingFn, args);
14
14
  }
15
15
  exports.toHaveUrlContaining = toHaveUrlContaining;
@@ -18,6 +18,6 @@ function toBeClickableFn(received, options = {}) {
18
18
  });
19
19
  }
20
20
  function toBeClickable(...args) {
21
- return expectAdapter_1.runExpect.call(this, toBeClickableFn, args);
21
+ return expectAdapter_1.runExpect.call(this || {}, toBeClickableFn, args);
22
22
  }
23
23
  exports.toBeClickable = toBeClickable;
@@ -11,6 +11,6 @@ function toBeDisabledFn(received, options = {}) {
11
11
  });
12
12
  }
13
13
  function toBeDisabled(...args) {
14
- return expectAdapter_1.runExpect.call(this, toBeDisabledFn, args);
14
+ return expectAdapter_1.runExpect.call(this || {}, toBeDisabledFn, args);
15
15
  }
16
16
  exports.toBeDisabled = toBeDisabled;
@@ -18,6 +18,6 @@ function toBeDisplayedFn(received, options = {}) {
18
18
  });
19
19
  }
20
20
  function toBeDisplayed(...args) {
21
- return expectAdapter_1.runExpect.call(this, toBeDisplayedFn, args);
21
+ return expectAdapter_1.runExpect.call(this || {}, toBeDisplayedFn, args);
22
22
  }
23
23
  exports.toBeDisplayed = toBeDisplayed;
@@ -18,6 +18,6 @@ function toBeDisplayedInViewportFn(received, options = {}) {
18
18
  });
19
19
  }
20
20
  function toBeDisplayedInViewport(...args) {
21
- return expectAdapter_1.runExpect.call(this, toBeDisplayedInViewportFn, args);
21
+ return expectAdapter_1.runExpect.call(this || {}, toBeDisplayedInViewportFn, args);
22
22
  }
23
23
  exports.toBeDisplayedInViewport = toBeDisplayedInViewport;
@@ -11,6 +11,6 @@ function toBeEnabledFn(received, options = {}) {
11
11
  });
12
12
  }
13
13
  function toBeEnabled(...args) {
14
- return expectAdapter_1.runExpect.call(this, toBeEnabledFn, args);
14
+ return expectAdapter_1.runExpect.call(this || {}, toBeEnabledFn, args);
15
15
  }
16
16
  exports.toBeEnabled = toBeEnabled;
@@ -19,7 +19,7 @@ function toExistFn(received, options = {}) {
19
19
  });
20
20
  }
21
21
  function toExist(...args) {
22
- return expectAdapter_1.runExpect.call(this, toExistFn, args);
22
+ return expectAdapter_1.runExpect.call(this || {}, toExistFn, args);
23
23
  }
24
24
  exports.toExist = toExist;
25
25
  function toBeExisting(el, options) {
@@ -11,6 +11,6 @@ function toBeFocusedFn(received, options = {}) {
11
11
  });
12
12
  }
13
13
  function toBeFocused(...args) {
14
- return expectAdapter_1.runExpect.call(this, toBeFocusedFn, args);
14
+ return expectAdapter_1.runExpect.call(this || {}, toBeFocusedFn, args);
15
15
  }
16
16
  exports.toBeFocused = toBeFocused;
@@ -11,11 +11,11 @@ function toBeSelectedFn(received, options = {}) {
11
11
  });
12
12
  }
13
13
  function toBeSelected(...args) {
14
- return expectAdapter_1.runExpect.call(this, toBeSelectedFn, args);
14
+ return expectAdapter_1.runExpect.call(this || {}, toBeSelectedFn, args);
15
15
  }
16
16
  exports.toBeSelected = toBeSelected;
17
17
  function toBeChecked(el, options) {
18
- const context = expectAdapter_1.getContext(this);
18
+ const context = (0, expectAdapter_1.getContext)(this);
19
19
  context.expectation = 'checked';
20
20
  return toBeSelected.call(context, el, options);
21
21
  }
@@ -17,7 +17,7 @@ async function conditionAttrAndValue(el, attribute, value, options) {
17
17
  if (typeof attr !== 'string') {
18
18
  return { result: false, value: attr };
19
19
  }
20
- return utils_1.compareText(attr, value, options);
20
+ return (0, utils_1.compareText)(attr, value, options);
21
21
  }
22
22
  function toHaveAttributeAndValueFn(received, attribute, value, options = {}) {
23
23
  const isNot = this.isNot;
@@ -25,15 +25,15 @@ function toHaveAttributeAndValueFn(received, attribute, value, options = {}) {
25
25
  return browser.call(async () => {
26
26
  let el = await received;
27
27
  let attr;
28
- const pass = await utils_1.waitUntil(async () => {
28
+ const pass = await (0, utils_1.waitUntil)(async () => {
29
29
  const result = await utils_1.executeCommand.call(this, el, conditionAttrAndValue, options, [attribute, value, options]);
30
30
  el = result.el;
31
31
  attr = result.values;
32
32
  return result.success;
33
33
  }, isNot, options);
34
- utils_1.updateElementsArray(pass, received, el);
35
- const expected = utils_1.wrapExpectedWithArray(el, attr, value);
36
- const message = utils_1.enhanceError(el, expected, attr, this, verb, expectation, attribute, options);
34
+ (0, utils_1.updateElementsArray)(pass, received, el);
35
+ const expected = (0, utils_1.wrapExpectedWithArray)(el, attr, value);
36
+ const message = (0, utils_1.enhanceError)(el, expected, attr, this, verb, expectation, attribute, options);
37
37
  return {
38
38
  pass,
39
39
  message: () => message
@@ -46,13 +46,13 @@ function toHaveAttributeFn(received, attribute) {
46
46
  const { expectation = 'attribute', verb = 'have' } = this;
47
47
  return browser.call(async () => {
48
48
  let el = await received;
49
- const pass = await utils_1.waitUntil(async () => {
49
+ const pass = await (0, utils_1.waitUntil)(async () => {
50
50
  const result = await utils_1.executeCommand.call(this, el, conditionAttr, {}, [attribute]);
51
51
  el = result.el;
52
52
  return result.success;
53
53
  }, isNot, {});
54
- utils_1.updateElementsArray(pass, received, el);
55
- const message = utils_1.enhanceError(el, !isNot, pass, this, verb, expectation, attribute, {});
54
+ (0, utils_1.updateElementsArray)(pass, received, el);
55
+ const message = (0, utils_1.enhanceError)(el, !isNot, pass, this, verb, expectation, attribute, {});
56
56
  return {
57
57
  pass,
58
58
  message: () => message
@@ -62,10 +62,10 @@ function toHaveAttributeFn(received, attribute) {
62
62
  exports.toHaveAttributeFn = toHaveAttributeFn;
63
63
  function toHaveAttribute(...args) {
64
64
  if (args.length === 3 || args.length === 4) {
65
- return expectAdapter_1.runExpect.call(this, toHaveAttributeAndValueFn, args);
65
+ return expectAdapter_1.runExpect.call(this || {}, toHaveAttributeAndValueFn, args);
66
66
  }
67
67
  else {
68
- return expectAdapter_1.runExpect.call(this, toHaveAttributeFn, args);
68
+ return expectAdapter_1.runExpect.call(this || {}, toHaveAttributeFn, args);
69
69
  }
70
70
  }
71
71
  exports.toHaveAttribute = toHaveAttribute;
@@ -10,7 +10,7 @@ function toHaveAttributeContainingFn(el, attribute, value, options = {}) {
10
10
  });
11
11
  }
12
12
  function toHaveAttributeContaining(...args) {
13
- return expectAdapter_1.runExpect.call(this, toHaveAttributeContainingFn, args);
13
+ return expectAdapter_1.runExpect.call(this || {}, toHaveAttributeContainingFn, args);
14
14
  }
15
15
  exports.toHaveAttributeContaining = toHaveAttributeContaining;
16
16
  exports.toHaveAttrContaining = toHaveAttributeContaining;
@@ -5,14 +5,16 @@ const utils_1 = require("../../utils");
5
5
  const expectAdapter_1 = require("../../util/expectAdapter");
6
6
  async function condition(el, options) {
7
7
  const children = await el.$$('./*');
8
- if (!options.lte && !options.gte && !options.eq) {
8
+ if (typeof options.lte !== 'number' &&
9
+ typeof options.gte !== 'number' &&
10
+ typeof options.eq !== 'number') {
9
11
  return {
10
12
  result: children.length > 0,
11
13
  value: children === null || children === void 0 ? void 0 : children.length
12
14
  };
13
15
  }
14
16
  return {
15
- result: utils_1.compareNumbers(children === null || children === void 0 ? void 0 : children.length, options),
17
+ result: (0, utils_1.compareNumbers)(children === null || children === void 0 ? void 0 : children.length, options),
16
18
  value: children === null || children === void 0 ? void 0 : children.length
17
19
  };
18
20
  }
@@ -29,16 +31,16 @@ function toHaveChildrenFn(received, expected, options = {}) {
29
31
  return browser.call(async () => {
30
32
  let el = await received;
31
33
  let children;
32
- const pass = await utils_1.waitUntil(async () => {
34
+ const pass = await (0, utils_1.waitUntil)(async () => {
33
35
  const result = await utils_1.executeCommand.call(this, el, condition, numberOptions, [numberOptions]);
34
36
  el = result.el;
35
37
  children = result.values;
36
38
  return result.success;
37
39
  }, isNot, { ...numberOptions, ...options });
38
- utils_1.updateElementsArray(pass, received, el);
39
- const error = utils_1.numberError(numberOptions);
40
- const expected = utils_1.wrapExpectedWithArray(el, children, error);
41
- const message = utils_1.enhanceError(el, expected, children, this, verb, expectation, '', numberOptions);
40
+ (0, utils_1.updateElementsArray)(pass, received, el);
41
+ const error = (0, utils_1.numberError)(numberOptions);
42
+ const expected = (0, utils_1.wrapExpectedWithArray)(el, children, error);
43
+ const message = (0, utils_1.enhanceError)(el, expected, children, this, verb, expectation, '', numberOptions);
42
44
  return {
43
45
  pass,
44
46
  message: () => message
@@ -46,6 +48,6 @@ function toHaveChildrenFn(received, expected, options = {}) {
46
48
  });
47
49
  }
48
50
  function toHaveChildren(...args) {
49
- return expectAdapter_1.runExpect.call(this, toHaveChildrenFn, args);
51
+ return expectAdapter_1.runExpect.call(this || {}, toHaveChildrenFn, args);
50
52
  }
51
53
  exports.toHaveChildren = toHaveChildren;
@@ -35,14 +35,14 @@ function toHaveElementClassFn(received, className, options = {}) {
35
35
  return browser.call(async () => {
36
36
  let el = await received;
37
37
  let attr;
38
- const pass = await utils_1.waitUntil(async () => {
38
+ const pass = await (0, utils_1.waitUntil)(async () => {
39
39
  const result = await utils_1.executeCommand.call(this, el, condition, options, [attribute, className, options]);
40
40
  el = result.el;
41
41
  attr = result.values;
42
42
  return result.success;
43
43
  }, isNot, options);
44
- utils_1.updateElementsArray(pass, received, el);
45
- const message = utils_1.enhanceError(el, utils_1.wrapExpectedWithArray(el, attr, className), attr, this, verb, expectation, '', options);
44
+ (0, utils_1.updateElementsArray)(pass, received, el);
45
+ const message = (0, utils_1.enhanceError)(el, (0, utils_1.wrapExpectedWithArray)(el, attr, className), attr, this, verb, expectation, '', options);
46
46
  return {
47
47
  pass,
48
48
  message: () => message
@@ -50,11 +50,11 @@ function toHaveElementClassFn(received, className, options = {}) {
50
50
  });
51
51
  }
52
52
  function toHaveElementClass(...args) {
53
- return expectAdapter_1.runExpect.call(this, toHaveElementClassFn, args);
53
+ return expectAdapter_1.runExpect.call(this || {}, toHaveElementClassFn, args);
54
54
  }
55
55
  exports.toHaveElementClass = toHaveElementClass;
56
56
  function toHaveClass(...args) {
57
57
  console.warn('expect(...).toHaveClass is deprecated and will be removed in next release. Use toHaveElementClass instead.');
58
- return expectAdapter_1.runExpect.call(this, toHaveElementClassFn, args);
58
+ return expectAdapter_1.runExpect.call(this || {}, toHaveElementClassFn, args);
59
59
  }
60
60
  exports.toHaveClass = toHaveClass;
@@ -10,11 +10,11 @@ function toHaveElementClassContainingFn(el, className, options = {}) {
10
10
  });
11
11
  }
12
12
  function toHaveElementClassContaining(...args) {
13
- return expectAdapter_1.runExpect.call(this, toHaveElementClassContainingFn, args);
13
+ return expectAdapter_1.runExpect.call(this || {}, toHaveElementClassContainingFn, args);
14
14
  }
15
15
  exports.toHaveElementClassContaining = toHaveElementClassContaining;
16
16
  function toHaveClassContaining(...args) {
17
17
  console.warn('expect(...).toHaveClassContaining is deprecated and will be removed in next release. Use toHaveElementClassContaining instead.');
18
- return expectAdapter_1.runExpect.call(this, toHaveElementClassContainingFn, args);
18
+ return expectAdapter_1.runExpect.call(this || {}, toHaveElementClassContainingFn, args);
19
19
  }
20
20
  exports.toHaveClassContaining = toHaveClassContaining;
@@ -16,7 +16,7 @@ async function condition(el, property, value, options = {}) {
16
16
  return { result: prop === value, value: prop };
17
17
  }
18
18
  prop = prop.toString();
19
- return utils_1.compareText(prop, value, options);
19
+ return (0, utils_1.compareText)(prop, value, options);
20
20
  }
21
21
  function toHaveElementPropertyFn(received, property, value, options = {}) {
22
22
  const isNot = this.isNot;
@@ -24,20 +24,20 @@ function toHaveElementPropertyFn(received, property, value, options = {}) {
24
24
  return browser.call(async () => {
25
25
  let el = await received;
26
26
  let prop;
27
- const pass = await utils_1.waitUntil(async () => {
27
+ const pass = await (0, utils_1.waitUntil)(async () => {
28
28
  const result = await utils_1.executeCommand.call(this, el, condition, options, [property, value]);
29
29
  el = result.el;
30
30
  prop = result.values;
31
31
  return result.success;
32
32
  }, isNot, options);
33
- utils_1.updateElementsArray(pass, received, el);
33
+ (0, utils_1.updateElementsArray)(pass, received, el);
34
34
  let message;
35
35
  if (value === undefined) {
36
- message = utils_1.enhanceError(el, !isNot, pass, this, verb, expectation, property, options);
36
+ message = (0, utils_1.enhanceError)(el, !isNot, pass, this, verb, expectation, property, options);
37
37
  }
38
38
  else {
39
- const expected = utils_1.wrapExpectedWithArray(el, prop, value);
40
- message = utils_1.enhanceError(el, expected, prop, this, verb, expectation, property, options);
39
+ const expected = (0, utils_1.wrapExpectedWithArray)(el, prop, value);
40
+ message = (0, utils_1.enhanceError)(el, expected, prop, this, verb, expectation, property, options);
41
41
  }
42
42
  return {
43
43
  pass,
@@ -47,6 +47,6 @@ function toHaveElementPropertyFn(received, property, value, options = {}) {
47
47
  }
48
48
  exports.toHaveElementPropertyFn = toHaveElementPropertyFn;
49
49
  function toHaveElementProperty(...args) {
50
- return expectAdapter_1.runExpect.call(this, toHaveElementPropertyFn, args);
50
+ return expectAdapter_1.runExpect.call(this || {}, toHaveElementPropertyFn, args);
51
51
  }
52
52
  exports.toHaveElementProperty = toHaveElementProperty;
@@ -8,7 +8,7 @@ function toHaveHrefFn(el, href, options = {}) {
8
8
  }
9
9
  exports.toHaveHrefFn = toHaveHrefFn;
10
10
  function toHaveHref(...args) {
11
- return expectAdapter_1.runExpect.call(this, toHaveHrefFn, args);
11
+ return expectAdapter_1.runExpect.call(this || {}, toHaveHrefFn, args);
12
12
  }
13
13
  exports.toHaveHref = toHaveHref;
14
14
  exports.toHaveLink = toHaveHref;
@@ -10,7 +10,7 @@ function toHaveHrefContainingFn(el, href, options = {}) {
10
10
  });
11
11
  }
12
12
  function toHaveHrefContaining(...args) {
13
- return expectAdapter_1.runExpect.call(this, toHaveHrefContainingFn, args);
13
+ return expectAdapter_1.runExpect.call(this || {}, toHaveHrefContainingFn, args);
14
14
  }
15
15
  exports.toHaveHrefContaining = toHaveHrefContaining;
16
16
  exports.toHaveLinkContaining = toHaveHrefContaining;
@@ -8,6 +8,6 @@ function toHaveIdFn(el, id, options = {}) {
8
8
  }
9
9
  exports.toHaveIdFn = toHaveIdFn;
10
10
  function toHaveId(...args) {
11
- return expectAdapter_1.runExpect.call(this, toHaveIdFn, args);
11
+ return expectAdapter_1.runExpect.call(this || {}, toHaveIdFn, args);
12
12
  }
13
13
  exports.toHaveId = toHaveId;
@@ -4,7 +4,7 @@ exports.toHaveStyle = exports.toHaveStyleFn = void 0;
4
4
  const utils_1 = require("../../utils");
5
5
  const expectAdapter_1 = require("../../util/expectAdapter");
6
6
  async function condition(el, style, options) {
7
- return utils_1.compareStyle(el, style, options);
7
+ return (0, utils_1.compareStyle)(el, style, options);
8
8
  }
9
9
  function toHaveStyleFn(received, style, options = {}) {
10
10
  const isNot = this.isNot;
@@ -12,14 +12,14 @@ function toHaveStyleFn(received, style, options = {}) {
12
12
  return browser.call(async () => {
13
13
  let el = await received;
14
14
  let actualStyle;
15
- const pass = await utils_1.waitUntil(async () => {
15
+ const pass = await (0, utils_1.waitUntil)(async () => {
16
16
  const result = await utils_1.executeCommand.call(this, el, condition, options, [style, options]);
17
17
  el = result.el;
18
18
  actualStyle = result.values;
19
19
  return result.success;
20
20
  }, isNot, options);
21
- utils_1.updateElementsArray(pass, received, el);
22
- const message = utils_1.enhanceError(el, utils_1.wrapExpectedWithArray(el, actualStyle, style), actualStyle, this, verb, expectation, '', options);
21
+ (0, utils_1.updateElementsArray)(pass, received, el);
22
+ const message = (0, utils_1.enhanceError)(el, (0, utils_1.wrapExpectedWithArray)(el, actualStyle, style), actualStyle, this, verb, expectation, '', options);
23
23
  return {
24
24
  pass,
25
25
  message: () => message
@@ -28,6 +28,6 @@ function toHaveStyleFn(received, style, options = {}) {
28
28
  }
29
29
  exports.toHaveStyleFn = toHaveStyleFn;
30
30
  function toHaveStyle(...args) {
31
- return expectAdapter_1.runExpect.call(this, toHaveStyleFn, args);
31
+ return expectAdapter_1.runExpect.call(this || {}, toHaveStyleFn, args);
32
32
  }
33
33
  exports.toHaveStyle = toHaveStyle;
@@ -6,9 +6,9 @@ const expectAdapter_1 = require("../../util/expectAdapter");
6
6
  async function condition(el, text, options) {
7
7
  const actualText = await el.getText();
8
8
  if (Array.isArray(text)) {
9
- return utils_1.compareTextWithArray(actualText, text, options);
9
+ return (0, utils_1.compareTextWithArray)(actualText, text, options);
10
10
  }
11
- return utils_1.compareText(actualText, text, options);
11
+ return (0, utils_1.compareText)(actualText, text, options);
12
12
  }
13
13
  function toHaveTextFn(received, text, options = {}) {
14
14
  const isNot = this.isNot;
@@ -16,14 +16,14 @@ function toHaveTextFn(received, text, options = {}) {
16
16
  return browser.call(async () => {
17
17
  let el = await received;
18
18
  let actualText;
19
- const pass = await utils_1.waitUntil(async () => {
19
+ const pass = await (0, utils_1.waitUntil)(async () => {
20
20
  const result = await utils_1.executeCommand.call(this, el, condition, options, [text, options]);
21
21
  el = result.el;
22
22
  actualText = result.values;
23
23
  return result.success;
24
24
  }, isNot, options);
25
- utils_1.updateElementsArray(pass, received, el);
26
- const message = utils_1.enhanceError(el, utils_1.wrapExpectedWithArray(el, actualText, text), actualText, this, verb, expectation, '', options);
25
+ (0, utils_1.updateElementsArray)(pass, received, el);
26
+ const message = (0, utils_1.enhanceError)(el, (0, utils_1.wrapExpectedWithArray)(el, actualText, text), actualText, this, verb, expectation, '', options);
27
27
  return {
28
28
  pass,
29
29
  message: () => message
@@ -32,6 +32,6 @@ function toHaveTextFn(received, text, options = {}) {
32
32
  }
33
33
  exports.toHaveTextFn = toHaveTextFn;
34
34
  function toHaveText(...args) {
35
- return expectAdapter_1.runExpect.call(this, toHaveTextFn, args);
35
+ return expectAdapter_1.runExpect.call(this || {}, toHaveTextFn, args);
36
36
  }
37
37
  exports.toHaveText = toHaveText;
@@ -10,6 +10,6 @@ function toHaveTextContainingFn(el, text, options = {}) {
10
10
  });
11
11
  }
12
12
  function toHaveTextContaining(...args) {
13
- return expectAdapter_1.runExpect.call(this, toHaveTextContainingFn, args);
13
+ return expectAdapter_1.runExpect.call(this || {}, toHaveTextContainingFn, args);
14
14
  }
15
15
  exports.toHaveTextContaining = toHaveTextContaining;
@@ -8,6 +8,6 @@ function toHaveValueFn(el, value, options = {}) {
8
8
  }
9
9
  exports.toHaveValueFn = toHaveValueFn;
10
10
  function toHaveValue(...args) {
11
- return expectAdapter_1.runExpect.call(this, toHaveValueFn, args);
11
+ return expectAdapter_1.runExpect.call(this || {}, toHaveValueFn, args);
12
12
  }
13
13
  exports.toHaveValue = toHaveValue;
@@ -10,6 +10,6 @@ function toHaveValueContainingFn(el, value, options = {}) {
10
10
  });
11
11
  }
12
12
  function toHaveValueContaining(...args) {
13
- return expectAdapter_1.runExpect.call(this, toHaveValueContainingFn, args);
13
+ return expectAdapter_1.runExpect.call(this || {}, toHaveValueContainingFn, args);
14
14
  }
15
15
  exports.toHaveValueContaining = toHaveValueContaining;
@@ -20,13 +20,13 @@ function toBeElementsArrayOfSizeFn(received, expected, options = {}) {
20
20
  return browser.call(async () => {
21
21
  let elements = await received;
22
22
  const arrLength = elements.length;
23
- const pass = await utils_1.waitUntil(async () => {
24
- elements = await refetchElements_1.refetchElements(elements, numberOptions.wait, true);
25
- return utils_1.compareNumbers(elements.length, numberOptions);
23
+ const pass = await (0, utils_1.waitUntil)(async () => {
24
+ elements = await (0, refetchElements_1.refetchElements)(elements, numberOptions.wait, true);
25
+ return (0, utils_1.compareNumbers)(elements.length, numberOptions);
26
26
  }, isNot, { ...numberOptions, ...options });
27
- utils_1.updateElementsArray(pass, received, elements, true);
28
- const error = utils_1.numberError(numberOptions);
29
- const message = utils_1.enhanceError(elements, error, arrLength, this, verb, expectation, '', numberOptions);
27
+ (0, utils_1.updateElementsArray)(pass, received, elements, true);
28
+ const error = (0, utils_1.numberError)(numberOptions);
29
+ const message = (0, utils_1.enhanceError)(elements, error, arrLength, this, verb, expectation, '', numberOptions);
30
30
  return {
31
31
  pass,
32
32
  message: () => message
@@ -34,6 +34,6 @@ function toBeElementsArrayOfSizeFn(received, expected, options = {}) {
34
34
  });
35
35
  }
36
36
  function toBeElementsArrayOfSize(...args) {
37
- return expectAdapter_1.runExpect.call(this, toBeElementsArrayOfSizeFn, args);
37
+ return expectAdapter_1.runExpect.call(this || {}, toBeElementsArrayOfSizeFn, args);
38
38
  }
39
39
  exports.toBeElementsArrayOfSize = toBeElementsArrayOfSize;
@@ -7,6 +7,6 @@ function toBeRequestedFn(received, options = {}) {
7
7
  return toBeRequestedTimes_1.toBeRequestedTimes.call({ ...(this || {}), expectation: 'called' }, received, { ...options, gte: 1 });
8
8
  }
9
9
  function toBeRequested(...args) {
10
- return expectAdapter_1.runExpect.call(this, toBeRequestedFn, args);
10
+ return expectAdapter_1.runExpect.call(this || {}, toBeRequestedFn, args);
11
11
  }
12
12
  exports.toBeRequested = toBeRequested;
@@ -16,12 +16,12 @@ function toBeRequestedTimesFn(received, expected = {}, options = {}) {
16
16
  }
17
17
  return browser.call(async () => {
18
18
  let actual;
19
- const pass = await utils_1.waitUntil(async () => {
19
+ const pass = await (0, utils_1.waitUntil)(async () => {
20
20
  actual = received.calls.length;
21
- return utils_1.compareNumbers(actual, numberOptions);
21
+ return (0, utils_1.compareNumbers)(actual, numberOptions);
22
22
  }, isNot, { ...numberOptions, ...options });
23
- const error = formatMessage_1.numberError(numberOptions);
24
- const message = utils_1.enhanceError('mock', error, actual, this, verb, expectation, '', numberOptions);
23
+ const error = (0, formatMessage_1.numberError)(numberOptions);
24
+ const message = (0, utils_1.enhanceError)('mock', error, actual, this, verb, expectation, '', numberOptions);
25
25
  return {
26
26
  pass,
27
27
  message: () => message
@@ -30,6 +30,6 @@ function toBeRequestedTimesFn(received, expected = {}, options = {}) {
30
30
  }
31
31
  exports.toBeRequestedTimesFn = toBeRequestedTimesFn;
32
32
  function toBeRequestedTimes(...args) {
33
- return expectAdapter_1.runExpect.call(this, toBeRequestedTimesFn, args);
33
+ return expectAdapter_1.runExpect.call(this || {}, toBeRequestedTimesFn, args);
34
34
  }
35
35
  exports.toBeRequestedTimes = toBeRequestedTimes;
@@ -11,7 +11,7 @@ function toBeRequestedWithFn(received, requestedWith = {}, options = {}) {
11
11
  const { expectation = 'called with', verb = 'be' } = this;
12
12
  return browser.call(async () => {
13
13
  let actual;
14
- const pass = await utils_1.waitUntil(async () => {
14
+ const pass = await (0, utils_1.waitUntil)(async () => {
15
15
  for (const call of received.calls) {
16
16
  actual = call;
17
17
  if (methodMatcher(call.method, requestedWith.method) &&
@@ -26,7 +26,7 @@ function toBeRequestedWithFn(received, requestedWith = {}, options = {}) {
26
26
  }
27
27
  return false;
28
28
  }, isNot, { ...options, wait: isNot ? 0 : options.wait });
29
- const message = utils_1.enhanceError('mock', minifyRequestedWith(requestedWith), minifyRequestMock(actual, requestedWith) || 'was not called', this, verb, expectation, '', options);
29
+ const message = (0, utils_1.enhanceError)('mock', minifyRequestedWith(requestedWith), minifyRequestMock(actual, requestedWith) || 'was not called', this, verb, expectation, '', options);
30
30
  return {
31
31
  pass,
32
32
  message: () => message,
@@ -66,7 +66,7 @@ const urlMatcher = (url, expected) => {
66
66
  if (typeof expected === 'function') {
67
67
  return expected(url);
68
68
  }
69
- return jasmineUtils_1.equals(url, expected);
69
+ return (0, jasmineUtils_1.equals)(url, expected);
70
70
  };
71
71
  const headersMatcher = (headers, expected) => {
72
72
  if (typeof expected === 'undefined') {
@@ -75,7 +75,7 @@ const headersMatcher = (headers, expected) => {
75
75
  if (typeof expected === 'function') {
76
76
  return expected(headers);
77
77
  }
78
- return jasmineUtils_1.equals(headers, expected);
78
+ return (0, jasmineUtils_1.equals)(headers, expected);
79
79
  };
80
80
  const bodyMatcher = (body, expected) => {
81
81
  if (typeof expected === 'undefined') {
@@ -97,7 +97,7 @@ const bodyMatcher = (body, expected) => {
97
97
  return false;
98
98
  }
99
99
  }
100
- return jasmineUtils_1.equals(parsedBody, expected);
100
+ return (0, jasmineUtils_1.equals)(parsedBody, expected);
101
101
  };
102
102
  const isExpectedJsonLike = (expected) => {
103
103
  if (typeof expected === 'undefined') {
@@ -213,6 +213,6 @@ const deleteUndefinedValues = (obj, baseline = obj) => {
213
213
  });
214
214
  };
215
215
  function toBeRequestedWith(...args) {
216
- return expectAdapter_1.runExpect.call(this, toBeRequestedWithFn, args);
216
+ return expectAdapter_1.runExpect.call(this || {}, toBeRequestedWithFn, args);
217
217
  }
218
218
  exports.toBeRequestedWith = toBeRequestedWith;
@@ -8,6 +8,6 @@ function toBeRequestedWithResponseFn(received, response, options = {}) {
8
8
  }
9
9
  function toBeRequestedWithResponse(...args) {
10
10
  console.warn('expect(...).toBeRequestedWithResponse is deprecated and will be removed in next release. Use toBeRequestedWith instead.');
11
- return expectAdapter_1.runExpect.call(this, toBeRequestedWithResponseFn, args);
11
+ return expectAdapter_1.runExpect.call(this || {}, toBeRequestedWithResponseFn, args);
12
12
  }
13
13
  exports.toBeRequestedWithResponse = toBeRequestedWithResponse;
@@ -6,7 +6,7 @@ async function executeCommand(el, condition, options = {}, params = [], fullRefe
6
6
  const { isNot = false } = this;
7
7
  let elements;
8
8
  if (Array.isArray(el)) {
9
- elements = await refetchElements_1.refetchElements(el, options.wait, fullRefetch);
9
+ elements = await (0, refetchElements_1.refetchElements)(el, options.wait, fullRefetch);
10
10
  }
11
11
  else {
12
12
  elements = [el];
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.runExpect = exports.runJasmineExpect = exports.jestResultToJasmine = exports.buildJasmineFromJestResult = exports.runJestExpect = exports.getContext = void 0;
4
4
  const options_1 = require("../options");
5
- const config = options_1.getConfig();
5
+ const config = (0, options_1.getConfig)();
6
6
  const { mode: MODE } = config;
7
7
  const getContext = (context) => global === context ? {} : context || {};
8
8
  exports.getContext = getContext;
@@ -19,21 +19,21 @@ const buildJasmineFromJestResult = (result, isNot) => {
19
19
  exports.buildJasmineFromJestResult = buildJasmineFromJestResult;
20
20
  const jestResultToJasmine = (result, isNot) => {
21
21
  if (result instanceof Promise) {
22
- return result.then(jestStyleResult => exports.buildJasmineFromJestResult(jestStyleResult, isNot));
22
+ return result.then(jestStyleResult => (0, exports.buildJasmineFromJestResult)(jestStyleResult, isNot));
23
23
  }
24
- return exports.buildJasmineFromJestResult(result, isNot);
24
+ return (0, exports.buildJasmineFromJestResult)(result, isNot);
25
25
  };
26
26
  exports.jestResultToJasmine = jestResultToJasmine;
27
27
  function runJasmineExpect(fn) {
28
- const context = exports.getContext(this);
28
+ const context = (0, exports.getContext)(this);
29
29
  return {
30
30
  compare(...args) {
31
31
  const result = fn.apply({ ...context, isNot: false }, args);
32
- return exports.jestResultToJasmine(result, false);
32
+ return (0, exports.jestResultToJasmine)(result, false);
33
33
  },
34
34
  negativeCompare(...args) {
35
35
  const result = fn.apply({ ...context, isNot: true }, args);
36
- return exports.jestResultToJasmine(result, true);
36
+ return (0, exports.jestResultToJasmine)(result, true);
37
37
  }
38
38
  };
39
39
  }
@@ -19,14 +19,14 @@ const getSelectors = (el) => {
19
19
  const selectors = [];
20
20
  let parent;
21
21
  if (Array.isArray(el)) {
22
- selectors.push(`${el.foundWith}(\`${exports.getSelector(el)}\`)`);
22
+ selectors.push(`${el.foundWith}(\`${(0, exports.getSelector)(el)}\`)`);
23
23
  parent = el.parent;
24
24
  }
25
25
  else {
26
26
  parent = el;
27
27
  }
28
28
  while (parent && 'selector' in parent) {
29
- const selector = exports.getSelector(parent);
29
+ const selector = (0, exports.getSelector)(parent);
30
30
  const index = parent.index ? `[${parent.index}]` : '';
31
31
  selectors.push(`${parent.index ? '$' : ''}$(\`${selector}\`)${index}`);
32
32
  parent = parent.parent;
@@ -40,7 +40,7 @@ const not = (isNot) => {
40
40
  exports.not = not;
41
41
  const enhanceError = (subject, expected, actual, context, verb, expectation, arg2 = '', { message = '', containing = false }) => {
42
42
  const { isNot = false } = context;
43
- subject = typeof subject === 'string' ? subject : exports.getSelectors(subject);
43
+ subject = typeof subject === 'string' ? subject : (0, exports.getSelectors)(subject);
44
44
  let contain = '';
45
45
  if (containing) {
46
46
  contain = ' containing';
@@ -49,12 +49,12 @@ const enhanceError = (subject, expected, actual, context, verb, expectation, arg
49
49
  verb += ' ';
50
50
  }
51
51
  let diffString;
52
- if (isNot && jasmineUtils_1.equals(actual, expected)) {
53
- diffString = `${EXPECTED_LABEL}: ${jest_matcher_utils_1.printExpected(expected)}\n` +
54
- `${RECEIVED_LABEL}: ${jest_matcher_utils_1.printReceived(actual)}`;
52
+ if (isNot && (0, jasmineUtils_1.equals)(actual, expected)) {
53
+ diffString = `${EXPECTED_LABEL}: ${(0, jest_matcher_utils_1.printExpected)(expected)}\n` +
54
+ `${RECEIVED_LABEL}: ${(0, jest_matcher_utils_1.printReceived)(actual)}`;
55
55
  }
56
56
  else {
57
- diffString = jest_matcher_utils_1.printDiffOrStringify(expected, actual, EXPECTED_LABEL, RECEIVED_LABEL, true);
57
+ diffString = (0, jest_matcher_utils_1.printDiffOrStringify)(expected, actual, EXPECTED_LABEL, RECEIVED_LABEL, true);
58
58
  }
59
59
  if (isNot) {
60
60
  diffString = diffString
@@ -67,12 +67,12 @@ const enhanceError = (subject, expected, actual, context, verb, expectation, arg
67
67
  if (arg2) {
68
68
  arg2 = ` ${arg2}`;
69
69
  }
70
- const msg = `${message}Expect ${subject} ${exports.not(isNot)}to ${verb}${expectation}${arg2}${contain}\n\n${diffString}`;
70
+ const msg = `${message}Expect ${subject} ${(0, exports.not)(isNot)}to ${verb}${expectation}${arg2}${contain}\n\n${diffString}`;
71
71
  return msg;
72
72
  };
73
73
  exports.enhanceError = enhanceError;
74
74
  const enhanceErrorBe = (subject, pass, context, verb, expectation, options) => {
75
- return exports.enhanceError(subject, exports.not(context.isNot) + expectation, exports.not(!pass) + expectation, context, verb, expectation, '', options);
75
+ return (0, exports.enhanceError)(subject, (0, exports.not)(context.isNot) + expectation, (0, exports.not)(!pass) + expectation, context, verb, expectation, '', options);
76
76
  };
77
77
  exports.enhanceErrorBe = enhanceErrorBe;
78
78
  const numberError = (options = {}) => {
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.refetchElements = void 0;
4
4
  const options_1 = require("../options");
5
- const config = options_1.getConfig();
5
+ const config = (0, options_1.getConfig)();
6
6
  const { options: DEFAULT_OPTIONS } = config;
7
7
  const refetchElements = async (elements, wait = DEFAULT_OPTIONS.wait, full = false) => {
8
8
  if (elements) {
package/lib/utils.js CHANGED
@@ -11,7 +11,7 @@ const formatMessage_1 = require("./util/formatMessage");
11
11
  Object.defineProperty(exports, "enhanceError", { enumerable: true, get: function () { return formatMessage_1.enhanceError; } });
12
12
  Object.defineProperty(exports, "numberError", { enumerable: true, get: function () { return formatMessage_1.numberError; } });
13
13
  const expectAdapter_1 = require("./util/expectAdapter");
14
- const config = options_1.getConfig();
14
+ const config = (0, options_1.getConfig)();
15
15
  const { options: DEFAULT_OPTIONS } = config;
16
16
  const waitUntil = async (condition, isNot = false, { wait = DEFAULT_OPTIONS.wait, interval = DEFAULT_OPTIONS.interval } = {}) => {
17
17
  if (wait === 0) {
@@ -51,8 +51,8 @@ async function executeCommandBe(received, command, options) {
51
51
  el = result.el;
52
52
  return result.success;
53
53
  }, isNot, options);
54
- elementsUtil_1.updateElementsArray(pass, received, el);
55
- const message = formatMessage_1.enhanceErrorBe(el, pass, this, verb, expectation, options);
54
+ (0, elementsUtil_1.updateElementsArray)(pass, received, el);
55
+ const message = (0, formatMessage_1.enhanceErrorBe)(el, pass, this, verb, expectation, options);
56
56
  return {
57
57
  pass,
58
58
  message: () => message
@@ -87,7 +87,15 @@ const compareText = (actual, expected, { ignoreCase = false, trim = true, contai
87
87
  }
88
88
  if (ignoreCase) {
89
89
  actual = actual.toLowerCase();
90
- expected = expected.toLowerCase();
90
+ if (!(expected instanceof RegExp)) {
91
+ expected = expected.toLowerCase();
92
+ }
93
+ }
94
+ if (expected instanceof RegExp) {
95
+ return {
96
+ value: actual,
97
+ result: !!actual.match(expected)
98
+ };
91
99
  }
92
100
  if (containing) {
93
101
  return {
@@ -113,18 +121,14 @@ const compareTextWithArray = (actual, expectedArray, { ignoreCase = false, trim
113
121
  }
114
122
  if (ignoreCase) {
115
123
  actual = actual.toLowerCase();
116
- expectedArray = expectedArray.map(item => item.toLowerCase());
117
- }
118
- if (containing) {
119
- const textInArray = expectedArray.some((t) => actual.includes(t));
120
- return {
121
- value: actual,
122
- result: textInArray
123
- };
124
+ expectedArray = expectedArray.map(item => (item instanceof RegExp) ? item : item.toLowerCase());
124
125
  }
126
+ const textInArray = expectedArray.some((expected) => {
127
+ return expected instanceof RegExp ? !!actual.match(expected) : containing ? actual.includes(expected) : actual === expected;
128
+ });
125
129
  return {
126
130
  value: actual,
127
- result: expectedArray.includes(actual)
131
+ result: textInArray
128
132
  };
129
133
  };
130
134
  exports.compareTextWithArray = compareTextWithArray;
@@ -153,7 +157,7 @@ const compareStyle = async (actualEl, style, { ignoreCase = true, trim = false }
153
157
  };
154
158
  exports.compareStyle = compareStyle;
155
159
  function aliasFn(fn, { verb, expectation } = {}, ...args) {
156
- const context = expectAdapter_1.getContext(this);
160
+ const context = (0, expectAdapter_1.getContext)(this);
157
161
  context.verb = verb;
158
162
  context.expectation = expectation;
159
163
  return fn.apply(context, args);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expect-webdriverio",
3
- "version": "3.1.4",
3
+ "version": "3.3.0",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -42,22 +42,22 @@
42
42
  },
43
43
  "homepage": "https://github.com/webdriverio/expect-webdriverio#readme",
44
44
  "devDependencies": {
45
- "@types/jasmine": "^3.6.6",
46
- "@types/jest": "^27.0.1",
47
- "@types/node": "^15.0.1",
48
- "@typescript-eslint/eslint-plugin": "^4.17.0",
49
- "@typescript-eslint/parser": "^4.17.0",
50
- "eslint": "^7.21.0",
51
- "husky": "^7.0.0",
52
- "jest": "^26.6.3",
45
+ "@types/jasmine": "^4.0.0",
46
+ "@types/jest": "^27.0.2",
47
+ "@types/node": "^15.14.0",
48
+ "@typescript-eslint/eslint-plugin": "^5.1.0",
49
+ "@typescript-eslint/parser": "^5.1.0",
50
+ "eslint": "^8.1.0",
51
+ "husky": "^7.0.4",
52
+ "jest": "^27.3.1",
53
53
  "npm-run-all": "^4.1.5",
54
- "release-it": "^14.4.1",
54
+ "release-it": "^14.11.6",
55
55
  "rimraf": "^3.0.2",
56
56
  "shelljs": "^0.8.4",
57
- "ts-jest": "^26.5.3",
58
- "ts-node": "^10.0.0",
59
- "typescript": "^4.2.3",
60
- "webdriverio": "^7.1.1"
57
+ "ts-jest": "^27.0.7",
58
+ "ts-node": "^10.4.0",
59
+ "typescript": "^4.4.4",
60
+ "webdriverio": "^7.16.2"
61
61
  },
62
62
  "types": "types/jest-global.d.ts",
63
63
  "typeScriptVersion": "3.8.3",
@@ -1,5 +1,8 @@
1
1
  /// <reference types="expect-webdriverio/types/standalone"/>
2
2
 
3
+ /**
4
+ * to use as an additional expectation lib (not recommended)
5
+ */
3
6
  declare const expectWdio: ExpectWebdriverIO.Expect
4
7
 
5
8
  declare namespace NodeJS {