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
Setup tests #63
Setup tests #63
Conversation
This change addresses the following error when trying to run jest: ● Test suite failed to run Jest encountered an unexpected token Jest failed to parse a file. This happens e.g. when your code or its dependencies use non-standard JavaScript syntax, or when Jest is not configured to support such syntax. Details: ({"Object.<anonymous>":function(module, exports, require, __dirname, __filename, jest){ import { useState } from 'react';
Might result in faster CI test results since GitHub provides two cores on virtual runners per: https://bharathvaj.me/blog/speedup-jest-github-actions https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! really like the webpack alias to make it much easier to write.
Just a few questions I had, Did you add in the react testing library to test the page or will we do that later?
Also is there a reason to not git ignore package-lock.json?
Thank you for taking a look Zach. I don't think I added react testing library. It would just be an npm install later once we're writing tests. We would probably want to use it though since it provides helpers for our tests. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sweet! sounds good
I just checked and it seems like |
Or at least installing it produced to changes in my repo. |
@rlargman Don't know if you wanted to take a look at this just to get an idea of how we're laying out the app. There's no real code that's been committed yet, just a lot of infrastructure setup. |
Seems pretty standard 👍🏻 |
🧘 |
This pull request covers a lot of files, but what it aims to accomplish is to set up our testing environment, set up continuous integration, and layout the scaffolding for our project.
package.json
, the jest configuration injest.config.js
.github/workflows/test.yml
contains the script that GitHub will use for CIComponent.test.js
file right next toComponent.jsx
. Jest automatically finds all these files when we runnpm test
. We can also set up jest in our script with the--watch
flag to keep testing running in the background.tests
directory to contain these laterindex.html
webpack.config.js
. This means that instead of doing something likeclient/dist
directory (i.e.main.js
).coverage
directory. When you runnpm test
you will notice a newcoverage
directory which contains the coverage report from jest. This is an option I have enabled. We can turn off coverage reports if they're not wanted.