Skip to content

Commit 65d70f5

Browse files
committed
feat: install cypress binary preBuild
1 parent c8cb9f1 commit 65d70f5

File tree

3 files changed

+251
-34
lines changed

3 files changed

+251
-34
lines changed

index.js

+7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// @ts-check
22
const ecstatic = require('ecstatic')
33
const http = require('http')
4+
const execa = require('execa')
45
const debug = require('debug')('netlify-plugin-cypress')
56
const debugVerbose = require('debug')('netlify-plugin-cypress:verbose')
67

@@ -27,6 +28,11 @@ async function runCypressTests (baseUrl, record, spec) {
2728
})
2829
}
2930

31+
async function preBuild() {
32+
debug('installing Cypress binary just in case')
33+
await execa('npx', ['cypress', 'install'])
34+
}
35+
3036
async function postBuild({ fullPublishFolder, record, spec, failBuild }) {
3137
const port = 8080
3238
const server = serveFolder(fullPublishFolder, port)
@@ -77,6 +83,7 @@ module.exports = function cypressPlugin (pluginConfig) {
7783

7884
return {
7985
name: 'cypress netlify plugin',
86+
preBuild,
8087
postBuild: async (arg) => {
8188
debugVerbose('postBuild arg %o', arg)
8289

0 commit comments

Comments
 (0)