mirror of
https://github.com/cypress-io/cypress.git
synced 2026-05-04 14:00:22 -05:00
cli: enable returning node module interface
-have binary call directly into the CLI
This commit is contained in:
+1
-1
@@ -1,3 +1,3 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
require("../")
|
||||
require("../lib/cli").init()
|
||||
|
||||
+3
-1
@@ -10,6 +10,7 @@ function installingFromNpmAsAUser () {
|
||||
return process.env.CYPRESS_DOWNLOAD !== "0"
|
||||
}
|
||||
|
||||
// we're being used from the command line
|
||||
switch (args.exec) {
|
||||
case 'install':
|
||||
// only go out and download the cypress
|
||||
@@ -20,5 +21,6 @@ switch (args.exec) {
|
||||
}
|
||||
break
|
||||
default:
|
||||
require('./lib/cli').init()
|
||||
// export our node module interface
|
||||
module.exports = require("./lib/cypress")
|
||||
}
|
||||
|
||||
+7
-2
@@ -1,3 +1,5 @@
|
||||
// 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'))
|
||||
@@ -11,9 +13,12 @@ module.exports = {
|
||||
},
|
||||
|
||||
run (options = {}) {
|
||||
return tmp.fileAsync().then((outputPath) => {
|
||||
return tmp.fileAsync()
|
||||
.then((outputPath) => {
|
||||
options.outputPath = outputPath
|
||||
return run.start(options).then(() => {
|
||||
|
||||
return run.start(options)
|
||||
.then(() => {
|
||||
return fs.readJsonAsync(outputPath)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user