mirror of
https://github.com/cypress-io/cypress.git
synced 2026-02-18 13:10:51 -06:00
Merge branch 'master' of github.com:cypress-io/cypress-monorepo
This commit is contained in:
219
circle.yml
219
circle.yml
@@ -1,20 +1,24 @@
|
||||
version: 2
|
||||
|
||||
jobs:
|
||||
build:
|
||||
docker:
|
||||
# the Docker image with Cypress dependencies and Chrome browser
|
||||
- image: cypress/internal:chrome58
|
||||
environment:
|
||||
## this enables colors + fixes failing unit tests
|
||||
TERM: xterm
|
||||
defaults: &defaults
|
||||
parallelism: 1
|
||||
working_directory: ~/cypress-monorepo
|
||||
docker:
|
||||
# the Docker image with Cypress dependencies and Chrome browser
|
||||
- image: cypress/internal:chrome58
|
||||
environment:
|
||||
## this enables colors + fixes failing unit tests
|
||||
TERM: xterm
|
||||
|
||||
npm_config_loglevel: warn
|
||||
# even when running as non-root user
|
||||
# need to set unsafe perm to be able to do `npm postinstall`
|
||||
npm_config_unsafe-perm: true
|
||||
working_directory: ~/cypress-monorepo
|
||||
parallelism: 4
|
||||
npm_config_loglevel: warn
|
||||
# even when running as non-root user
|
||||
# need to set unsafe perm to be able to do `npm postinstall`
|
||||
npm_config_unsafe-perm: true
|
||||
|
||||
jobs:
|
||||
## code checkout and NPM installs
|
||||
build:
|
||||
<<: *defaults
|
||||
steps:
|
||||
- checkout
|
||||
|
||||
@@ -151,82 +155,113 @@ jobs:
|
||||
## now go build all of subpackages
|
||||
- run: npm run build
|
||||
|
||||
#
|
||||
# things to run in the 1st CI container
|
||||
#
|
||||
- run:
|
||||
name: Running linters
|
||||
command: |
|
||||
if [ $CIRCLE_NODE_INDEX == 0 ]; then
|
||||
npm run lint
|
||||
npm run all lint
|
||||
fi
|
||||
## save entire folder as artifact for other jobs to continue
|
||||
## hmm, do not see a good way to cache it, since all code
|
||||
## might change
|
||||
- save_cache:
|
||||
key: cypress-monorepo-{{ .Branch }}-{{ .Revision }}
|
||||
paths:
|
||||
- /home/person/cypress-monorepo
|
||||
|
||||
- run:
|
||||
name: Fast unit tests
|
||||
command: |
|
||||
if [ $CIRCLE_NODE_INDEX == 0 ]; then
|
||||
npm run all test -- --package cli
|
||||
npm run all test -- --package coffee
|
||||
npm run all test -- --package desktop-gui
|
||||
npm run all test -- --package electron
|
||||
npm run all test -- --package extension
|
||||
npm run all test -- --package https-proxy
|
||||
npm run all test -- --package launcher
|
||||
npm run all test -- --package reporter
|
||||
npm run all test -- --package runner
|
||||
npm run all test -- --package socket
|
||||
npm run all test -- --package static
|
||||
fi
|
||||
- run:
|
||||
name: Server unit tests
|
||||
command: |
|
||||
if [ $CIRCLE_NODE_INDEX == 0 ]; then
|
||||
npm run all test-unit -- --package server
|
||||
fi
|
||||
- run:
|
||||
name: Server integration tests
|
||||
command: |
|
||||
if [ $CIRCLE_NODE_INDEX == 0 ]; then
|
||||
whoami
|
||||
npm run all test-integration -- --package server
|
||||
fi
|
||||
#
|
||||
# things to run in the 2nd CI container
|
||||
#
|
||||
- run:
|
||||
name: Server E2E tests (electron)
|
||||
command: |
|
||||
if [ $CIRCLE_NODE_INDEX == 1 ]; then
|
||||
npm run all test-e2e -- --package server
|
||||
fi
|
||||
#
|
||||
# things to run in the 3rd CI container
|
||||
#
|
||||
- run:
|
||||
name: Docs - running E2E tests
|
||||
command: |
|
||||
if [ $CIRCLE_NODE_INDEX == 2 ]; then
|
||||
cd docs
|
||||
npm run test-e2e
|
||||
fi
|
||||
#
|
||||
# things to run in the 4th CI container
|
||||
#
|
||||
- run:
|
||||
name: Driver unit tests
|
||||
command: |
|
||||
if [ $CIRCLE_NODE_INDEX == 3 ]; then
|
||||
chrome --version
|
||||
xvfb-run -as "-screen 0 1280x720x16" npm run all test -- --package driver
|
||||
fi
|
||||
#
|
||||
# things to run in the 4th CI container
|
||||
#
|
||||
# - run:
|
||||
# name: Example e2e tests
|
||||
# command: |
|
||||
# if [ $CIRCLE_NODE_INDEX == 3 ]; then
|
||||
# # ./bin/cypress --project=./packages/example --path-to-cypress
|
||||
# # xvfb-run -as "-screen 0 1280x720x16" npm start -- --project=./packages/example
|
||||
# fi
|
||||
lint:
|
||||
<<: *defaults
|
||||
steps:
|
||||
- restore_cache:
|
||||
key: cypress-monorepo-{{ .Branch }}-{{ .Revision }}
|
||||
- run: npm run lint
|
||||
- run: npm run all lint
|
||||
|
||||
"unit-tests":
|
||||
<<: *defaults
|
||||
parallelism: 2
|
||||
steps:
|
||||
- restore_cache:
|
||||
key: cypress-monorepo-{{ .Branch }}-{{ .Revision }}
|
||||
- run: npm run all test -- --package cli
|
||||
- run: npm run all test -- --package coffee
|
||||
- run: npm run all test -- --package desktop-gui
|
||||
- run: npm run all test -- --package electron
|
||||
- run: npm run all test -- --package extension
|
||||
- run: npm run all test -- --package https-proxy
|
||||
- run: npm run all test -- --package launcher
|
||||
- run: npm run all test -- --package reporter
|
||||
- run: npm run all test -- --package runner
|
||||
- run: npm run all test -- --package socket
|
||||
- run: npm run all test -- --package static
|
||||
|
||||
"server-unit-tests":
|
||||
<<: *defaults
|
||||
parallelism: 2
|
||||
steps:
|
||||
- restore_cache:
|
||||
key: cypress-monorepo-{{ .Branch }}-{{ .Revision }}
|
||||
- run: npm run all test-unit -- --package server
|
||||
|
||||
"server-integration-tests":
|
||||
<<: *defaults
|
||||
parallelism: 2
|
||||
steps:
|
||||
- restore_cache:
|
||||
key: cypress-monorepo-{{ .Branch }}-{{ .Revision }}
|
||||
- run: npm run all test-integration -- --package server
|
||||
|
||||
"server-e2e-tests":
|
||||
<<: *defaults
|
||||
steps:
|
||||
- restore_cache:
|
||||
key: cypress-monorepo-{{ .Branch }}-{{ .Revision }}
|
||||
- run: npm run all test-e2e -- --package server
|
||||
|
||||
"docs-tests":
|
||||
<<: *defaults
|
||||
steps:
|
||||
- restore_cache:
|
||||
key: cypress-monorepo-{{ .Branch }}-{{ .Revision }}
|
||||
- run: cd docs && npm run test-e2e
|
||||
|
||||
"driver-unit-tests":
|
||||
<<: *defaults
|
||||
parallelism: 2
|
||||
steps:
|
||||
- restore_cache:
|
||||
key: cypress-monorepo-{{ .Branch }}-{{ .Revision }}
|
||||
- run: chrome --version
|
||||
- run: xvfb-run -as "-screen 0 1280x720x16" npm run all test -- --package driver
|
||||
|
||||
workflows:
|
||||
version: 2
|
||||
build_and_test:
|
||||
jobs:
|
||||
- build
|
||||
- lint:
|
||||
requires:
|
||||
- build
|
||||
- unit-tests:
|
||||
requires:
|
||||
- build
|
||||
- server-unit-tests:
|
||||
requires:
|
||||
- build
|
||||
- server-integration-tests:
|
||||
requires:
|
||||
- build
|
||||
- server-e2e-tests:
|
||||
requires:
|
||||
- build
|
||||
- docs-tests:
|
||||
requires:
|
||||
- build
|
||||
- driver-unit-tests:
|
||||
requires:
|
||||
- build
|
||||
|
||||
#
|
||||
# things to run in the 4th CI container
|
||||
#
|
||||
# - run:
|
||||
# name: Example e2e tests
|
||||
# command: |
|
||||
# if [ $CIRCLE_NODE_INDEX == 3 ]; then
|
||||
# # ./bin/cypress --project=./packages/example --path-to-cypress
|
||||
# # xvfb-run -as "-screen 0 1280x720x16" npm start -- --project=./packages/example
|
||||
# fi
|
||||
|
||||
1
cli/.npmrc
Normal file
1
cli/.npmrc
Normal file
@@ -0,0 +1 @@
|
||||
save-exact=true
|
||||
@@ -2,20 +2,25 @@ const minimist = require('minimist')
|
||||
const debug = require('debug')('cypress:cli')
|
||||
const args = minimist(process.argv.slice(2))
|
||||
|
||||
const reportError = (err) => {
|
||||
console.error(err) // eslint-disable-line no-console
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
// we're being used from the command line
|
||||
switch (args.exec) {
|
||||
case 'install':
|
||||
debug('installing Cypress from NPM')
|
||||
require('./lib/download')
|
||||
.install()
|
||||
.catch(console.error) // eslint-disable-line no-console
|
||||
.catch(reportError)
|
||||
break
|
||||
case 'verify':
|
||||
// for simple testing in the monorepo
|
||||
debug('verifying Cypress')
|
||||
require('./lib/download/utils')
|
||||
.verify()
|
||||
.catch(console.error) // eslint-disable-line no-console
|
||||
.catch(reportError)
|
||||
break
|
||||
default:
|
||||
// export our node module interface
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
const _ = require('lodash')
|
||||
const commander = require('commander')
|
||||
const { oneLine } = require('common-tags')
|
||||
const debug = require('debug')('cypress:cli')
|
||||
|
||||
const coerceFalse = (arg) => {
|
||||
return arg !== 'false'
|
||||
}
|
||||
|
||||
const parseOpts = (opts) => _.pick(opts, 'spec', 'reporter', 'reporterOptions', 'path', 'destination', 'port', 'env', 'cypressVersion', 'config', 'record', 'key', 'browser')
|
||||
const parseOpts = (opts) => _.pick(opts, 'spec', 'reporter', 'reporterOptions', 'path', 'destination', 'port', 'env', 'cypressVersion', 'config', 'record', 'key', 'browser', 'detached')
|
||||
|
||||
const descriptions = {
|
||||
record: 'records the run. sends test results, screenshots and videos to your Cypress Dashboard.',
|
||||
@@ -21,6 +22,7 @@ const descriptions = {
|
||||
runs Cypress in the browser with the given name.
|
||||
note: using an external browser will cancel video recording of tests.
|
||||
`,
|
||||
detached: 'runs Cypress application in detached mode',
|
||||
}
|
||||
|
||||
const text = (description) => {
|
||||
@@ -57,6 +59,7 @@ module.exports = {
|
||||
.option('-p, --port <port>', text('port'))
|
||||
.option('-e, --env <env>', text('env'))
|
||||
.option('-c, --config <config>', text('config'))
|
||||
.option('-d, --detached [bool]', text('detached'), coerceFalse)
|
||||
.action((opts) => require('./exec/open').start(parseOpts(opts)))
|
||||
|
||||
program
|
||||
@@ -69,6 +72,7 @@ module.exports = {
|
||||
.description('Verifies that Cypress is installed correctly and executable')
|
||||
.action(() => require('./download/utils').verify({ force: true }))
|
||||
|
||||
debug('cli starts with arguments %j', process.argv)
|
||||
program.parse(process.argv)
|
||||
|
||||
//# if the process.argv.length
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
const downloadUtils = require('../download/utils')
|
||||
const spawn = require('./spawn')
|
||||
const debug = require('debug')('cypress:cli')
|
||||
|
||||
module.exports = {
|
||||
start (options = {}) {
|
||||
@@ -16,11 +17,13 @@ module.exports = {
|
||||
if (options.port) {
|
||||
args.push('--port', options.port)
|
||||
}
|
||||
debug('opening from options %j', options)
|
||||
debug('command line arguments %j', args)
|
||||
|
||||
return downloadUtils.verify()
|
||||
.then(() => {
|
||||
return spawn.start(args, {
|
||||
detached: true,
|
||||
detached: Boolean(options.detached),
|
||||
stdio: ['ignore', 'ignore', 'ignore'],
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
const _ = require('lodash')
|
||||
const cp = require('child_process')
|
||||
// const chalk = require('chalk')
|
||||
const Promise = require('bluebird')
|
||||
const debug = require('debug')('cypress:cli')
|
||||
|
||||
|
||||
@@ -21,26 +21,26 @@
|
||||
"size": "t=\"$(npm pack .)\"; wc -c \"${t}\"; tar tvf \"${t}\"; rm \"${t}\";"
|
||||
},
|
||||
"dependencies": {
|
||||
"bluebird": "^3.4.5",
|
||||
"chalk": "^1.1.3",
|
||||
"commander": "^2.8.1",
|
||||
"common-tags": "^1.4.0",
|
||||
"debug": "^2.6.8",
|
||||
"extract-zip": "^1.6.0",
|
||||
"bluebird": "3.5.0",
|
||||
"chalk": "1.1.3",
|
||||
"commander": "2.9.0",
|
||||
"common-tags": "1.4.0",
|
||||
"debug": "2.6.8",
|
||||
"extract-zip": "1.6.5",
|
||||
"fs-extra": "1.0.0",
|
||||
"getos": "^2.8.4",
|
||||
"glob": "^7.0.6",
|
||||
"is-ci": "^1.0.10",
|
||||
"lodash": "^4.16.3",
|
||||
"minimist": "^1.2.0",
|
||||
"progress": "^1.1.8",
|
||||
"ramda": "^0.24.1",
|
||||
"request": "^2.81.0",
|
||||
"request-progress": "^0.3.1",
|
||||
"getos": "2.8.4",
|
||||
"glob": "7.1.2",
|
||||
"is-ci": "1.0.10",
|
||||
"lodash": "4.17.4",
|
||||
"minimist": "1.2.0",
|
||||
"progress": "1.1.8",
|
||||
"ramda": "0.24.1",
|
||||
"request": "2.81.0",
|
||||
"request-progress": "0.3.1",
|
||||
"tmp": "0.0.31",
|
||||
"url": "^0.11.0",
|
||||
"url": "0.11.0",
|
||||
"xvfb": "cypress-io/node-xvfb#22e3783c31d81ebe64d8c0df491ea00cdc74726a",
|
||||
"yauzl": "^2.8.0"
|
||||
"yauzl": "2.8.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@cypress/releaser": "^0.2.1",
|
||||
|
||||
@@ -20,7 +20,7 @@ describe('exec open', function () {
|
||||
it('calls spawn with correct options', function () {
|
||||
return open.start().then(() => {
|
||||
expect(spawn.start).to.be.calledWith([], {
|
||||
detached: true,
|
||||
detached: false,
|
||||
stdio: ['ignore', 'ignore', 'ignore'],
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user