Skip to content

Commit 4e70c63

Browse files
MarcLkodiakhq[bot]
andauthored
docs: add testing documentation (#1839)
* docs: add test documentation * docs: update with PR changes * fix: add missing newline --------- Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
1 parent 5b54b0b commit 4e70c63

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

README.md

+38
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,44 @@ If your site uses pnpm to manage dependencies, currently you must
174174
public-hoist-pattern[]=*
175175
```
176176

177+
## Running the tests
178+
179+
To run the tests, ensure that the dependencies are installed as follows:
180+
181+
```shell
182+
npm install
183+
```
184+
185+
Then run the tests:
186+
187+
```shell
188+
npm test
189+
```
190+
191+
### End-to-end tests
192+
193+
In order to run the end-to-end (E2E) tests, you'll need to be logged in to Netlify. You can do this using the [Netlify CLI](https://github.com/netlify/cli) with the command:
194+
195+
```shell
196+
netlify login
197+
```
198+
199+
Alternatively, you can set an environment variable `NETLIFY_AUTH_TOKEN` to a valid Netlify personal access token. This can be obtained from the [Netlify UI](https://docs.netlify.com/cli/get-started/#obtain-a-token-in-the-netlify-ui).
200+
201+
Then run the E2E tests if logged in:
202+
203+
```shell
204+
npm run test:next
205+
```
206+
207+
Or if using an access token:
208+
209+
```shell
210+
NETLIFY_AUTH_TOKEN=your-token-here npm run test:next
211+
```
212+
213+
_Note: The E2E tests will be deployed to a Netlify owned site. To deploy to your own site then set the environment variable `NETLIFY_SITE_ID` to your site ID._
214+
177215
## Feedback
178216

179217
If you think you have found a bug in Next.js on Netlify,

0 commit comments

Comments
 (0)