Skip to content

docs: add testing documentation #1839

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

Merged
merged 4 commits into from
May 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,44 @@ If your site uses pnpm to manage dependencies, currently you must
public-hoist-pattern[]=*
```

## Running the tests

To run the tests, ensure that the dependencies are installed as follows:

```shell
npm install
```

Then run the tests:

```shell
npm test
```

### End-to-end tests

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:

```shell
netlify login
```

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

Then run the E2E tests if logged in:

```shell
npm run test:next
```

Or if using an access token:

```shell
NETLIFY_AUTH_TOKEN=your-token-here npm run test:next
```

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

## Feedback

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