Commit Graph

5 Commits

Author SHA1 Message Date
Ben Kraft b1adeca6da Automatically update generated files if UPDATE_SNAPSHOTS=1 (#243)
If you do `UPDATE_SNAPSHOTS=1 go test ./...` that will:
1. run the snapshot tests, updating any changed snapshots
2. run the integration tests and (if you have tokens) example tests
3. check that the code for the integration tests and example tests is
up-to-date

Step 3 is not strictly a snapshot test; the generated code is actually
checked in and used. But, I mean, it's basically the same! So now, we
also update it if you asked to update snapshots, which is hopefully a
little more convenient.

Fixes #212.

Test plan:
Make a trivial change to `example/generated.go`; `go test ./...` should
now fail. `UPDATE_SNAPSHOTS=1 go test ./...` should also fail, but say
it updated the snapshot, and the change should be reverted. Run `go test
./...` again; it should pass again.
2022-12-21 23:19:20 -08:00
Ben Kraft 046f531314 Add more information about updating snapshots (#211)
The generated files for integration tests aren't strictly snapshots and so
`UPDATE_SNAPSHOTS=1` won't work (maybe we should make it work?).
Instead you also need to `go generate ./...`. This came up in #209.
2022-07-28 16:31:55 -07:00
Ben Kraft 03b6b6b5d1 Mention how to update the snapshot tests (#210)
Frequent contributors and those adding significant new functionality
will want to read all the comments in `generate_test.go`, but people
making a small fix just want to update the snapshots. So it makes
sense to put the formula for doing so directly in the contributor docs.
2022-07-28 12:52:16 -07:00
Ben Kraft 1d6e728181 Add open-source boilerplate (#96)
## Summary:
There's a lot these days!  I got most of it from the GitHub docs [1], as
well as looking at other projects.  I'll probably hold off on landing
this until a couple more things land, then land this and tag v0.1.0.

[1] https://docs.github.com/en/communities

Issue: https://github.com/Khan/genqlient/issues/35

## Test plan: view in github UI


Author: benjaminjkraft

Reviewers: jvoll, StevenACoffman, aberkan, dnerdy, mahtabsabet, MiguelCastillo

Required Reviewers: 

Approved By: jvoll, StevenACoffman

Checks:  Test (1.17),  Test (1.16),  Test (1.15),  Test (1.14),  Lint,  Test (1.17),  Test (1.16),  Test (1.15),  Test (1.14),  Lint

Pull Request URL: https://github.com/Khan/genqlient/pull/96
2021-09-16 12:05:16 -07:00
Ben Kraft 2eba9a2c30 Reorganize documentation to make room to grow (#84)
## Summary:
In this commit I reorganize much of our documentation into a new `docs`
directory, where there will hopefully be more room to grow and to
organize things in a user-friendly way.  There's almost no net-new
documentation, although of course it's a great time to review it anyway.

In particular:
- I moved the documentation for the `genqlient.yaml` config file into an
  example file instead of GoDoc (which now just points to the example
  file); I think this will be a lot clearer for casual users.
- I moved the documentation for the `@genqlient` directive out of GoDoc
  and into a GraphQL schema file (since while it's a comment it's all
  real syntax), likewise, and made the `GenqlientDirective` type private
  (since there's now nothing useful to do with it).
- I moved `DESIGN.md` and the logo into `docs/` (just to keep the
  toplevel a bit cleaner), and separated the Contributing section of the
  README into `docs/CONTRIBUTING.md` (which github will automatically
  link on various issue and PR pages).

This leaves it so that:
- README.md is the only documentation at the toplevel (and will become
  just the high-level introduction as I add more user docs to `docs/`)
- GoDoc is only documentation for if you want to call genqlient
  programmatically (which is fairly limited as the API surface is quite
  small: it's now just Main, Generate, and Config, plus a constructor, a
  single method, and a bunch of fields on the latter)

In future commits, I'll add some more new documentation to the `docs`
directory.

Issue: https://github.com/Khan/genqlient/issues/26

## Test plan:
make check (and read the docs)


Author: benjaminjkraft

Reviewers: jvoll, benjaminjkraft, aberkan, dnerdy, MiguelCastillo, mahtabsabet

Required Reviewers: 

Approved By: jvoll

Checks:  Lint,  Test (1.17),  Test (1.16),  Test (1.15),  Test (1.14),  Test (1.17),  Test (1.16),  Test (1.15),  Test (1.14),  Lint

Pull Request URL: https://github.com/Khan/genqlient/pull/84
2021-09-10 16:03:30 -07:00