Skip to content

Commit fd778c8

Browse files
committed
fix: pass the error callback, closes #113
1 parent de49353 commit fd778c8

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/index.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,12 @@ async function cypressInfo(arg) {
190190
}
191191

192192
const processCypressResults = (results, errorCallback) => {
193+
if (typeof errorCallback !== 'function') {
194+
debug('Typeof of error callback %s', errorCallback)
195+
throw new Error(
196+
`Expected error callback to be a function, it was ${typeof errorCallback}`,
197+
)
198+
}
193199
if (results.failures) {
194200
// Cypress failed without even running the tests
195201
console.error('Problem running Cypress')
@@ -310,7 +316,9 @@ module.exports = {
310316
closeServer()
311317
}
312318

313-
processCypressResults(results, arg.utils.build)
319+
const errorCallback = arg.utils.build.failBuild.bind(arg.utils.build)
320+
321+
processCypressResults(results, errorCallback)
314322
},
315323

316324
onPostBuild: async (arg) => {

0 commit comments

Comments
 (0)