Skip to content
This repository has been archived by the owner on Apr 3, 2024. It is now read-only.

Testing with Jest #41

Closed
ricokahler opened this issue Feb 5, 2020 · 1 comment
Closed

Testing with Jest #41

ricokahler opened this issue Feb 5, 2020 · 1 comment

Comments

@ricokahler
Copy link
Collaborator

Per our discussion here: #39 (comment)

We wanted to add tests with jest. I wanted to open this issue to track how we'll do that.

Here's a few questions:

Testing conventions

What conventions do you prefer?

  1. it('blah', () => {}) or test('blah', () => {})?
  2. do you want omit top-level describe or prefer to keep it?
  3. file.spec.ts or file.test.ts?
  4. What folder structure do you prefer? separate or inline?

Separate: a tests folder next to src at the root or

/gatsby-plugin-graphql-codegen
|-/src
  |-gatsby-node.ts
|-/tests
  |-gatsby-node.test.ts

Inline: a test file in the same src folder?

/gatsby-plugin-graphql-codegen
|-/src
  |-gatsby-node.ts
  |-gatsby-node.test.ts

I prefer inline test files because it makes me care more about the tests but I don't mind either convention.

CI and Coverage Reporting

Do you have any preference for tools? I've only really used travis and coveralls but idk maybe those tools are out of style? I can defer to you to set that up but it we're testing we might as well talk about CI and coverage reporting

@d4rekanguok
Copy link
Owner

d4rekanguok commented Feb 5, 2020

Thanks @ricokahler, I don't mind any of these so please take the lead.

Most of the code in this repo is 'glue code', so I think end-to-end tests are more important, but I don't know how to write those kind of tests yet. Would it be a good idea to boot up a Gatsby site, then use Jest to compare the output snapshot does that make sense)?

I have had good experience with travis in the past!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants