Skip to content

Commit

Permalink
Merge branch 'feat/protocol' into tgriesser/feat/protocol-delivery
Browse files Browse the repository at this point in the history
* feat/protocol:
  refactor: migrate from windi to tailwind (#26516)
  chore: update v8 generation vars so that from scratch depends implies updating the metafile (#26472)
  chore: Update Vite to 4.3.0 (#26553)
  fix: unify cdp approach to fix devtools in electron (#26573)
  dependency(deps): update dependency deps-ok to v1.4.1 🌟 (#26612)
  chore: update 12.11.0 release date (#26587)
  chore: 12.11.0 release (#26582)
  chore: implement experimental ESM stub/spy for Vite (#26536)
  chore: try triggering mouseleave on buttons to ensure that tooltips aren't showing (#26524)
  chore: add support for Angular 16 (#26052)
  chore: upgrade Vue to 3.2.47 (#26555)
  chore: Update v8 snapshot cache (#26537)
  chore: add missing utm parameters for cloud links to Debug page (#26556)
  chore: update stalebot to respect new labels and up process rate (#26552)
  fix: don't display run passing status if Cloud org is over run limit (#26533)
  chore: update vm2 to 3.9.17 (#26534)
  feat: display a limit warning on the run navigation component when there are 100 total runs (#26523)
  chore: Update v8 snapshot cache (#26476)
  chore: upgrade vm2 (#26495)
  fix: Treat Video compression 0 as false.  (#26503)
  • Loading branch information
tgriesser committed May 3, 2023
2 parents 770e200 + a21798d commit 49b090f
Show file tree
Hide file tree
Showing 505 changed files with 11,393 additions and 5,841 deletions.
2 changes: 1 addition & 1 deletion .circleci/cache-version.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Bump this version to force CI to re-create the cache from scratch.

12-12-22
04-19-22
2 changes: 0 additions & 2 deletions .circleci/workflows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -612,8 +612,6 @@ commands:
fi
- store_test_results:
path: /tmp/cypress
- store_artifacts:
path: ./packages/<<parameters.package>>/cypress/videos
- store-npm-logs

run-system-tests:
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/stale_issues_and_pr_cleanup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ on:
exempt-issue-labels:
description: 'exempt-issue-labels'
required: false
default: 'type: feature,type: enhancement,routed-to-e2e,routed-to-ct,routed-to-tools,routed-to-cloud,Popular Issue'
default: 'type: feature,type: enhancement,routed-to-e2e,routed-to-ct,routed-to-tools,routed-to-cloud,prevent-stale,triaged'
exempt-pr-labels:
description: 'exempt-pr-labels'
required: false
default: 'type: feature,type: enhancement,Popular Issue'
default: 'type: feature,type: enhancement,prevent-stale,triaged'
schedule:
- cron: '30 1 * * *'
permissions:
Expand All @@ -31,8 +31,8 @@ env:
DEFAULT_DEBUG_ONLY: true
DEFAULT_DAYS_BEFORE_STALE: 180
DEFAULT_DAYS_BEFORE_CLOSE: 14
DEFAULT_EXEMPT_ISSUE_LABELS: 'type: feature,type: enhancement,routed-to-e2e,routed-to-ct,routed-to-tools,routed-to-cloud,Popular Issue,prevent-stale'
DEFAULT_EXEMPT_PR_LABELS: 'type: feature,type: enhancement,Popular Issue,prevent-stale'
DEFAULT_EXEMPT_ISSUE_LABELS: 'type: feature,type: enhancement,routed-to-e2e,routed-to-ct,routed-to-tools,routed-to-cloud,prevent-stale,triaged'
DEFAULT_EXEMPT_PR_LABELS: 'type: feature,type: enhancement,prevent-stale,triaged'
jobs:
stale:
runs-on: ubuntu-latest
Expand All @@ -50,5 +50,5 @@ jobs:
exempt-issue-labels: ${{ github.event.inputs.exempt-issue-labels || env.DEFAULT_EXEMPT_ISSUE_LABELS }}
exempt-pr-labels: ${{ github.event.inputs.exempt-pr-labels || env.DEFAULT_EXEMPT_PR_LABELS }}
exempt-all-milestones: true
operations-per-run: 200 #keeping this a bit higher because it processes newest tickets to oldest
operations-per-run: 400 #keeping this a bit higher because it processes newest tickets to oldest
debug-only: ${{ github.event.inputs.debug-only || env.DEFAULT_DEBUG_ONLY }}
3 changes: 1 addition & 2 deletions .vscode/cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@
"viewports",
"vite",
"vitejs",
"vueuse",
"Windi"
"vueuse"
],
"ignoreWords": [],
"import": []
Expand Down
6 changes: 3 additions & 3 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
// Description: Adds syntax highlighting for all gql tags.
"apollographql.vscode-apollo",

// Name: WindiCSS Intellisense
// Description: Automatically sorts your WindiCSS classes.
"voorjaar.windicss-intellisense",
// Name: TailwindCSS Intellisense
// Description: Automatically sorts your TailwindCSS classes.
"bradlc.vscode-tailwindcss",

// Name: Volar
// Description: Language server for Vue. Required for any syntax highlighting in Vue files.
Expand Down
3 changes: 0 additions & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@
},
"typescript.tsdk": "node_modules/typescript/lib",

// A flag that controls whether or not Windi CSS classes will be sorted on save on save.
"windicss.sortOnSave": true,

// Support autocompletion and preview of strings.
// Additionally, support extraction of hardcoded strings into key-values.
"i18n-ally.localesPaths": "packages/frontend-shared/src/locales",
Expand Down
30 changes: 28 additions & 2 deletions cli/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,33 @@
<!-- See the ../guides/writing-the-cypress-changelog.md for details on writing the changelog. -->
## 12.10.1
## 12.11.1

_Released 04/25/2023 (PENDING)_
_Released 05/09/2023 (PENDING)_

**Bugfixes:**

- Fixed an issue in Electron where devtools gets out of sync with the DOM occasionally. Addresses [#15932](https://github.com/cypress-io/cypress/issues/15932).

## 12.11.0

_Released 04/26/2023_

**Features:**

- Adds Component Testing support for Angular 16. Addresses [#26044](https://github.com/cypress-io/cypress/issues/26044).
- The run navigation component on the [Debug page](https://on.cypress.io/debug-page) will now display a warning message if there are more relevant runs than can be displayed in the list. Addresses [#26288](https://github.com/cypress-io/cypress/issues/26288).

**Bugfixes:**

- Fixed an issue where setting `videoCompression` to `0` would cause the video output to be broken. `0` is now treated as false. Addresses [#5191](https://github.com/cypress-io/cypress/issues/5191) and [#24595](https://github.com/cypress-io/cypress/issues/24595).
- Fixed an issue on the [Debug page](https://on.cypress.io/debug-page) where the passing run status would appear even if the Cypress Cloud organization was over its monthly test result limit. Addresses [#26528](https://github.com/cypress-io/cypress/issues/26528).

**Misc:**

- Cleaned up our open telemetry dependencies, reducing the size of the open telemetry modules. Addressed in [#26522](https://github.com/cypress-io/cypress/pull/26522).

**Dependency Updates:**

- Upgraded [`vue`](https://www.npmjs.com/package/vue) from `3.2.31` to `3.2.47`. Addressed in [#26555](https://github.com/cypress-io/cypress/pull/26555).

**Features:**

Expand Down
6 changes: 3 additions & 3 deletions npm/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"devDependencies": {
"@cypress/mount-utils": "0.0.0-development",
"@types/semver": "7.3.9",
"@vitejs/plugin-react": "1.3.1",
"@vitejs/plugin-react": "4.0.0",
"axios": "0.21.2",
"cypress": "0.0.0-development",
"prop-types": "15.7.2",
Expand All @@ -28,8 +28,8 @@
"react-router-dom": "6.0.0-alpha.1",
"semver": "^7.3.2",
"typescript": "^4.7.4",
"vite": "4.1.4",
"vite-plugin-require-transform": "1.0.3"
"vite": "4.3.2",
"vite-plugin-require-transform": "1.0.12"
},
"peerDependencies": {
"@types/react": "^16.9.16 || ^17.0.0",
Expand Down
4 changes: 2 additions & 2 deletions npm/vite-dev-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
"mocha": "^9.2.2",
"sinon": "^13.0.1",
"ts-node": "^10.9.1",
"vite": "4.1.4",
"vite-plugin-inspect": "0.4.3"
"vite": "4.3.2",
"vite-plugin-inspect": "0.7.24"
},
"files": [
"dist",
Expand Down
6 changes: 5 additions & 1 deletion npm/vite-dev-server/src/resolveConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,11 @@ function makeCypressViteConfig (config: ViteDevServerConfig, vite: Vite): Inline
paths: [projectRoot],
})))

const viteConfig: InlineConfig = {
// Our Vite typings do not have the 'incremental' field since it was removed in 4.2, but users' version
// of Vite may be older and we want to use it if it's there
type Vite_4_1_Config = { optimizeDeps: { esbuildOptions: { incremental?: boolean } } }

const viteConfig: InlineConfig & Vite_4_1_Config = {
root: projectRoot,
base: `${devServerPublicPathRoute}/`,
optimizeDeps: {
Expand Down
5 changes: 5 additions & 0 deletions npm/vite-plugin-cypress-esm/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
**/dist
**/*.d.ts
**/package-lock.json
**/tsconfig.json
**/cypress/fixtures
32 changes: 32 additions & 0 deletions npm/vite-plugin-cypress-esm/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"plugins": [
"cypress",
"@cypress/dev"
],
"extends": [
"plugin:@cypress/dev/general",
"plugin:@cypress/dev/tests",
"plugin:@cypress/dev/react"
],
"parser": "vue-eslint-parser",
"parserOptions": {
"parser": "@typescript-eslint/parser"
},
"env": {
"cypress/globals": true
},
"rules": {
"no-console": "off",
"mocha/no-global-tests": "off",
"react/jsx-filename-extension": [
"warn",
{
"extensions": [
".js",
".jsx",
".tsx"
]
}
]
}
}
1 change: 1 addition & 0 deletions npm/vite-plugin-cypress-esm/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cypress/videos/*
Empty file.
123 changes: 123 additions & 0 deletions npm/vite-plugin-cypress-esm/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
# @cypress/vite-plugin-cypress-esm

A Vite plugin that intercepts and rewrites ES module imports within [Cypress component tests](https://docs.cypress.io/guides/component-testing/overview). The [ESM specification](https://tc39.es/ecma262/#sec-modules) generates modules that are "sealed", requiring the runtime (the browser) to prevent any alteration to the module namespace. While this has security and performance benefits, it prevents use of mocking libraries which would need to replace namespace members. This plugin wraps modules in a special [`Proxy`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy) implementation, allowing for instrumentation by libraries such as Sinon.

> **Note:** This package is a pre-release alpha and is not yet stable. There are likely to be bugs and edge cases. Please report any bugs [here](https://github.com/cypress-io/cypress/issues/new?labels=npm:%20@cypress/vite-plugin-cypress-esm). [Learn more about Cypress release stages](https://docs.cypress.io/guides/references/release-stages#Alpha) and expectations around stability.
## Debugging

Run Cypress with `DEBUG=cypress:vite-plugin-cypress-esm`. You will get logs in the terminal, for the code transformation, and in the browser console, for intercepting and wrapping the modules in a Proxy.
## Compatibility

| @cypress/vite-plugin-mock-esm | cypress |
| ------------------------ | ------- |
| >= v1 | >= v12 |

## Usage

This plugin rewrites the ES modules served by Vite to make them mutable and therefore compatible with methods like [`cy.spy()`](https://docs.cypress.io/api/commands/spy) and [`cy.stub()`](https://docs.cypress.io/api/commands/stub) that require modifying otherwise-sealed objects. Since this is a testing-specific plugin it is recommended to apply it your Vite config only when running your Cypress tests. One way to do so would be in `cypress.config`:

```ts
import { defineConfig } from 'cypress'
import viteConfig from './vite.config'
import { mergeConfig } from 'vite'
import { CypressEsm } from '@cypress/vite-plugin-cypress-esm'

export default defineConfig({
component: {
devServer: {
bundler: 'vite',
framework: 'react',
viteConfig: () => {
return mergeConfig(
viteConfig,
{
plugins: [
CypressEsm(),
]
}
),
}
},
}
})
```

### `ignoreList`

Some modules may be incompatible with Proxy-based implementation. The eventual goal is to support wrapping all modules in a Proxy to better facilitate testing. For now, if you run into any issues with a particular module, you can add it to the `ignoreList` like so:

```ts
CypressEsm({
ignoreList: ['react-router', 'react-router-dom']
})
```

You can also use a glob, which uses [`picomatch`](https://github.com/micromatch/picomatch) internally:

```ts
CypressEsm({
ignoreList: ['*react*']
})
```

React is known to have some conflicts with the Proxy implementation that cause problems stubbing internal React functionality. Since it is unlikely you want to stub parts of React itself, it's a good idea to add it to the `ignoreList`.

## Known Issues

### Import Syntax

All known [import syntax](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import) is supported, however there may edge cases that have not been identified.

### Regular Expression matching

This module uses Regular Expression matching to transform the modules on the server to facilitate wrapping them in a `Proxy` on the client. In future updates, a more robust AST-based approach will be explored. A limitation of the current approach is that it does not recognize syntax from actual code vs content found within strings (for instance, an error string that contains example code syntax). This can result in inappropriately modified string constants.

### Auto-hosting

ESM imports are automatically hoisted to the top of a given module so they happen first before any code that references them. This plugin does not currently perform any hoisting, so imports are transformed to variable references in place. If you have code that attempts to reference an imported value prior to that import it will likely break. This is a known issue with HMR logic in Svelte projects, and will typically present as a "use before define" error.

### Self-references and internal calls

This plugin works by intercepting calls coming *in* to a module. This will not work for situations where a module attempts to make *internal* calls to a function within the same module or directly compare against a function within the same module. Eg:

```js
// mod_1.js
export function foo () {
// ...
}

export function bar (mod) {
return mod === foo
}

// mod_2.js
import { foo, bar } from './mod_1.js'

bar(foo) //=> false
```

In this example, `bar(foo)` is passing a reference to `mod_1.foo`, where `mod_1` is a module wrapped in a `Proxy`. In the original `mod_1.js`, the reference to `foo` is the original, unwrapped `foo`, so the comparison return `false`. This may cause issues in some libraries, such as React Router when lazy loading routes. You can add modules to `ignoreList` to work around this issue.

### Sinon compatibility

This plugin is designed to work with [Sinon](https://sinonjs.org/) since that is what Cypress uses internally for `cy.stub` and `cy.spy` - attempting to utilize other stubbing/mocking libraries or directly mutating modules is not a supported use case and will likely not work as expected.

## Troubleshooting

This is an **_Alpha_** release, meaning there a very likely bugs in the implementation and it is expected that you will encounter issues. We appreciate any bug reports once you have performed the troubleshooting process below.

If you encounter issues:
1. Ensure you're using the very latest version of this Plugin and Cypress
2. Try temporarily removing this plugin from your test's Vite config - if the issue is still present then it is not related to this plugin.
3. Verify you have not encountered one of the [Known Issues](#known-issues)
3. If the issue disappeared then try narrowing down if it's related to a specific module/dependency by using the `ignoreList` config
4. If your problem isn't related to a specific dependency and can't be isolated please file a bug report [here](https://github.com/cypress-io/cypress/issues/new?labels=npm:%20@cypress/vite-plugin-cypress-esm). A reproduction case project is extremely helpful to track down specific issues, and capturing [Debug Logs](#debugging) from both your terminal *and* the browser devtools console is very helpful.

## License

[![license](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/cypress-io/cypress/blob/develop/LICENSE)

This project is licensed under the terms of the [MIT license](/LICENSE).

## [Changelog](./CHANGELOG.md)
Loading

0 comments on commit 49b090f

Please sign in to comment.