Skip to content

Commit

Permalink
chore: merge develop into release/13.0.0 (#27336)
Browse files Browse the repository at this point in the history
Co-authored-by: Stokes Player <stokes@cypress.io>
Co-authored-by: Chris Breiding <chrisbreiding@users.noreply.github.com>
Co-authored-by: Jordan <jordan@jpdesigning.com>
Co-authored-by: semantic-release-bot <semantic-release-bot@martynus.net>
Co-authored-by: Matt Henkes <mjhenkes@gmail.com>
Co-authored-by: Chris Breiding <chrisbreiding@gmail.com>
fix: Fix web worker creation within spec frame (#27313)
fix: Handle privileged commands arg mutation (#27282)
fix(webpack-dev-server): add typeRoots to generated tsconfig for angular (#27117)
fix memory import (#27324)
  • Loading branch information
AtofStryker committed Jul 19, 2023
1 parent 773eb8d commit 5d1e07a
Show file tree
Hide file tree
Showing 22 changed files with 125 additions and 158 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.

06-07-23
07-19-23
38 changes: 26 additions & 12 deletions .circleci/workflows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,8 @@ executors:
environment:
PLATFORM: windows

# see https://circleci.com/docs/configuration-reference/#macos-execution-environment
darwin-arm64: &darwin-arm64-executor
macos:
xcode: "14.2.0"
resource_class: macos.m1.large.gen1
machine: true
environment:
PLATFORM: darwin

Expand Down Expand Up @@ -429,7 +426,7 @@ commands:
node_version=$(cat .node-version)
source ./scripts/ensure-node.sh
echo "Installing Yarn"
npm install yarn -g # ensure yarn is installed with the correct node engine
npm install yarn --location=global # ensure yarn is installed with the correct node engine
yarn check-node-version
- run:
name: Check Node
Expand Down Expand Up @@ -1355,7 +1352,13 @@ jobs:
steps:
- restore_cached_workspace
- restore_cached_system_tests_deps
# TODO: Remove this once we switch off self-hosted M1 runners
- when:
condition:
equal: [ *darwin-arm64-executor, << parameters.executor >> ]
steps:
- run: rm -f /tmp/cypress/junit/*
- unless:
condition:
or:
- equal: [ *linux-arm64-executor, << parameters.executor >> ] # TODO: Figure out how to support linux-arm64 when we get to linux arm64 build: https://github.com/cypress-io/cypress/issues/23557
Expand All @@ -1364,21 +1367,21 @@ jobs:
name: Run v8 integration tests
command: |
source ./scripts/ensure-node.sh
yarn test-integration --scope "'@tooling/packherd'"
yarn test-integration --scope "'@tooling/{packherd,v8-snapshot,electron-mksnapshot}'"
- verify-mocha-results:
expectedResultCount: 1
- unless:
expectedResultCount: 3
- when:
condition:
or:
- equal: [ *linux-arm64-executor, << parameters.executor >> ] # TODO: Figure out how to support linux-arm64 when we get to linux arm64 build: https://github.com/cypress-io/cypress/issues/23557
- equal: [ *linux-arm64-executor, << parameters.executor >> ]
steps:
- run:
name: Run v8 integration tests
command: |
source ./scripts/ensure-node.sh
yarn test-integration --scope "'@tooling/{packherd,v8-snapshot,electron-mksnapshot}'"
yarn test-integration --scope "'@tooling/packherd'"
- verify-mocha-results:
expectedResultCount: 3
expectedResultCount: 1
- store_test_results:
path: /tmp/cypress
- store-npm-logs
Expand Down Expand Up @@ -1514,6 +1517,12 @@ jobs:
parallelism: 1
steps:
- restore_cached_workspace
# TODO: Remove this once we switch off self-hosted M1 runners
- when:
condition:
equal: [ *darwin-arm64-executor, << parameters.executor >> ]
steps:
- run: rm -f /tmp/cypress/junit/*
- run: yarn workspace @packages/server test-unit cloud/environment_spec.ts
- verify-mocha-results:
expectedResultCount: 1
Expand Down Expand Up @@ -2852,11 +2861,13 @@ darwin-arm64-workflow: &darwin-arm64-workflow
- node_modules_install:
name: darwin-arm64-node-modules-install
executor: darwin-arm64
resource_class: cypress-io/m1-macstadium
only-cache-for-root-user: true

- build:
name: darwin-arm64-build
executor: darwin-arm64
resource_class: cypress-io/m1-macstadium
requires:
- darwin-arm64-node-modules-install

Expand All @@ -2868,23 +2879,26 @@ darwin-arm64-workflow: &darwin-arm64-workflow
- test-runner:commit-status-checks
- test-runner:build-binary
executor: darwin-arm64
resource_class: large
resource_class: cypress-io/m1-macstadium
requires:
- darwin-arm64-build

- v8-integration-tests:
name: darwin-arm64-v8-integration-tests
executor: darwin-arm64
resource_class: cypress-io/m1-macstadium
requires:
- darwin-arm64-build
- driver-integration-memory-tests:
name: darwin-arm64-driver-integration-memory-tests
executor: darwin-arm64
resource_class: cypress-io/m1-macstadium
requires:
- darwin-arm64-build
- server-unit-tests-cloud-environment:
name: darwin-arm64-server-unit-tests-cloud-environment
executor: darwin-arm64
resource_class: cypress-io/m1-macstadium
requires:
- darwin-arm64-build

Expand Down
2 changes: 2 additions & 0 deletions cli/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ _Released 07/18/2023 (PENDING)_

**Bugfixes:**

- Fixed an issue where commands would fail with the error `must only be invoked from the spec file or support file` if their arguments were mutated. Fixes [#27200](https://github.com/cypress-io/cypress/issues/27200).
- Fixed an issue where `cy.writeFile()` would erroneously fail with the error `cy.writeFile() must only be invoked from the spec file or support file`. Fixes [#27097](https://github.com/cypress-io/cypress/issues/27097).
- Fixed an issue where web workers could not be created within a spec. Fixes [#27298](https://github.com/cypress-io/cypress/issues/27298).

## 12.17.1

Expand Down
7 changes: 7 additions & 0 deletions npm/webpack-dev-server/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# [@cypress/webpack-dev-server-v3.5.1](https://github.com/cypress-io/cypress/compare/@cypress/webpack-dev-server-v3.5.0...@cypress/webpack-dev-server-v3.5.1) (2023-07-18)


### Bug Fixes

* **webpack-dev-server:** add typeRoots to generated tsconfig for angular ([#27117](https://github.com/cypress-io/cypress/issues/27117)) ([376795f](https://github.com/cypress-io/cypress/commit/376795f125054c4a70cb1a9b75b01c1a42cccf93))

# [@cypress/webpack-dev-server-v3.5.0](https://github.com/cypress-io/cypress/compare/@cypress/webpack-dev-server-v3.4.1...@cypress/webpack-dev-server-v3.5.0) (2023-06-26)


Expand Down
10 changes: 7 additions & 3 deletions npm/webpack-dev-server/src/helpers/angularHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,19 +136,23 @@ export async function generateTsConfig (devServerConfig: AngularWebpackDevServer
includePaths.push(...polyfills.map((p: string) => getProjectFilePath(workspaceRoot, p)))
}

const cypressTypes = getProjectFilePath(workspaceRoot, 'node_modules', 'cypress', 'types', 'index.d.ts')
const typeRoots = [
getProjectFilePath(workspaceRoot, 'node_modules'),
]

includePaths.push(cypressTypes)
const types = ['cypress']

const tsConfigContent = JSON.stringify({
extends: getProjectFilePath(projectRoot, buildOptions.tsConfig ?? 'tsconfig.json'),
compilerOptions: {
outDir: getProjectFilePath(projectRoot, 'out-tsc/cy'),
allowSyntheticDefaultImports: true,
skipLibCheck: true,
types,
typeRoots,
},
include: includePaths,
})
}, null, 2)

const tsConfigPath = path.join(await getTempDir(), 'tsconfig.json')

Expand Down
35 changes: 12 additions & 23 deletions npm/webpack-dev-server/test/handlers/angularHandler.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,29 +19,24 @@ import '../support'
import { scaffoldMigrationProject } from '../test-helpers/scaffoldProject'

chai.use(chaiPromise)

describe('angularHandler', function () {
this.timeout(1000 * 60)

it('sources the config from angular-13', async () => {
const projectRoot = await scaffoldMigrationProject('angular-13')

process.chdir(projectRoot)

const devServerConfig = {
cypressConfig: {
projectRoot,
specPattern: 'src/**/*.cy.ts',
} as Cypress.PluginConfigOptions,
framework: 'angular',
} as AngularWebpackDevServerConfig

const { frameworkConfig: webpackConfig, sourceWebpackModulesResult } = await angularHandler(devServerConfig)

expect(webpackConfig).to.exist
expect((webpackConfig?.entry as any).main).to.be.undefined
expect(sourceWebpackModulesResult.framework?.importPath).to.include(path.join('@angular-devkit', 'build-angular'))

const { buildOptions } = await expectNormalizeProjectConfig(projectRoot)

await expectLoadsAngularJson(projectRoot)
Expand All @@ -54,21 +49,18 @@ describe('angularHandler', function () {
const projectRoot = await scaffoldMigrationProject('angular-14')

process.chdir(projectRoot)

const devServerConfig = {
cypressConfig: {
projectRoot,
specPattern: 'src/**/*.cy.ts',
} as Cypress.PluginConfigOptions,
framework: 'angular',
} as AngularWebpackDevServerConfig

const { frameworkConfig: webpackConfig, sourceWebpackModulesResult } = await angularHandler(devServerConfig)

expect(webpackConfig).to.exist
expect((webpackConfig?.entry as any).main).to.be.undefined
expect(sourceWebpackModulesResult.framework?.importPath).to.include(path.join('@angular-devkit', 'build-angular'))

const { buildOptions } = await expectNormalizeProjectConfig(projectRoot)

await expectLoadsAngularJson(projectRoot)
Expand All @@ -81,21 +73,18 @@ describe('angularHandler', function () {
const projectRoot = await scaffoldMigrationProject('angular-15')

process.chdir(projectRoot)

const devServerConfig = {
cypressConfig: {
projectRoot,
specPattern: 'src/**/*.cy.ts',
} as Cypress.PluginConfigOptions,
framework: 'angular',
} as AngularWebpackDevServerConfig

const { frameworkConfig: webpackConfig, sourceWebpackModulesResult } = await angularHandler(devServerConfig)

expect(webpackConfig).to.exist
expect((webpackConfig?.entry as any).main).to.be.undefined
expect(sourceWebpackModulesResult.framework?.importPath).to.include(path.join('@angular-devkit', 'build-angular'))

const { buildOptions } = await expectNormalizeProjectConfig(projectRoot)

await expectLoadsAngularJson(projectRoot)
Expand Down Expand Up @@ -129,7 +118,6 @@ describe('angularHandler', function () {
const projectRoot = await scaffoldMigrationProject('angular-custom-config')

process.chdir(projectRoot)

const devServerConfig = {
framework: 'angular',
cypressConfig: {
Expand All @@ -140,13 +128,11 @@ describe('angularHandler', function () {
projectConfig: customProjectConfig,
},
} as unknown as AngularWebpackDevServerConfig

const { frameworkConfig: webpackConfig, sourceWebpackModulesResult } = await angularHandler(devServerConfig)

expect(webpackConfig).to.exist
expect((webpackConfig?.entry as any).main).to.be.undefined
expect(sourceWebpackModulesResult.framework?.importPath).to.include(path.join('@angular-devkit', 'build-angular'))

await expectLoadsAngularJson(projectRoot)
await expectLoadsAngularCLiModules(projectRoot)
await expectGeneratesTsConfig(devServerConfig, customProjectConfig.buildOptions)
Expand Down Expand Up @@ -181,28 +167,22 @@ const expectNormalizeProjectConfig = async (projectRoot: string) => {

return projectConfig
}

const expectLoadsAngularJson = async (projectRoot: string) => {
const angularJson = await getAngularJson(projectRoot)

expect(angularJson).to.not.be.null

await expect(getAngularJson(path.join('..', projectRoot))).to.be.rejected
}

const expectLoadsAngularCLiModules = async (projectRoot: string) => {
const angularCliModules = await getAngularCliModules(projectRoot)

expect(angularCliModules.generateBrowserWebpackConfigFromContext).to.not.be.null
expect(angularCliModules.getStylesConfig).to.not.be.null
expect(angularCliModules.getCommonConfig).to.not.be.null

await expect(getAngularCliModules(path.join('..', projectRoot))).to.be.rejected
}

const expectLoadsAngularBuildOptions = (buildOptions: BuildOptions) => {
const tsConfig = 'tsconfig.cypress.json'

let finalBuildOptions = getAngularBuildOptions(buildOptions, tsConfig)

expect(finalBuildOptions.aot).to.be.false
Expand All @@ -211,7 +191,6 @@ const expectLoadsAngularBuildOptions = (buildOptions: BuildOptions) => {
expect(finalBuildOptions.outputHashing).to.equal('none')
expect(finalBuildOptions.budgets).to.be.undefined
}

const expectGeneratesTsConfig = async (devServerConfig: AngularWebpackDevServerConfig, buildOptions: any) => {
const { projectRoot } = devServerConfig.cypressConfig
let tsConfigPath = await generateTsConfig(devServerConfig, buildOptions)
Expand All @@ -228,11 +207,16 @@ const expectGeneratesTsConfig = async (devServerConfig: AngularWebpackDevServerC
outDir: toPosix(path.join(projectRoot, 'out-tsc/cy')),
allowSyntheticDefaultImports: true,
skipLibCheck: true,
typeRoots: [
toPosix(path.join(projectRoot, 'node_modules')),
],
types: [
'cypress',
],
},
include: [
toPosix(path.join(projectRoot, 'src/**/*.cy.ts')),
toPosix(path.join(projectRoot, 'src/polyfills.ts')),
toPosix(path.join(projectRoot, 'node_modules/cypress/types/index.d.ts')),
],
})

Expand All @@ -256,11 +240,16 @@ const expectGeneratesTsConfig = async (devServerConfig: AngularWebpackDevServerC
outDir: toPosix(path.join(projectRoot, 'out-tsc/cy')),
allowSyntheticDefaultImports: true,
skipLibCheck: true,
typeRoots: [
toPosix(path.join(projectRoot, 'node_modules')),
],
types: [
'cypress',
],
},
include: [
toPosix(path.join(projectRoot, 'src/**/*.cy.ts')),
toPosix(supportFile),
toPosix(path.join(projectRoot, 'node_modules/cypress/types/index.d.ts')),
],
})
}
4 changes: 2 additions & 2 deletions packages/driver/cypress/e2e/commands/exec.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ describe('src/cy/commands/exec', () => {

cy.exec('ls').then(() => {
expect(Cypress.backend).to.be.calledWith('run:privileged', {
args: ['8374177128052794'],
commandName: 'exec',
userArgs: ['8374177128052794'],
options: {
cmd: 'ls',
timeout: 2500,
Expand All @@ -33,8 +33,8 @@ describe('src/cy/commands/exec', () => {

cy.exec('ls', { env: { FOO: 'foo' } }).then(() => {
expect(Cypress.backend).to.be.calledWith('run:privileged', {
args: ['8374177128052794', '6419589148408857'],
commandName: 'exec',
userArgs: ['8374177128052794', '6419589148408857'],
options: {
cmd: 'ls',
timeout: 2500,
Expand Down

5 comments on commit 5d1e07a

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 5d1e07a Jul 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the linux arm64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/13.0.0/linux-arm64/release/13.0.0-5d1e07a7aa228745b5e742aa3e912fcbd4cb217f/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 5d1e07a Jul 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the linux x64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/13.0.0/linux-x64/release/13.0.0-5d1e07a7aa228745b5e742aa3e912fcbd4cb217f/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 5d1e07a Jul 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the darwin arm64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/13.0.0/darwin-arm64/release/13.0.0-5d1e07a7aa228745b5e742aa3e912fcbd4cb217f/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 5d1e07a Jul 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the darwin x64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/13.0.0/darwin-x64/release/13.0.0-5d1e07a7aa228745b5e742aa3e912fcbd4cb217f/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 5d1e07a Jul 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the win32 x64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/13.0.0/win32-x64/release/13.0.0-5d1e07a7aa228745b5e742aa3e912fcbd4cb217f/cypress.tgz

Please sign in to comment.