Skip to content

feat: run verify Cypress after install #103

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 4, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,20 @@ async function install(arg) {
}
}

async function verify(arg) {
debug('verifying Cypress can run')
try {
await arg.utils.run('cypress', ['verify'])
} catch (error) {
debug('error verifying Cypress: %s', error.message)
const buildUtils = arg.utils.build
console.error('')
console.error('Failed to verify Cypress')
console.error('')
buildUtils.failBuild('Failed to verify Cypress', { error })
}
}

const processCypressResults = (results, buildUtils) => {
if (results.failures) {
// Cypress failed without even running the tests
Expand Down Expand Up @@ -185,6 +199,7 @@ const hasRecordKey = () => typeof process.env.CYPRESS_RECORD_KEY === 'string'
module.exports = {
onPreBuild: async (arg) => {
await install(arg)
await verify(arg)

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