mirror of
https://github.com/cypress-io/cypress.git
synced 2026-01-06 06:29:45 -06:00
allow triggering test jobs with just NPM and binary strings (#547)
This commit is contained in:
@@ -2,6 +2,7 @@ const minimist = require('minimist')
|
||||
const la = require('lazy-ass')
|
||||
const is = require('check-more-types')
|
||||
const path = require('path')
|
||||
const fs = require('fs')
|
||||
|
||||
/* eslint-disable no-console */
|
||||
|
||||
@@ -13,17 +14,23 @@ function getNameAndBinary (args = process.argv) {
|
||||
la(is.unemptyString(options.binary),
|
||||
'missing --binary option with binary url', options)
|
||||
|
||||
console.log('loading NPM url from', options.npm)
|
||||
const npmUrl = require(path.resolve(options.npm)).url
|
||||
la(is.url(npmUrl), 'not an url', npmUrl)
|
||||
let npmUrlOrVersion = options.npm
|
||||
if (fs.existsSync(options.npm)) {
|
||||
console.log('loading NPM url from', options.npm)
|
||||
npmUrlOrVersion = require(path.resolve(options.npm)).url
|
||||
la(is.url(npmUrlOrVersion), 'not an url', npmUrlOrVersion)
|
||||
}
|
||||
|
||||
console.log('loading binary url from', options.binary)
|
||||
const binaryUrl = require(path.resolve(options.binary)).url
|
||||
la(is.url(binaryUrl), 'not an url', binaryUrl)
|
||||
let binaryVersionOrUrl = options.binary
|
||||
if (fs.existsSync(options.binary)) {
|
||||
console.log('loading binary url from', options.binary)
|
||||
binaryVersionOrUrl = require(path.resolve(options.binary)).url
|
||||
la(is.url(binaryVersionOrUrl), 'not an url', binaryVersionOrUrl)
|
||||
}
|
||||
|
||||
return {
|
||||
npmUrl,
|
||||
binaryUrl,
|
||||
npmUrl: npmUrlOrVersion,
|
||||
binaryUrl: binaryVersionOrUrl,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user