Main entry should not load global expect typing#1496
Main entry should not load global expect typing#1496christian-bromann merged 1 commit intowebdriverio:mainfrom
expect typing#1496Conversation
77b0968 to
1a7f734
Compare
|
Note that we need to merge webdriverio/webdriverio#12499 first |
|
Note that this is technically a breaking change since some dependents might be relying on this type. However, I would consider this is more like bug fix since this does not align with the runtime behavior. Also, it should be easy to notice and fix in dependents just by adding global |
|
For the compatibility with the main webdriverio packages, It would be nice if we can make sure that webdriverio package older before webdriverio/webdriverio#12502 will never use the new version of expect-webdriverio. However, this means we should bump the major version of expect-webdriverio, which is too much for this small change IMHO |
|
Last time we did this, things broke when running the Jasmine framework. I think this needs some testing with both Mocha and Jasmine to verify both work as expected |
|
@erwinheitzman I think they broke probably because we did not have webdriverio/webdriverio#12499 We can merge and publish webdriverio/webdriverio#12499 and webdriverio/webdriverio#12502 first |
1a7f734 to
e87dba7
Compare
e87dba7 to
e451bc9
Compare
|
I just confirmed that both Jasmine tests and Mocha tests do not break with the change in this PR and webdriverio/webdriverio#12499 using https://github.com/naruaway-sandbox/webdriverio-test-repros While testing, I realized that we should also update the top-level |
Merged them. I will release v8 as soon as possible. I don't think we would expect any breaking changes from that. @naruaway can you think of any potential issues that might come up for people that update their packages? |
|
@christian-bromann Thanks!
I believe there is no potential issue for people using My reasoning is based on webdriverio/webdriverio#12499 (comment). In short, it just adds additional global declaration which will conflict with the current version of |
|
I will cut a release today of v8 and this package as |
|
Hi @christian-bromann, if you are going to bump version for packages, probably it's better to bump minor |
|
Thanks for confirming! |


Fixes #1492
Loading
jest-global.d.tsin the TypeScript compilation makesexpectglobal symbol available in type level.Currently, just importing
"expect-webdriverio"loadsjest-global.d.ts. However, importing"expect-webdriverio"does not actually loadexpectin the runtime global scope.Because of this mismatch, when using
"expect-webdriverio"as standalone npm package likeimport {expect as myExpect} from "expect-webdriverio", TypeScript cannot emit error for the following broken script:Note that I initially tried removing
ExpectWebdriverIOnamespace completely by simply relying on TypeScript modules (tsconfig.json withdeclaration:true) but I just realized that will be unacceptable breaking change so I kept the diff minimum.Verification
I built 1a7f734 locally (
npm pack) and tested with small project and confirmed that now globalexpectsymbol properly causes type error while other typing are kept: