Files
cypress/cli/lib/cypress.js
T
Brian Mann 001a310b04 Issue 1159 (#1259)
* server: pass --cwd from CLI to use when resolving relative paths for various options

- remove unnecessary cwd manipulation in scripts/start

* server: fixes #1159, specs are normalized into an array resolved against cwd

- projectPath is now normalized against cwd as well

* server: move hosts out of CLI args, keep as config only

* server: convert spec array to string on module API

* cli: must ref root package directly

* server: fixes busted specs due to cherry pick

* server: temporary fix for specs being normalized into an array

* server: move around spec flattening earlier

* server: pass absolute path for specs

* server: revert flattening hosts into config temporarily

* server: add correct relative + absolute path to spec

* driver: normalize spec path against project

* driver: skip flaky test for now [skip ci]
2018-02-07 12:11:24 -05:00

41 lines
947 B
JavaScript

// https://github.com/cypress-io/cypress/issues/316
const Promise = require('bluebird')
const tmp = Promise.promisifyAll(require('tmp'))
const fs = require('./fs')
const open = require('./exec/open')
const run = require('./exec/run')
const util = require('./util')
const cypressModuleApi = {
open (options = {}) {
return open.start(options)
},
run (options = {}) {
options = util.normalizeModuleOptions(options)
return tmp.fileAsync()
.then((outputPath) => {
options.outputPath = outputPath
return run.start(options)
.then((failedTests) => {
return fs.readJsonAsync(outputPath, { throws: false })
.then((output) => {
if (!output) {
return {
failures: failedTests,
message: 'Could not find Cypress test run results',
}
}
return output
})
})
})
},
}
module.exports = cypressModuleApi