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

Example code should contain mock samples #195

Open
ezyang opened this issue Oct 29, 2019 · 3 comments
Open

Example code should contain mock samples #195

ezyang opened this issue Oct 29, 2019 · 3 comments
Assignees
Labels
documentation enhancement New feature or request

Comments

@ezyang
Copy link

ezyang commented Oct 29, 2019

There appears to be mocking documentation in https://github.com/actions/toolkit/blob/master/docs/github-package.md but the example code that you can use to bootstrap an action should also contain this code, or at the very least, link to this documentation.

@ezyang ezyang added the bug Something isn't working label Oct 29, 2019
@bryanmacfarlane bryanmacfarlane added enhancement New feature or request and removed bug Something isn't working labels Nov 13, 2019
@bryanmacfarlane bryanmacfarlane self-assigned this Nov 13, 2019
@ericsciple
Copy link
Contributor

note, lots of mocking examples in https://github.com/actions/checkout/tree/v2/__test__

@rbellamy
Copy link

rbellamy commented Apr 4, 2020

That code you link to has helped me quite a bit. Where I'm struggling is in how to mock THIS library in such a way that I can control stdout. For instance, how do I inject strings into stdout so that I don't have to actually execute something in order to test the code that expects that output?

@bryanmacfarlane
Copy link
Member

setup-go has more mocking examples including output. https://github.com/actions/setup-go/blob/master/__tests__/setup-go.test.ts#L62

I'm going to write up a doc with examples soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants