You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: CONTRIBUTING.md
+41-22
Original file line number
Diff line number
Diff line change
@@ -87,47 +87,66 @@ The process of proposing a change to Talawa Admin can be summarized as:
87
87
1.**_General_:**
88
88
1. We need to get to 100% test coverage for the app. We periodically increase the desired test coverage for our pull requests to meet this goal.
89
89
1. Pull requests that don't meet the minimum test coverage levels will not be accepted. This may mean that you will have to create tests for code you did not write. You can decide which part of the code base needs additional tests if this happens to you.
90
-
1.**_Testing_:**
90
+
91
+
2.**_Testing_:**
92
+
91
93
1. Test using this set of commands:
92
-
```
94
+
95
+
```
96
+
npm install --legacy-peer-deps
97
+
npm run test --watchAll=false --coverage
98
+
```
99
+
100
+
2. Debug tests in browser
101
+
102
+
You can see the output of failing tests in broswer by running `jest-preview` package before running your tests
103
+
104
+
```
93
105
npm install --legacy-peer-deps
106
+
npm run jest-preview
94
107
npm run test --watchAll=false --coverage
95
-
```
96
-
1. **_Test Code Coverage_:**
108
+
```
109
+
110
+
You don't need to re-run the `npm run jest-preview` command each time, simply run the `npm run test` command if the Jest Preview server is already running in the background, it'll automatically detect any failing tests and show the preview at `http://localhost:3336` as shown in this screenshot -
111
+
112
+

