Skip to content

Commit 19a0e3b

Browse files
authored
chore (#8): adds maintenance tooling
closes #8 adds cypress, config, and sample test adds renovate config adds testing docs to readme adds table of contents to readme
2 parents 20d0035 + fba1721 commit 19a0e3b

File tree

7 files changed

+1946
-242
lines changed

7 files changed

+1946
-242
lines changed

README.md

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,16 @@ Click this button and it will help you create a new repo, create a new Netlify p
77

88
[![Deploy to Netlify Button](https://www.netlify.com/img/deploy/button.svg)](https://app.netlify.com/start/deploy?repository=https://github.com/netlify-templates/angular-quickstart)
99

10+
## Table of Contents:
11+
12+
- [Setup](#setup)
13+
- [Deploying](#deploying)
14+
- [Testing](#testing)
15+
- [Included Default Testing](#included-default-testing)
16+
- [Removing Renovate](#removing-renovate)
17+
- [Removing Cypress](#removing-cypress)
18+
- [Angular + Netlify Resources](#angular--netlify-resources)
19+
1020
## Setup
1121

1222
Clone this repo with one of these options:
@@ -33,7 +43,49 @@ There are a few ways to deploy this template:
3343
- Head to the [Netlify UI](https://app.netlify.com/) to deploy via GitHub or [drag and drop](https://app.netlify.com/drop) the project folder
3444
- Use the Netlify CLI's create from template command `netlify sites:create-template angular-quickstart` which will create a repo, Netlify project, and deploy it
3545

36-
## Angular 💙 Netlify Resources
46+
## Testing
47+
48+
### Included Default Testing
49+
50+
We’ve included some tooling that helps us maintain these templates. This template currently uses:
51+
52+
- [Renovate](https://www.mend.io/free-developer-tools/renovate/) - to regularly update our dependencies
53+
- [Cypress](https://www.cypress.io/) - to run tests against how the template runs in the browser
54+
- [Cypress Netlify Build Plugin](https://github.com/cypress-io/netlify-plugin-cypress) - to run our tests during our build process
55+
56+
If your team is not interested in this tooling, you can remove them with ease!
57+
58+
### Removing Renovate
59+
60+
In order to keep our project up-to-date with dependencies we use a tool called [Renovate](https://github.com/marketplace/renovate). If you’re not interested in this tooling, delete the `renovate.json` file and commit that onto your main branch.
61+
62+
### Removing Cypress
63+
64+
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 we’d expect. By default, we have Cypress not generate deploy links if our tests don’t pass. If you’d like to keep Cypress and still generate the deploy links, go into your `netlify.toml` and delete the plugin configuration lines:
65+
66+
```diff
67+
[[plugins]]
68+
package = "netlify-plugin-cypress"
69+
- [plugins.inputs.postBuild]
70+
- enable = true
71+
-
72+
- [plugins.inputs]
73+
- enable = false
74+
```
75+
76+
If you’d like to remove the `netlify-plugin-cypress` build plugin entirely, you’d need to delete the entire block above instead. And then make sure sure to remove the package from the dependencies using:
77+
78+
```bash
79+
npm uninstall -D netlify-plugin-cypress
80+
```
81+
82+
And lastly if you’d like to remove Cypress entirely, delete the entire `cypress` folder and the `cypress.config.ts` file. Then remove the dependency using:
83+
84+
```bash
85+
npm uninstall cypress
86+
```
87+
88+
## Angular + Netlify Resources
3789

3890
Here are some resources to help you on your Angular + Netlify coding fun!
3991

cypress.config.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { defineConfig } from "cypress";
2+
3+
export default defineConfig({
4+
e2e: {
5+
baseUrl: 'http://localhost:8888',
6+
supportFile: false,
7+
},
8+
});

cypress/e2e/basic.cy.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
describe('empty spec', () => {
2+
beforeEach(() => {
3+
cy.visit('/')
4+
})
5+
6+
it('displays the resources text', () => {
7+
cy.get('h2')
8+
.contains('Here are some resources to help you on your Angular + Netlify journey');
9+
})
10+
it('renders the image', () => {
11+
cy.get('img')
12+
.should('be.visible')
13+
.and(($img) => {
14+
expect($img[0].naturalWidth).to.be.greaterThan(0);
15+
})
16+
})
17+
})

netlify.toml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,13 @@
55
[[redirects]]
66
from = "/*"
77
to = "/index.html"
8-
status = 200
8+
status = 200
9+
10+
[[plugins]]
11+
package = "netlify-plugin-cypress"
12+
13+
[plugins.inputs.postBuild]
14+
enable = true
15+
16+
[plugins.inputs]
17+
enable = false

0 commit comments

Comments
 (0)