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): jest/vitest like API mocking #255

Merged
merged 59 commits into from
Dec 2, 2023
Merged

(feat): jest/vitest like API mocking #255

merged 59 commits into from
Dec 2, 2023

Conversation

christian-bromann
Copy link
Contributor

@christian-bromann christian-bromann commented Nov 1, 2023

This implements suggestion 2 from #252

TODO:

  • Remove existing API access
  • Update type documentation
  • Update README

@christian-bromann christian-bromann added the WIP Work in progress label Nov 1, 2023
@goosewobbler
Copy link
Member

You may be able to fix the CI error by moving the .npmrc from example-cjs into the root...

Base automatically changed from cb/electron-execute to main November 1, 2023 14:13
Copy link
Member

@goosewobbler goosewobbler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, tests and types need to be improved, I'll make some changes in #269

src/thirdParty/spy.ts Outdated Show resolved Hide resolved
@goosewobbler
Copy link
Member

You may be able to fix the CI error by moving the .npmrc from example-cjs into the root...

This worked.

@goosewobbler
Copy link
Member

Targetting a major release for this because the mocking interface has now changed completely. Removing the existing API access code will also improve unit coverage as some parts of it were not covered.

@goosewobbler goosewobbler added this to the 6.0.0 milestone Nov 30, 2023
Copy link
Contributor Author

@christian-bromann christian-bromann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks all great, nice work 👌

Let's update the mocking docs and emphasize the importance of using update to get the latest mock data.

I am wondering if there is any way we can auto-update it, e.g. fetch mock updates in the afterCommand hook to ensure that hooks are up to date after an interaction with the app. Anyway that should not block this PR to get merged. We could also think about calling update in our expect lib but that would couple these two packages which is not ideal.

@goosewobbler
Copy link
Member

goosewobbler commented Nov 30, 2023

Makes sense, created #311 for this work. I'll update the docs tomorrow which should enable a release.

@christian-bromann
Copy link
Contributor Author

@goosewobbler PR looks good, are we adding the two remaining todos to it?

@goosewobbler
Copy link
Member

Yeah, just doing them now...

@goosewobbler goosewobbler removed the WIP Work in progress label Dec 1, 2023
@goosewobbler goosewobbler merged commit 8d7a478 into main Dec 2, 2023
4 checks passed
@goosewobbler goosewobbler deleted the cb/better-mock branch December 2, 2023 13:04
@christian-bromann
Copy link
Contributor Author

Awesome work @goosewobbler 🎉 Thanks a lot!

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.

2 participants