The following contains the steps required to get the application up and running on your local workspace.
- Node v18.17.0
- yarn v1.22.19
- Git v2.39.2
To run the app locally, follow the steps below:
-
Clone the repository to your PC using your terminal. For more info, refer to this article.
-
After cloning, navigate into the repo using the command:
cd connect4
-
Install the dependencies in the package.json using the command:
yarn install
-
After the dependencies have been installed successfully, create a .env file at the root. Take a look at the env.sample file and configure your environment variables with your values in the .env file.
-
After adding the environment variables, run the app in your terminal using the command:
yarn start
NOTE: All test files should have a .test.ts
or .test.tsx
file extension.
All tests for a component or utility function should be placed in a __tests__
folder relative to the folder it resides in.
For example, if you had a Header.tsx
file located in src/components/Header
, and your tests are in a header.test.tsx
file, do the following:
-
Create a
__tests__
folder in thesrc/components/Header
folder -
Move the
header.test.tsx
file to the__tests__
folder
The file structure would look similar to this:
.
├── src
│ └── components
| └── Header
│ ├── Header.tsx
│ └── __tests__
│ └── header.test.tsx
To run tests, run the following command:
yarn test
-
pre-commit: Automatically formats the codebase using Prettier every time a git commit is made.
-
pre-push: Runs the unit tests when pushing to the remote repository.