113
+
114
+
115
+
3. **_Test Code Coverage_:**
97
116
1. _General Information_
98
117
1. The current code coverage of the repo is: [](https://codecov.io/gh/PalisadoesFoundation/talawa-admin)
99
-
1. You can determine the percentage test coverage of your code by running these two commands in sequence:
118
+
2. You can determine the percentage test coverage of your code by running these two commands in sequence:
100
119
```
101
120
npm install --legacy-peer-deps
102
121
npm run test --watchAll=false --coverage
103
122
genhtml coverage/lcov.info -o coverage
104
123
```
105
-
1. The output of the `npm run test` command will give you a tablular coverage report per file
106
-
1. The overall coverage rate will be visible on the penultimate line of the `genhtml` command's output.
107
-
1. The `genhtml` command is part of the Linux `lcov` package. Similar packages can be found for Windows and MacOS.
108
-
1. The currently acceptable coverage rate can be found in the [GitHub Pull Request file](.github/workflows/pull-requests.yml). Search for the value below the line containing `min_coverage`.
109
-
1. _Testing Individual Files_
124
+
3. The output of the `npm run test` command will give you a tablular coverage report per file
125
+
4. The overall coverage rate will be visible on the penultimate line of the `genhtml` command's output.
126
+
5. The `genhtml` command is part of the Linux `lcov` package. Similar packages can be found for Windows and MacOS.
127
+
6. The currently acceptable coverage rate can be found in the [GitHub Pull Request file](.github/workflows/pull-requests.yml). Search for the value below the line containing `min_coverage`.
128
+
2. _Testing Individual Files_
110
129
1. You can test an individual file by running this command:
111
130
```
112
131
npm run test --watchAll=false /path/to/test/file
113
132
```
114
-
1. You can get the test coverage report for that file by running this command. The report will list all tests in the suite. Those tests that are not run will have zero values. You will need to look for the output line relevant to your test file.
133
+
2. You can get the test coverage report for that file by running this command. The report will list all tests in the suite. Those tests that are not run will have zero values. You will need to look for the output line relevant to your test file.
115
134
```
116
135
npm run test --watchAll=false --coverage /path/to/test/file
117
136
```
118
-
1. _Creating your code coverage account_
137
+
3. _Creating your code coverage account_
119
138
1. You can also see your code coverage online for your fork of the repo. This is provided by `codecov.io`
120
139
1. Go to this link: `https://app.codecov.io/gh/XXXX/YYYY` where XXXX is your GitHub account username and YYYY is the name of the repository
121
-
1. Login to `codecov.io` using your GitHub account, and add your **repo** and **branches** to the `codecov.io` dashboard.
122
-
1. Remember to add the `Repository Upload Token` for your forked repo. This can be found under `Settings` of your `codecov.io` account.
123
-
1. Use the value of this token to create a secret named CODE_COV for your forked repo.
124
-
1. You will see your code coverage reports with every push to your repo after following these steps
125
-
1. After making changes you can add them to git locally using `git add <file_name>`(to add changes only in a particular file) or `git add .` (to add all changes).
126
-
1. After adding the changes you need to commit them using `git commit -m '<commit message>'`(look at the commit guidelines below for commit messages).
127
-
1. Once you have successfully commited your changes, you need to push the changes to the forked repo on github using: `git push origin <branch_name>`.(Here branch name must be name of the branch you want to push the changes to.)
128
-
1. Now create a pull request to the Talawa-admin repository from your forked repo. Open an issue regarding the same and link your PR to it.
129
-
1. Ensure the test suite passes, either locally or on CI once a PR has been created.
130
-
1. Review and address comments on your pull request if requested.
140
+
2. Login to `codecov.io` using your GitHub account, and add your **repo** and **branches** to the `codecov.io` dashboard.
141
+
3. Remember to add the `Repository Upload Token` for your forked repo. This can be found under `Settings` of your `codecov.io` account.
142
+
4. Use the value of this token to create a secret named CODE_COV for your forked repo.
143
+
5. You will see your code coverage reports with every push to your repo after following these steps
144
+
2. After making changes you can add them to git locally using `git add <file_name>`(to add changes only in a particular file) or `git add .` (to add all changes).
145
+
3. After adding the changes you need to commit them using `git commit -m '<commit message>'`(look at the commit guidelines below for commit messages).
146
+
4. Once you have successfully commited your changes, you need to push the changes to the forked repo on github using: `git push origin <branch_name>`.(Here branch name must be name of the branch you want to push the changes to.)
147
+
5. Now create a pull request to the Talawa-admin repository from your forked repo. Open an issue regarding the same and link your PR to it.
148
+
6. Ensure the test suite passes, either locally or on CI once a PR has been created.
149
+
7. Review and address comments on your pull request if requested.
Copy file name to clipboardexpand all lines: INSTALLATION.md
+16-1
Original file line number
Diff line number
Diff line change
@@ -23,6 +23,7 @@ This document provides instructions on how to set up and start a running instanc
23
23
-[Talawa-Admin Login](#talawa-admin-login)
24
24
-[Testing](#testing)
25
25
-[Running tests](#running-tests)
26
+
-[Debugging tests](#debugging-tests)
26
27
-[Linting code files](#linting-code-files)
27
28
-[Husky for Git Hooks](#husky-for-git-hooks)
28
29
-[pre-commit hook](#pre-commit-hook)
@@ -116,7 +117,7 @@ If you want to setup Google reCAPTCHA now, you may refer to to the `RECAPTCHA` s
116
117
117
118
`Talawa-admin` needs the `reCAPTCHA site key` for the `reCAPTCHA` service you set up during `talawa-api` installation as shown in this screenshot:
118
119
119
-

120
+

120
121
121
122
Copy/paste this `reCAPTCHA site key` to the variable named `REACT_APP_RECAPTCHA_SITE_KEY` in `.env` file.
122
123
@@ -163,6 +164,20 @@ You can run the tests for `talawa-admin` using this command:
163
164
npm run test
164
165
```
165
166
167
+
## Debugging tests
168
+
169
+
You can see the output of failing tests in broswer by running `jest-preview` package before running your tests
170
+
171
+
```
172
+
npm run jest-preview
173
+
npm run test
174
+
```
175
+
176
+
You don't need to re-run the `npm run jest-preview` command each time, simply run the `npm run test` command if the Jest Preview server is already running in the background, it'll automatically detect any failing tests and show the preview at `http://localhost:3336` as shown in this screenshot -
177
+
178
+

0 commit comments