Skip to content

fix references to support objects when using DI #1701

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 7, 2019

Conversation

johnyb
Copy link
Contributor

@johnyb johnyb commented Jun 6, 2019

some change to how the support objects are initialized removed the original
reference to the support object and replaced it a "cloned" object. However,
since Object.assign was used, not all properties have been copied and especially
the original reference was lost.

This implementation uses a proxy object to load the injected modules on demand
and returns the original reference to the module. This should fix all usages
of support objects, where the type is not a plain object.

Fixes: #1679

@DavertMik
Copy link
Contributor

Thank you! I also wanted to use Proxy for that but was not so smart to implement in a correct way

@johnyb
Copy link
Contributor Author

johnyb commented Jun 6, 2019

Concerning the broken tests for webdriver, this seems to be due to an upgrade to latest chrome in the selenium standalone images. Therefor I currently have the docker images fixed to selenium/standalone-chrome:3.141.59-oxygen, where I.doubleClick is still working for instance. So I guess this has nothing to do with the change of this PR.

@DavertMik
Copy link
Contributor

Sure, it's nothing to do with this PR.

If you know how to fix the builds, could you please update .travis.yml and send a patch?
Much appreciated

some change to how the support objects are initialized removed the original
reference to the support object and replaced it a "cloned" object. However,
since Object.assign was used, not all properties have been copied and especially
the original reference was lost.

This implementation uses a proxy object to load the injected modules on demand
and returns the original reference to the module. This should fix all usages
of support objects, where the type is not a plain object.
@johnyb johnyb force-pushed the fix_di_references branch from ed861ba to 3fab75a Compare July 3, 2019 11:38
@DavertMik
Copy link
Contributor

The day has come. I'm merging!

@DavertMik
Copy link
Contributor

@johnyb your implementation broke recursive loading of support objects. Proxy was good but still, we need to initialize objects and then use Object.assign. In a new implementation https://github.com/Codeception/CodeceptJS/blob/codecept-221-release/lib/container.js#L213

@johnyb
Copy link
Contributor Author

johnyb commented Jul 28, 2019

Very good, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

support object API changed with 2.1.3 release
2 participants