Skip to content
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

feat: MockBuilder #91

Merged
merged 1 commit into from
Mar 28, 2020
Merged

feat: MockBuilder #91

merged 1 commit into from
Mar 28, 2020

Conversation

satanTime
Copy link
Member

@satanTime satanTime commented Feb 29, 2020

A MockBuilder to facilitate a creation of a NgModule for the TestBed.

  • Rebase after feat: Base class for directives and components #86.
  • Rebase after feat: Mocking service #88.
  • Add a module replacement.
  • Add a component replacement.
  • Add a directive replacement.
  • Add a pipe replacement.
  • Add a config for modules to keep it as a dependency (no import to test bed).
  • Add a config for components to keep it as a dependency (no import to test bed).
  • Add a config for directives to keep it as a dependency (no import to test bed).
  • Add a config for pipes to keep it as a dependency (no import to test bed).
  • Add a config for the structural directives render rules.
  • Add a config for the contentChild render rules.
  • Check how 2 kept modules import another kept module with a mocked component.
  • Add and check support of an internal vs external module (proper exports).
  • Write a proper readme text.
  • Cover a case when a module is exported but wasn't imported.
  • Check provider deps for the replacement.

How to use can be found in its readme: https://github.com/satanTime/ng-mocks/tree/issues/44#mockbuilder

Closes #44
Closes #60
Closes #70

@satanTime satanTime linked an issue Feb 29, 2020 that may be closed by this pull request
@satanTime satanTime force-pushed the issues/44 branch 27 times, most recently from 4b21087 to ed8da78 Compare March 5, 2020 21:24
@satanTime
Copy link
Member Author

satanTime commented Mar 11, 2020

Hi @getsaf, I'm sorry, but can't find your comment neither here nor in the original issue, could you give me its link?
All reviews are welcome.

Sorry about the notifications, I use the amend option and seems it produces too much noise.

@satanTime
Copy link
Member Author

Hi @getsaf, please check the new approach without promises: https://github.com/satanTime/ng-mocks/blob/issues/44/README.md#mockbuilder.
it should be flexible now.

@satanTime
Copy link
Member Author

The idea with beforeEach for the cache reset, unfortunately, doesn't work in cases when we have beforeAll, but the good news is that MockBuilder works right and we can access mocks via NG_MOCKS even another beforeEach was called.

@satanTime satanTime force-pushed the issues/44 branch 2 times, most recently from a4e9457 to 7c808ec Compare March 20, 2020 17:47
@ike18t
Copy link
Collaborator

ike18t commented Mar 21, 2020

This PR is rather massive and rather extensive. Due to its weight and broad scope I think having this remain on a beta branch with beta release may be the safest approach. I've been keeping the lib version number in sync with verified angular version, so keeping that trend If all goes well we can have this release when we go v10.

As far as review, I definitely want @getsaf 's input since he has already done this before so he has a good amount of context when it comes to module building plus we need to make sure we don't implement anything that breaks shallow-render.

I'll go ahead and create the beta branch I don't know if there is a way to redirect your PR, my guess is not, so you may have to reopen.

@satanTime
Copy link
Member Author

Agree, I'll update to against beta branch.

@satanTime satanTime changed the base branch from master to beta March 21, 2020 08:27
@satanTime
Copy link
Member Author

satanTime commented Mar 21, 2020

Done, now it goes to beta.
If you don't mind would be great to have a beta package on npm so I could test it on my projects without pain of injecting a custom build into them.

Let me update the PR. I think I found a way how to avoid the breaking changes.

@satanTime
Copy link
Member Author

satanTime commented Mar 21, 2020

Done. Now there are no breaking changes.

@satanTime satanTime force-pushed the issues/44 branch 5 times, most recently from a4b2514 to 4160b8e Compare March 22, 2020 09:28
@ike18t
Copy link
Collaborator

ike18t commented Mar 28, 2020

@satanTime I merged another of your PRs into master and updated the beta branch. Was going to merge this into beta and do a beta release but there is a merge conflict. If you can fix the conflict I'll merge this and do the prerelease.

@satanTime
Copy link
Member Author

@ike18t, sure, working on it.

@satanTime
Copy link
Member Author

@ike18t, done.

@ike18t ike18t merged commit aa13d7f into help-me-mom:beta Mar 28, 2020
@ike18t
Copy link
Collaborator

ike18t commented Mar 28, 2020

version 10.0.0-alpha.0 released

@satanTime satanTime deleted the issues/44 branch May 23, 2020 10:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants