chore (#33): adds testing docs and toc to readme

This commit is contained in:
Tara Z. Manicsic 2022-06-16 13:50:56 -04:00 committed by GitHub
commit cee7b11afd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,6 +3,30 @@
This is a [NuxtJS](https://nuxtjs.org/) v2 project. It is a reference on how to integrate commonly used features within Netlify for Nuxt.js.
## Table of Contents:
- [Build Setup](#build-setup)
- [Deploy to Netlify](#deploy-to-netlify)
- [Deploy using the Netlify CLI](#deploy-using-the-netlify-cli)
- [Running Locally](#running-locally)
- [Deployment Resources](#deployment-resources)
- [Forms](#forms)
- [Adding a Custom Submission Page](#adding-a-custom-submission-page)
- [Blocking Bot Spam with a Honeypot Field](#blocking-bot-spam-with-a-honeypot-field)
- [Forms Resources](#forms-resources)
- [Netlify Functions](#netlify-functions)
- [Netlify Functions Resources](#netlify-functions-resources)
- [Redirects](#redirects)
- [Example](#example)
- [Redirect Resources](#redirect-resources)
- [Testing](#testing)
- [Included Default Testing](#included-default-testing)
- [Removing Renovate](#removing-renovate)
- [Removing Cypress](#removing-cypress)
- [Nuxt Toolbox Template Video Walkthrough](#nuxt-toolbox-template-video-walkthrough)
- [I Want Moar](#i-want-moar)
## Build Setup
```bash
@ -28,7 +52,7 @@ Want to deploy immediately? Click this button
Clicking this button will create a new repo for you that looks exactly like this one, and sets that repo up immediately for deployment on Netlify.
### Deploy using the [Netlify CLI](https://cli.netlify.com/):
### Deploy using the Netlify CLI
Click the 'Use the Template' button at the top of this repo. Then install the Netlify CLI tool and run `netlify init`. Or straight from the Netlify CLI, use the `netlify sites:create-template` command in you terminal ([learn more about this command here](https://www.netlify.com/blog/create-a-site-from-a-template-using-the-netlify-cli)) to do the entire flow for you.
```bash
@ -174,6 +198,52 @@ There are many ways to use redirects. Check out the resouces below to learn more
- [Redirect by country or language](https://docs.netlify.com/routing/redirects/redirect-options/#redirect-by-country-or-language)
- [On-Demand Builders](https://docs.netlify.com/configure-builds/on-demand-builders/)
## Testing
### Included Default Testing
Weve included some tooling that helps us maintain these templates. This template currently uses:
- [Renovate](https://www.mend.io/free-developer-tools/renovate/) - to regularly update our dependencies
- [Cypress](https://www.cypress.io/) - to run tests against how the template runs in the browser
- [Cypress Netlify Build Plugin](https://github.com/cypress-io/netlify-plugin-cypress) - to run our tests during our build process
If your team is not interested in this tooling, you can remove them with ease!
### Removing Renovate
In order to keep our project up-to-date with dependencies we use a tool called [Renovate](https://github.com/marketplace/renovate). If youre not interested in this tooling, delete the `renovate.json` file and commit that onto your main branch.
### Removing Cypress
For our testing, we use [Cypress](https://www.cypress.io/) for end-to-end testing. This makes sure that we can validate that our templates are rendering and displaying as wed expect. By default, we have Cypress not generate deploy links if our tests dont pass. If youd like to keep Cypress and still generate the deploy links, go into your `netlify.toml` and delete the plugin configuration lines:
```diff
[[plugins]]
package = "netlify-plugin-cypress"
- [plugins.inputs.postBuild]
- enable = true
-
- [plugins.inputs]
- enable = false
```
If youd like to remove the `netlify-plugin-cypress` build plugin entirely, youd need to delete the entire block above instead. And then make sure sure to remove the package from the dependencies using:
```bash
npm uninstall -D netlify-plugin-cypress
```
And lastly if youd like to remove Cypress entirely, delete the entire `cypress` folder and the `cypress.config.ts` file. Then remove the dependency using:
```bash
npm uninstall cypress
```
## Nuxt Toolbox Template Video Walkthrough
https://user-images.githubusercontent.com/76533034/156563030-e3c0c2a1-2e3a-43f0-bcf5-5ea891289553.mp4
## I want moar!
@ -181,9 +251,3 @@ If you want to discover more Netlify features via this template, here's a couple
- Add a Netlify plugin, either via [the UI](https://app.netlify.com/plugins) or [`netlify.toml`](https://docs.netlify.com/configure-builds/build-plugins/). For example, why not try the `A11y` plugin to run some accessibility testing on your site!
- [Create environment variables using the CLI](https://www.netlify.com/blog/2021/07/12/managing-environment-variables-from-your-terminal-with-netlify-cli/) to store secret tokens (e.g. API key), and use them in the Netlify function to fetch data from your favorite API.
## Nuxt Toolbox Template - Walkthrough
https://user-images.githubusercontent.com/76533034/156563030-e3c0c2a1-2e3a-43f0-bcf5-5ea891289553.mp4