Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into retry-flake
Browse files Browse the repository at this point in the history
  • Loading branch information
flotwig committed Dec 5, 2022
2 parents 01dc60b + 101407a commit 762105a
Show file tree
Hide file tree
Showing 437 changed files with 13,257 additions and 18,183 deletions.
2 changes: 1 addition & 1 deletion .circleci/cache-version.txt
@@ -1,3 +1,3 @@
# Bump this version to force CI to re-create the cache from scratch.

10-31-22
12-01-22
2,928 changes: 48 additions & 2,880 deletions .circleci/config.yml

Large diffs are not rendered by default.

2,829 changes: 2,829 additions & 0 deletions .circleci/workflows.yml

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions .eslintrc.js
Expand Up @@ -34,6 +34,12 @@ module.exports = {
'plugin:@cypress/dev/tests',
],
parser: '@typescript-eslint/parser',
ignorePatterns: [
// cli types are checked by dtslint
'cli/types/**',
// these fixtures are supposed to fail linting
'npm/eslint-plugin-dev/test/fixtures/**',
],
overrides: [
{
files: [
Expand Down
2 changes: 2 additions & 0 deletions .gitattributes
Expand Up @@ -2,4 +2,6 @@

*.json text eol=lf

**/.eslintrc text eol=lf

packages/errors/__snapshot-html__/** linguist-generated=true
47 changes: 47 additions & 0 deletions .github/workflows/trigger_circleci.yml
@@ -0,0 +1,47 @@
name: "Trigger CircleCi Pipeline"

on:
pull_request_target:
types:
- opened
- ready_for_review

jobs:
main:
name: Trigger CircleCi Pipeline when PR is ready for review
runs-on: ubuntu-latest
steps:
- if: ${{ github.event.pull_request.draft == false }}
shell: bash
env:
CIRCLE_TOKEN: ${{ secrets.CIRCLE_TOKEN }}
BASE_ORG_AND_REPO: ${{ github.event.pull_request.head.full_name }}
PULL_ID: ${{ github.event.pull_request.number }}
run: |
if [[ "${CIRCLE_TOKEN}" == "" ]]; then
echo "The CIRCLE_TOKEN is unset. Cannot trigger pipeline..."
exit 1;
fi
BRANCH="$GITHUB_HEAD_REF"
if [[ "$BASE_ORG_AND_REPO" != "cypress-io/cypress" ]]; then
echo "Triggering CircleCi pipeline for outside contributor."
BRANCH="pull/$PULL_ID/head"
fi
echo "Triggering CircleCi pipeline for $BRANCH"
response=$(curl -X POST https://circleci.com/api/v2/project/github/cypress-io/cypress/pipeline \
--header "Circle-Token:$CIRCLE_TOKEN" \
--header "content-type:application/json" \
--data "{\"branch\":\"$BRANCH\"}" \
--silent
)
echo "$response"
if [ "$(jq 'has("message")' <<< $response )" == "true" ]; then
echo "Error triggering pipeline..."
exit 1;
fi
10 changes: 10 additions & 0 deletions .github/workflows/update_v8_snapshot_cache.yml
@@ -0,0 +1,10 @@
name: Update V8 Snapshot Cache
on: [workflow_dispatch]
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
jobs:
update-v8-snapshot-cache:
steps:
- name: Dummy step
run: echo "Dummy step"
28 changes: 18 additions & 10 deletions CONTRIBUTING.md
Expand Up @@ -112,9 +112,9 @@ video | Problems with video recordings | [open](https://github.com/cypress-io/cy


## Writing Documentation

Cypress documentation lives in a separate repository with its own dependencies and build tools.
See [Documentation Contributing Guideline](https://github.com/cypress-io/cypress-documentation/blob/master/CONTRIBUTING.md).
See [Documentation Contributing Guidelines](https://github.com/cypress-io/cypress-documentation/blob/master/CONTRIBUTING.md).

## Writing code

Expand Down Expand Up @@ -164,7 +164,7 @@ Here is a list of the core packages in this repository with a short description,
| [ts](./packages/ts) | `@packages/ts` | A centralized version of typescript. |
| [types](./packages/types) | `@packages/types` | The shared internal Cypress types. |
| [v8-snapshot-require](./packages/v8-snapshot-require) | `@packages/v8-snapshot-requie` | Tool to load a snapshot for Electron applications that was created by `@tooling/v8-snapshot`. |
| [web-config](./packages/web-config) | `@packages/ui-components` | The web-related configuration. |
| [web-config](./packages/web-config) | `@packages/web-config` | The web-related configuration. |

Private packages involved in development of the app live within the [`tooling`](./tooling) directory and are in the `@tooling/` namespace. They are discrete modules with different responsibilities, but each is necessary for development of the Cypress app and is not necessarily useful outside of the Cypress app.

Expand Down Expand Up @@ -358,7 +358,7 @@ This is to ensure that links do not go dead in older versions of Cypress when th

### Tests

For most packages there are typically unit and integration tests.
For most packages there are typically unit and integration tests. For UI packages there are E2E and component tests.

Please refer to each packages' `README.md` which documents how to run tests. It is not feasible to try to run all of the tests together. We run our entire test fleet across over a dozen containers in CI.

Expand Down Expand Up @@ -488,29 +488,37 @@ We do not continuously deploy the Cypress binary, so `develop` contains all of t
- When opening a PR for a specific issue already open, please name the branch you are working on using the convention `issue-[issue number]`. For example, if your PR fixes Issue #803, name your branch `issue-803`. If the PR is a larger issue, you can add more context like `issue-803-new-scrollable-area`. If there's not an associated open issue, **[create an issue](https://github.com/cypress-io/cypress/issues/new/choose)**.
- PRs can be opened before all the work is finished. In fact we encourage this! Please create a [Draft Pull Request](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/about-pull-requests#draft-pull-requests) if your PR is not ready for review. [Mark the PR as **Ready for Review**](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/changing-the-stage-of-a-pull-request#marking-a-pull-request-as-ready-for-review) when you're ready for a Cypress team member to review the PR.
- Prefix the title of the Pull Request using [semantic-release](https://github.com/semantic-release/semantic-release)'s format as defined [here](https://github.com/angular/angular.js/blob/master/DEVELOPERS.md#type). For example, if your PR is fixing a bug, you should prefix the PR title with `fix:`.
- Fill out the [Pull Request Template](./.github/PULL_REQUEST_TEMPLATE.md) completely within the body of the PR. If you feel some areas are not relevant add `N/A` as opposed to deleting those sections. PR's will not be reviewed if this template is not filled in.
- Fill out the [Pull Request Template](./.github/PULL_REQUEST_TEMPLATE.md) completely within the body of the PR. If you feel some areas are not relevant add `N/A` as opposed to deleting those sections. PRs will not be reviewed if this template is not filled in.
- If the PR is a user facing change and you're a Cypress team member that has logged into [ZenHub](https://www.zenhub.com/) and downloaded the [ZenHub for GitHub extension](https://www.zenhub.com/extension), set the release the PR is intended to ship in from the sidebar of the PR. Follow semantic versioning to select the intended release. This is used to generate the changelog for the release. If you don't tag a PR for release, it won't be mentioned in the changelog.
![Select release for PR](https://user-images.githubusercontent.com/1271364/135139641-657015d6-2dca-42d4-a4fb-16478f61d63f.png)
- Please check the "Allow edits from maintainers" checkbox when submitting your PR. This will make it easier for the maintainers to make minor adjustments, to help with tests or any other changes we may need.
![Allow edits from maintainers checkbox](https://user-images.githubusercontent.com/1271181/31393427-b3105d44-ada9-11e7-80f2-0dac51e3919e.png)
- All Pull Requests require a minimum of **two** approvals.
- After the PR is approved, the original contributor can merge the PR (if the original contributor has access).
- When you merge a PR into `develop`, select [**Squash and merge**](https://docs.github.com/en/github/collaborating-with-pull-requests/incorporating-changes-from-a-pull-request/about-pull-request-merges#squash-and-merge-your-pull-request-commits). This will squash all commits into a single commit. *The only exception to squashing is when converting files to another language and there is a clear commit history needed to maintain from the file conversion.*
- When you merge a PR into `develop`, select [**Squash and merge**](https://docs.github.com/en/github/collaborating-with-pull-requests/incorporating-changes-from-a-pull-request/about-pull-request-merges#squash-and-merge-your-pull-request-commits). This will squash all commits into a single commit.

*The only exceptions to squashing are:*

1. When converting files to another language and there is a clear commit history needed to maintain from the file conversion.
2. When merging a `release/*` branch to `develop`. Individual PRs were already squashed when they were merged to the release branch, and we want that history intact on develop.

### Write Some Tests

If you are adding a new feature or fixing a regression, ensure you add tests for it. Broadly speaking, there are three categories of tests you might consider:
If you are adding a new feature or fixing a regression, ensure you add tests for it. Broadly speaking, there are four categories of tests you might consider:

1. Unit test. Those are inside of `test/unit`, if the package has them. These are the fastest and cheapest to execute.
2. E2E/Integration tests. Those are inside `cypress/e2e`, if the package has them. These are between Unit Tests and System Tests when it comes to speed of execution.
3. System Tests. Those go in the [`system-tests`](https://github.com/cypress-io/cypress/tree/develop/system-tests) directory. The README explains how they work. These are the slowest to run, so you generally only want to add a system-test if it's absolutely required (but don't let that discourage you; they are also the most realistic way to test Cypress).
1. Unit tests. Those are inside of `test/unit`, if the package has them. These are the fastest and cheapest to execute.
2. Component Tests. These are co-located with components in the `src` directory of UI-related packages. These test individual UI components in isolation. They can exhaustively test all expected variations of a component and are faster than E2E tests.
3. E2E/Integration tests. Those are inside `cypress/e2e`, if the package has them. These are between Unit Tests and System Tests when it comes to speed of execution.
4. System tests. Those go in the [`system-tests`](https://github.com/cypress-io/cypress/tree/develop/system-tests) directory. The README explains how they work. These are the slowest to run, so you generally only want to add a system-test if it's absolutely required (but don't let that discourage you; they are also the most realistic way to test Cypress).

When choosing what's most appropriate, consider:

- ease of understanding
- ease of debugging
- resilience to refactoring

It is also worth considering when a failure will be noticed. A unit or component test is likely to be run while the related code is being modified and provides very fast feedback. E2E tests and System Tests are more likely to only fail in CI since they are slower to run.

### Dependencies

We use [RenovateBot](https://renovatebot.com/) to automatically upgrade our dependencies. The bot uses the settings in [renovate.json](renovate.json) to maintain our [Update Dependencies](https://github.com/cypress-io/cypress/issues/3777) issue and open PRs. You can manually select a package to open a PR from our [Update Dependencies](https://github.com/cypress-io/cypress/issues/3777) issue.
Expand Down
5 changes: 5 additions & 0 deletions cli/lib/util.js
Expand Up @@ -533,6 +533,7 @@ const util = {
la(is.unemptyString(varName), 'expected environment variable name, not', varName)

const configVarName = `npm_config_${varName}`
const configVarNameLower = configVarName.toLowerCase()
const packageConfigVarName = `npm_package_config_${varName}`

let result
Expand All @@ -545,6 +546,10 @@ const util = {
debug(`Using ${varName} from npm config`)

result = process.env[configVarName]
} else if (process.env.hasOwnProperty(configVarNameLower)) {
debug(`Using ${varName.toLowerCase()} from npm config`)

result = process.env[configVarNameLower]
} else if (process.env.hasOwnProperty(packageConfigVarName)) {
debug(`Using ${varName} from package.json config`)

Expand Down
2 changes: 1 addition & 1 deletion cli/package.json
Expand Up @@ -116,7 +116,7 @@
"cypress": "bin/cypress"
},
"engines": {
"node": ">=12.0.0"
"node": "^14.0.0 || ^16.0.0 || >=18.0.0"
},
"types": "types",
"exports": {
Expand Down
5 changes: 5 additions & 0 deletions cli/test/lib/util_spec.js
Expand Up @@ -543,6 +543,11 @@ describe('util', () => {
expect(util.getEnv('CYPRESS_FOO')).to.eql('')
})

it('npm config set should work', () => {
process.env.npm_config_cypress_foo_foo = 'bazz'
expect(util.getEnv('CYPRESS_FOO_FOO')).to.eql('bazz')
})

it('throws on non-string name', () => {
expect(() => {
util.getEnv()
Expand Down
5 changes: 4 additions & 1 deletion cli/types/cypress-npm-api.d.ts
Expand Up @@ -173,7 +173,7 @@ declare namespace CypressCommandLine {
title: string[]
state: string
body: string
/**
/**
* Error string as it's presented in console if the test fails
*/
displayError: string | null
Expand Down Expand Up @@ -229,6 +229,7 @@ declare namespace CypressCommandLine {
startedAt: dateTimeISO
endedAt: dateTimeISO
duration: ms
wallClockDuration?: number
}
/**
* Reporter name like "spec"
Expand Down Expand Up @@ -259,8 +260,10 @@ declare namespace CypressCommandLine {
* resolved filename of the spec
*/
absolute: string
relativeToCommonRoot: string
}
shouldUploadVideo: boolean
skippedSpec: boolean
}

/**
Expand Down

0 comments on commit 762105a

Please sign in to comment.