Skip to content

Commit 16ca542

Browse files
committed
add example to README
1 parent f4054a7 commit 16ca542

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,23 @@ package = "netlify-plugin-cypress"
108108

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

111+
### testing server before build
112+
113+
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
114+
115+
```toml
116+
[[plugins]]
117+
package = "netlify-plugin-cypress"
118+
# let's run tests against development server
119+
# before building it (and testing the built site)
120+
[plugins.inputs.preBuild]
121+
start = 'npm start'
122+
wait-on = 'http://localhost:5000'
123+
wait-on-timeout = '30' # seconds
124+
```
125+
126+
Parameters you can place into `preBuild` inputs: `start`, `wait-on`, `wait-on-timeout`, `record`, `spec`.
127+
111128
## Debugging
112129

113130
Set environment variable `DEBUG=netlify-plugin-cypress` to see the debug logs. To see even more information, set `DEBUG=netlify-plugin-cypress,netlify-plugin-cypress:verbose`

src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ function startServerMaybe (options = {}) {
3030

3131
debug('detached the process and returning stop function')
3232
return () => {
33-
debug('stopping server process')
33+
console.log('stopping server process opened with:', startCommand)
3434
serverProcess.kill()
3535
}
3636
}

0 commit comments

Comments
 (0)