Skip to content

Commit 0f5c936

Browse files
committed
add local Netlify setup
1 parent bdb00f6 commit 0f5c936

File tree

5 files changed

+1478
-14
lines changed

5 files changed

+1478
-14
lines changed

index.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ async function runCypressTests (baseUrl, record, spec) {
2828
})
2929
}
3030

31-
async function preBuild() {
31+
async function onInit() {
3232
debug('installing Cypress binary just in case')
3333
if (debug.enabled) {
3434
await execa('npx', ['cypress', 'install'], {stdio: 'inherit'})
@@ -85,9 +85,12 @@ async function postBuild({ fullPublishFolder, record, spec, failBuild }) {
8585
module.exports = function cypressPlugin (pluginConfig) {
8686
debugVerbose('cypressPlugin config %o', pluginConfig)
8787

88+
// here we can grab all input settings to isolate Cypress logic
89+
// from reading the inputs
90+
8891
return {
8992
name: 'cypress netlify plugin',
90-
preBuild,
93+
onInit,
9194
postBuild: async (arg) => {
9295
debugVerbose('postBuild arg %o', arg)
9396

netlify.toml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# WARNING ⚠️: this is a Netlify file with local Cypress plugin
2+
# so it might look quite different from the user's Netlify configuration
3+
[build]
4+
command = "echo 'Netlify build command ..."
5+
publish = "public"
6+
[build.environment]
7+
CI = "1"
8+
TERM = "xterm"
9+
CYPRESS_CACHE_FOLDER = "./node_modules/CypressBinary"
10+
11+
[[plugins]]
12+
# local Cypress plugin will test our site after it is built
13+
package = "."

0 commit comments

Comments
 (0)