Skip to content
This repository has been archived by the owner on Aug 26, 2022. It is now read-only.

Add Testing doc #186

Closed
wants to merge 5 commits into from
Closed

Add Testing doc #186

wants to merge 5 commits into from

Conversation

jtoar
Copy link
Contributor

@jtoar jtoar commented Jun 11, 2020

Link to new Testing doc

This PR adds a Testing doc. There's going to be a lot of additions to testing, namely configuring jest, e2e and out-of-the-box ci, but right now this doc aims to cover the basics of how you'd test a Redwood app's api and web side.

  • aspirational intro
  • detail api side generally
  • detail web side generally
  • mini-tutorial on mock service worker (and how we wrap graphql)
  • point out that imports are being handled automatically

@thedavidprice
Copy link
Contributor

This is a good start and covers 80% of what I had in my notes from our conversation. Thanks for getting the ball rolling!

Intro

Let's start with something more aspirational and with an example. Maybe grab some language from the initial comment in redwoodjs/redwood#181

Effectively, Jest tests in RW are first-class citizens, built into the CLI, templates with your generated code, and (soon) a GH Action for CI you can add. Out of the box you generate code, run yarn rw test, and have CI. Boom!

Imports: routes, svg, etc.

From this PR redwoodjs/redwood#521

We should point out that these imports are being automatically handled by the testing package.

package exports

To confirm: all the package exports (for importing) are covered in the doc from https://github.com/redwoodjs/redwood/blob/master/packages/testing/src/index.js

Looks like Robert is already working on the MSW using workers to mock the server for API (seems very cool).

@apollo/react-testing

From the conversation in redwoodjs/redwood#629 I assumed this was already in the package. But maybe the MSW package is going to replace it? Will need to check back with Robert.

Jest Config

Here's the Issue for what's to be (aka Vision): redwoodjs/redwood#564

And here's where the current config files are for web and api: https://github.com/redwoodjs/redwood/tree/master/packages/core/config

Technically someone could copy these config options within there app and extend them manually using a script. Not sure if we need to explain how to do that, but that's why I thought it important to include them.

Misc

I added the state of template test for generators to the "To Do" column on this project: https://github.com/redwoodjs/redwood/projects/4

Added "next steps for Test docs" list to "To Do": https://github.com/orgs/redwoodjs/projects/2

@cannikin cannikin changed the base branch from master to main June 19, 2020 17:23
@jtoar jtoar added the documentation Improvements or additions to documentation label Jun 23, 2020
@thedavidprice
Copy link
Contributor

Robert has completed the work on the Jest Config extension capability. Here's his comment from the related Issue:
https://github.com/redwoodjs/redwoodjs.com/issues/162#issuecomment-659220737

Dominic added 2 commits July 29, 2020 15:41
@guledali
Copy link
Contributor

@jtoar @thedavidprice When is this going to get merged?

@jtoar
Copy link
Contributor Author

jtoar commented Aug 25, 2020

@guledali This week, hold me to it

@guledali
Copy link
Contributor

guledali commented Sep 10, 2020

@jtoar Patiently waiting for the testing docs

@thedavidprice
Copy link
Contributor

See redwoodjs/redwood#1620 regarding making Test DB env var usage explicit (depending on how the PR resolves).

@cannikin
Copy link
Member

What's the best way to add onto this doc? Should I make PRs against your branch @jtoar? Although yours is like 600 commits out of date with the main branch. 😬 Should I make my own branch in this repo and make my first commit your existing doc, then work from there?

@thedavidprice
Copy link
Contributor

I was assuming you'd start fresh and use this for reference @cannikin fwiw...

Thanks for getting it going again!

@cannikin
Copy link
Member

Roger that. Okay, any objections to closing this PR and opening a new one with the doc I'm writing? Sorry @jtoar!

@cannikin
Copy link
Member

Already at 2000 words and I haven't actually done any testing in Redwood yet. 😬

@cannikin
Copy link
Member

Opened #530

@cannikin
Copy link
Member

Closing, thanks @jtoar!

@cannikin cannikin closed this Jan 27, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants