mirror of
https://github.com/cypress-io/cypress.git
synced 2026-05-01 20:39:57 -05:00
4520c2b6dd
* feat(run): handle failed tests returned by the cypress run * cli: rework errors thrown from cypress vs xvfb * small tweak * cli: test xvfb start error handling
36 lines
855 B
JavaScript
36 lines
855 B
JavaScript
// https://github.com/cypress-io/cypress/issues/316
|
|
|
|
const Promise = require('bluebird')
|
|
const fs = Promise.promisifyAll(require('fs-extra'))
|
|
const tmp = Promise.promisifyAll(require('tmp'))
|
|
|
|
const open = require('./exec/open')
|
|
const run = require('./exec/run')
|
|
|
|
module.exports = {
|
|
open (options = {}) {
|
|
return open.start(options)
|
|
},
|
|
|
|
run (options = {}) {
|
|
return tmp.fileAsync()
|
|
.then((outputPath) => {
|
|
options.outputPath = outputPath
|
|
|
|
return run.start(options)
|
|
.then((failedTests) =>
|
|
fs.readJsonAsync(outputPath, { throws: false })
|
|
.then((output) => {
|
|
if (!output) {
|
|
return {
|
|
failures: failedTests,
|
|
message: 'Could not find Cypress test run results',
|
|
}
|
|
}
|
|
return output
|
|
})
|
|
)
|
|
})
|
|
},
|
|
}
|