Skip to content

Commit c28c585

Browse files
authored
feat: serve the built site with lwsjs (#69)
and allow `spa` input parameter https://github.com/lwsjs/local-web-server
1 parent 36a28a8 commit c28c585

File tree

5 files changed

+962
-136
lines changed

5 files changed

+962
-136
lines changed

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,20 @@ package = "netlify-plugin-cypress"
157157

158158
See [cypress-example-kitchensink](https://github.com/cypress-io/cypress-example-kitchensink) for instance.
159159

160+
### testing SPA routes
161+
162+
SPAs need catch-all redirect setup to make non-root paths accesssible by tests. You can enable this with `spa` parameter.
163+
164+
```
165+
[[plugins]]
166+
# local Cypress plugin will test our site after it is built
167+
package = "netlify-plugin-cypress"
168+
[plugins.inputs]
169+
spa = "index.html"
170+
```
171+
172+
See [lws-spa](https://github.com/lwsjs/spa) for more options.
173+
160174
### testing the site before build
161175

162176
By default this plugin tests static site _after build_. But maybe you want to run end-to-end tests against the _local development server_. You can start local server, wait for it to respond and then run Cypress tests by passing parameters to this plugin. Here is a sample config file

manifest.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ inputs:
77
- name: spec
88
- name: group
99
- name: tag
10+
- name: spa
1011

1112
# tells the plugin how to start the server using custom command
1213
# and waiting for an url, record to the dashboard, tag, etc

0 commit comments

Comments
 (0)