Skip to content

Commit a9c85b3

Browse files
authored
feat: run verify Cypress after install (#103)
1 parent 7d04197 commit a9c85b3

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/index.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,20 @@ async function install(arg) {
126126
}
127127
}
128128

129+
async function verify(arg) {
130+
debug('verifying Cypress can run')
131+
try {
132+
await arg.utils.run('cypress', ['verify'])
133+
} catch (error) {
134+
debug('error verifying Cypress: %s', error.message)
135+
const buildUtils = arg.utils.build
136+
console.error('')
137+
console.error('Failed to verify Cypress')
138+
console.error('')
139+
buildUtils.failBuild('Failed to verify Cypress', { error })
140+
}
141+
}
142+
129143
const processCypressResults = (results, buildUtils) => {
130144
if (results.failures) {
131145
// Cypress failed without even running the tests
@@ -185,6 +199,7 @@ const hasRecordKey = () => typeof process.env.CYPRESS_RECORD_KEY === 'string'
185199
module.exports = {
186200
onPreBuild: async (arg) => {
187201
await install(arg)
202+
await verify(arg)
188203

189204
debug('cypress plugin preBuild inputs %o', arg.inputs)
190205
const preBuildInputs = arg.inputs && arg.inputs.preBuild

0 commit comments

Comments
 (0)