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

Setup tests #63

Merged
merged 23 commits into from May 20, 2022
Merged

Setup tests #63

merged 23 commits into from May 20, 2022

Conversation

slargman
Copy link
Contributor

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.

  • Testing environment
    • This covers the jest installation changes in package.json, the jest configuration in jest.config.js
  • Continuous integration
    • This will allow GitHub to automatically run our tests on a pull request and prevent merging if tests are failing. However, since we are all admins if this becomes annoying we can always force a merge regardless of any missing requirements such as failing tests or a missing code review.
    • .github/workflows/test.yml contains the script that GitHub will use for CI
  • Project scaffolding
    • I wanted to set this up to make sure that our tests were working correctly. It also shows the test file structure we can choose to use: a Component.test.js file right next to Component.jsx. Jest automatically finds all these files when we run npm test. We can also set up jest in our script with the --watch flag to keep testing running in the background.
    • For end to end tests and integration test we might want to create a tests directory to contain these later
    • Added some linebreaks to index.html
    • I created aliases for our paths in webpack.config.js. This means that instead of doing something like
    import App from '../../App/App.jsx';
    
    we can just do
    import App from 'App/App.jx';
    
    Aliases are set up for all the main component directories.
  • .gitginore
    • I added some changes here as well
    • The main thing is we should not be tracking compiled files in our client/dist directory (i.e. main.js).
    • I also added the coverage directory. When you run npm test you will notice a new coverage 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.

@slargman slargman requested a review from zman811 May 20, 2022 17:02
@slargman slargman added this to In progress in Serum board via automation May 20, 2022
@slargman slargman added this to the Sprint 1 milestone May 20, 2022
@slargman slargman linked an issue May 20, 2022 that may be closed by this pull request
3 tasks
Copy link
Contributor

@zman811 zman811 left a 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?

@slargman
Copy link
Contributor Author

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.

According to the docs, package-lock.json is intended to be committed into source control to provide deterministic installs.

Copy link
Contributor

@zman811 zman811 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sweet! sounds good

Serum board automation moved this from In progress to Ready for production deploy May 20, 2022
@slargman
Copy link
Contributor Author

I just checked and it seems like react-testing-library is installed.

@slargman
Copy link
Contributor Author

Or at least installing it produced to changes in my repo.

@slargman slargman merged commit ce4e497 into main May 20, 2022
Serum board automation moved this from Ready for production deploy to Deployed to production May 20, 2022
@slargman slargman deleted the setup-tests branch May 20, 2022 17:54
@slargman
Copy link
Contributor Author

@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.

@rlargman
Copy link
Collaborator

Seems pretty standard 👍🏻

@slargman
Copy link
Contributor Author

🧘

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Serum board
Deployed to production
Development

Successfully merging this pull request may close these issues.

Setup testing
3 participants