-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Description
Have you read the Contributing Guidelines on issues?
- I have read the Contributing Guidelines on issues.
WebdriverIO Version
8.11.2
Node.js Version
18.13.0
Mode
WDIO Testrunner
Which capabilities are you using?
No response
What happened?
In our project we use Custom Matchers from jasmine to simplify testing of certain expectations.
We have set up wdio to use the jasmine-framework adapter (v.8.11.2) by setting the config framework to jasmine.
When setting injectGlobals in the wdio-config to false - everything works fine.
When setting injectGlobals in the wdio-config to true - the custom matchers won't be present on the return value of expect(...)
A workaround currently implemented sets injectGlobals to false and explicitly defines globals from @wdio/globals on the global-Object.
What is your expected behavior?
A call to jasmine.addMatchers(...) should add the defined matchers to return values of expect-calls as described in the jasemine Documentation of addMatchers(...).
How to reproduce the bug.
I have provided a Demo Project that reproduces the bug and allows simple testing of the proposed workaround.
Relevant log output
"spec" Reporter:
------------------------------------------------------------------
[chrome 114.0.5735.133 linux #0-0] Running: chrome (v114.0.5735.133) on linux
[chrome 114.0.5735.133 linux #0-0] Session ID: 06e7c5baadf140e1dfe3c126f2a73c01
[chrome 114.0.5735.133 linux #0-0]
[chrome 114.0.5735.133 linux #0-0] » /test/specs/CustomMatchersTest.js
[chrome 114.0.5735.133 linux #0-0] expect utility
[chrome 114.0.5735.133 linux #0-0] ✖ should provide the custom matcher
[chrome 114.0.5735.133 linux #0-0]
[chrome 114.0.5735.133 linux #0-0] 1 failing (61ms)
[chrome 114.0.5735.133 linux #0-0]
[chrome 114.0.5735.133 linux #0-0] 1) expect utility should provide the custom matcher
[chrome 114.0.5735.133 linux #0-0] Expected undefined to be defined.
### Code of Conduct
- [X] I agree to follow this project's Code of Conduct
### Is there an existing issue for this?
- [X] I have searched the existing issues