chore: trigger downstream project tests for windows workflow (#19381)

This commit is contained in:
Emily Rohrbough
2021-12-17 11:01:20 -06:00
committed by GitHub
parent 8e23567d5b
commit aea8b2b788
2 changed files with 60 additions and 39 deletions
+33 -16
View File
@@ -1,32 +1,49 @@
/* eslint-disable no-console */
const minimist = require('minimist')
const options = minimist(process.argv)
const os = require('os')
const la = require('lazy-ass')
const fs = require('fs-extra')
const is = require('check-more-types')
const execa = require('execa')
const { getNameAndBinary } = require('./utils')
/* eslint-disable no-console */
const options = minimist(process.argv)
const cwd = options.cwd || '/tmp/testing'
fs.ensureDirSync(cwd)
const spawnOpts = {
cwd,
shell: os.platform() === 'win32' ? 'bash.exe' : '/bin/bash',
stdio: 'inherit',
}
const { npm, binary } = getNameAndBinary(process.argv)
la(is.unemptyString(npm), 'missing npm url')
la(is.unemptyString(binary), 'missing binary url')
console.log('testing NPM from', npm)
console.log('and binary from', binary)
const cwd = options.cwd || process.cwd()
console.log('in', cwd)
execa(`npm install ${npm}`, {
cwd,
shell: true,
stdio: 'inherit',
env: {
CYPRESS_INSTALL_BINARY: binary,
},
})
console.log('Create Dummy Project')
execa('npm init -y', spawnOpts)
.then(console.log)
.then(() => {
console.log('testing NPM from', npm)
console.log('and binary from', binary)
console.log('in', cwd)
return execa(`npm install ${npm}`, {
...spawnOpts,
env: {
CYPRESS_INSTALL_BINARY: binary,
},
}).then(console.log)
})
.then(() => {
console.log('Verify Cypress binary')
return execa('$(yarn bin cypress) verify', spawnOpts)
.then(console.log)
})
.catch((e) => {
console.error(e)
process.exit(1)