Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/cache-version.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Bump this version to force CI to re-create the cache from scratch.
9-18-2025-x2
9-22-2025-root-bundle
1 change: 1 addition & 0 deletions .circleci/src/workflows/workflows/@main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ linux-x64:
- equal: [ develop, << pipeline.git.branch >> ]
# use the following branch as well to ensure that v8 snapshot cache updates are fully tested
- equal: [ 'update-v8-snapshot-cache-on-develop', << pipeline.git.branch >> ]
- equal: [ 'chore/bundle_packages', << pipeline.git.branch >> ]
- matches:
pattern: /^release\/\d+\.\d+\.\d+$/
value: << pipeline.git.branch >>
Expand Down
15 changes: 15 additions & 0 deletions .circleci/workflows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3718,6 +3718,9 @@ workflows:
- equal:
- update-v8-snapshot-cache-on-develop
- << pipeline.git.branch >>
- equal:
- chore/bundle_packages
- << pipeline.git.branch >>
- matches:
pattern: /^release\/\d+\.\d+\.\d+$/
value: << pipeline.git.branch >>
Expand Down Expand Up @@ -3772,6 +3775,9 @@ workflows:
- equal:
- update-v8-snapshot-cache-on-develop
- << pipeline.git.branch >>
- equal:
- chore/bundle_packages
- << pipeline.git.branch >>
- matches:
pattern: /^release\/\d+\.\d+\.\d+$/
value: << pipeline.git.branch >>
Expand Down Expand Up @@ -3837,6 +3843,9 @@ workflows:
- equal:
- update-v8-snapshot-cache-on-develop
- << pipeline.git.branch >>
- equal:
- chore/bundle_packages
- << pipeline.git.branch >>
- matches:
pattern: /^release\/\d+\.\d+\.\d+$/
value: << pipeline.git.branch >>
Expand Down Expand Up @@ -4322,6 +4331,9 @@ workflows:
- equal:
- update-v8-snapshot-cache-on-develop
- << pipeline.git.branch >>
- equal:
- chore/bundle_packages
- << pipeline.git.branch >>
- matches:
pattern: /^release\/\d+\.\d+\.\d+$/
value: << pipeline.git.branch >>
Expand Down Expand Up @@ -5157,6 +5169,9 @@ workflows:
- equal:
- update-v8-snapshot-cache-on-develop
- << pipeline.git.branch >>
- equal:
- chore/bundle_packages
- << pipeline.git.branch >>
- matches:
pattern: /^release\/\d+\.\d+\.\d+$/
value: << pipeline.git.branch >>
18 changes: 11 additions & 7 deletions guides/esm-migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
- Unit tests in package are written in TypeScript
- Does not include scripts or system test migrations

#### Notes

When migrating some of these projects away from the `ts-node` entry [see `@packages/scaffold-config` example](https://github.com/cypress-io/cypress/blob/v15.2.0/packages/scaffold-config/index.js), it is somewhat difficult to make separate browser/node entries as the v8-snapshot [tsconfig.json](https://github.com/cypress-io/cypress/blob/v15.2.0/tooling/v8-snapshot/tsconfig.json) is using an older style of module resolution where the `exports` key inside a package's `package.json` is not well supported. Because of this, we need to find ways to bundle code that is needed internally in the browser vs in node without them being a part of the same bundle. This is a temporary work around until we are able to get every package being able to build as an ES Module, which as that point we can re assess how the Cypress binary is being built as well as v8-snapshots, and will allow us to reconfigure this packages to export content in a more proper fashion.

#### Status

##### NPM Packages
Expand All @@ -33,11 +37,11 @@
##### Binary Packages

- [ ] packages/app **PARTIAL** - low priority: frontend package
- [ ] packages/config **PARTIAL** - entry point is JS
- [ ] packages/data-context **PARTIAL** - entry point is JS
- [x] packages/config ✅ **COMPLETED**
- [x] packages/data-context **COMPLETED**
- [x] packages/driver ✅ **COMPLETED** - source complete, cypress tests need migration
- [x] packages/electron ✅ **COMPLETED**
- [ ] packages/error **PARTIAL** - entry point is JS
- [x] packages/error ✅ **COMPLETED**
- [x] packages/eslint-config ✅ **COMPLETED**
- [ ] packages/example
- [ ] packages/extension
Expand All @@ -54,17 +58,17 @@
- [x] packages/packherd-require ✅ **COMPLETED**
- [ ] packages/proxy **PARTIAL** - entry point is JS
- [x] packages/reporter ✅ **COMPLETED**
- [ ] packages/resolve-dist **PARTIAL** - entry point is JS
- [x] packages/resolve-dist ✅ **COMPLETED**
- [ ] packages/rewriter **PARTIAL** - entry point is JS
- [ ] packages/root
- [x] packages/runner ✅ **COMPLETED**
- [ ] packages/scaffold-config **PARTIAL** - entry point is JS
- [x] packages/scaffold-config ✅ **COMPLETED**
- [ ] packages/server **PARTIAL** - many source/test files in JS. highest priority
- [ ] packages/socket **PARTIAL** - entry point is JS. Tests are JS
- [x] packages/stderr-filtering ✅ **COMPLETED**
- [ ] packages/telemetry **PARTIAL** - entry point is JS
- [x] packages/telemetry ✅ **COMPLETED**
- [ ] packages/ts **PARTIAL** - ultimate goal is removal and likely not worth the effort to convert
- [ ] packages/types **PARTIAL** - entry point is JS
- [x] packages/types ✅ **COMPLETED**
- [x] packages/v8-snapshot-require
- [x] packages/web-config

Expand Down
2 changes: 1 addition & 1 deletion packages/app/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import Toast, { POSITION } from 'vue-toastification'
import 'vue-toastification/dist/index.css'
import { createWebsocket } from './runner'
import { getRunnerConfigFromWindow } from './runner/get-runner-config-from-window'
import { telemetry } from '@packages/telemetry/src/browser'
import { telemetry } from '@packages/telemetry/browser/client'

// Grab the time just before loading config to include that in the cypress:app span
const now = performance.now()
Expand Down
2 changes: 1 addition & 1 deletion packages/app/src/runner/event-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { useStudioStore } from '../store/studio-store'
import { getAutIframeModel } from '.'
import { handlePausing } from './events/pausing'
import { addTelemetryListeners } from './events/telemetry'
import { telemetry } from '@packages/telemetry/src/browser'
import { telemetry } from '@packages/telemetry/browser/client'
import { addCaptureProtocolListeners } from './events/capture-protocol'
import { getRunnerConfigFromWindow } from './get-runner-config-from-window'

Expand Down
2 changes: 1 addition & 1 deletion packages/app/src/runner/events/telemetry.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { telemetry } from '@packages/telemetry/src/browser'
import { telemetry } from '@packages/telemetry/browser/client'

export const addTelemetryListeners = (Cypress: Cypress.Cypress) => {
Cypress.on('test:before:run', (attributes, test) => {
Expand Down
2 changes: 2 additions & 0 deletions packages/config/.eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
**/cjs
**/esm
**/dist
**/*.d.ts
**/package-lock.json
Expand Down
3 changes: 2 additions & 1 deletion packages/config/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
src/**/*.js
cjs/
esm/
5 changes: 0 additions & 5 deletions packages/config/index.js

This file was deleted.

20 changes: 13 additions & 7 deletions packages/config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@
"version": "0.0.0-development",
"description": "Config contains the configuration types and validation function used in the cypress electron application.",
"private": true,
"main": "index.js",
"browser": "src/browser.ts",
"main": "cjs/index.js",
"browser": "esm/browser.js",
"scripts": {
"build-prod": "tsc || echo 'built, with errors'",
"check-ts": "tsc --noEmit && yarn -s tslint",
"clean": "rimraf --glob './src/*.js' './src/**/*.js' './src/**/**/*.js' './test/!**__fixtures__**/**/*.js' || echo 'cleaned'",
"build": "yarn build:esm && yarn build:cjs",
"build-prod": "yarn build",
"build:cjs": "rimraf cjs && tsc -p tsconfig.cjs.json",
"build:esm": "rimraf esm && tsc -p tsconfig.esm.json",
"check-ts": "tsc -p tsconfig.cjs.json --noEmit && yarn -s tslint -p tsconfig.cjs.json",
"clean": "rimraf cjs esm",
"clean-deps": "rimraf node_modules",
"lint": "eslint --ext .js,.ts,.json, .",
"test": "yarn test-unit",
Expand Down Expand Up @@ -45,11 +48,14 @@
"@types/mocha": "9.1.0",
"babel-plugin-tester": "^10.1.0",
"chai": "4.2.0",
"mocha": "7.0.1"
"mocha": "7.0.1",
"rimraf": "6.0.1"
},
"files": [
"src"
"cjs/*",
"esm/*"
Copy link

Choose a reason for hiding this comment

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

Bug: Type Definitions Not Published

The package.json files field now excludes the src directory, but the types field still points to src/index.ts. This means TypeScript type definitions won't be published with the package, which can break type resolution for consumers.

Additional Locations (2)

Fix in Cursor Fix in Web

],
"types": "src/index.ts",
"module": "esm/index.js",
"nx": {}
}
4 changes: 2 additions & 2 deletions packages/config/src/ast-utils/addToCypressConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export async function addToCypressConfig (filePath: string, code: string, toAdd:
traverse(ast, addToCypressConfigPlugin(toAdd).visitor)

return print(ast).code
} catch (e) {
} catch (e: any) {
debug(`Error adding properties to %s: %s`, filePath, e.stack)
throw new Error(`Unable to automerge with the config file`)
}
Expand Down Expand Up @@ -125,7 +125,7 @@ export async function addTestingTypeToCypressConfig (options: AddTestingTypeToCy
return {
result: resultStatus,
}
} catch (e) {
} catch (e: any) {
return {
result: 'NEEDS_MERGE',
error: e,
Expand Down
4 changes: 1 addition & 3 deletions packages/config/src/options.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import os from 'os'
import path from 'path'

// @ts-ignore
import pkg from '@packages/root'
import type { AllCypressErrorNames } from '@packages/errors'
import type { TestingType } from '@packages/types'
Expand Down Expand Up @@ -485,7 +483,7 @@ const runtimeOptions: Array<RuntimeConfigOption> = [
// having the final config that has the e2e property flattened/compacted
// we may not be able to get the value to ignore.
name: 'additionalIgnorePattern',
defaultValue: (options: Record<string, any> = {}) => options.testingType === 'component' ? defaultSpecPattern.e2e : [],
defaultValue: (options: Record<string, any> = {}): string | any[] => options.testingType === 'component' ? defaultSpecPattern.e2e : [],
validation: validate.isStringOrArrayOfStrings,
isInternal: true,
}, {
Expand Down
2 changes: 2 additions & 0 deletions packages/config/test/project/utils.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,15 @@ import {
setSupportFileAndFolder,
mergeDefaults,
} from '../../src/project/utils'
import { resetIssuedWarnings } from '../../src/browser'
import path from 'node:path'

const debug = Debug('test')

describe('config/src/project/utils', () => {
beforeEach(function () {
delete process.env.CYPRESS_COMMERCIAL_RECOMMENDATIONS
resetIssuedWarnings()
})

before(function () {
Expand Down
25 changes: 25 additions & 0 deletions packages/config/tsconfig.base.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"include": [
"src/*.ts"
],
"exclude": [
"test"
],
"compilerOptions": {
"strict": true,
"noImplicitAny": true,
"esModuleInterop": true,
"noUnusedLocals": false,
"noUnusedParameters": false,
"allowJs": true,
"noUncheckedIndexedAccess": true,
"ignoreDeprecations": "5.0",
"importsNotUsedAsValues": "error",
"skipLibCheck": true,
"resolveJsonModule": true,
"types": [
"mocha",
"node"
]
}
}
10 changes: 10 additions & 0 deletions packages/config/tsconfig.cjs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "./tsconfig.base.json",
"compilerOptions": {
"rootDir": "./src",
"outDir": "./cjs",
"target": "ES2022",
"module": "CommonJS",
"moduleResolution": "node"
}
}
10 changes: 10 additions & 0 deletions packages/config/tsconfig.esm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "./tsconfig.base.json",
"compilerOptions": {
"rootDir": "./src",
"outDir": "./esm",
"target": "ES2022",
"module": "ES2022",
"moduleResolution": "node"
}
}
19 changes: 0 additions & 19 deletions packages/config/tsconfig.json

This file was deleted.

2 changes: 2 additions & 0 deletions packages/data-context/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
cjs/
esm/
5 changes: 0 additions & 5 deletions packages/data-context/index.js

This file was deleted.

24 changes: 16 additions & 8 deletions packages/data-context/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@
"name": "@packages/data-context",
"version": "0.0.0-development",
"description": "Centralized data access for the Cypress application",
"main": "index.js",
"browser": "src/index.ts",
"main": "cjs/index.js",
"scripts": {
"build": "node ./scripts/build.js",
"build-prod": "tsc || echo 'built, with errors'",
"check-ts": "tsc --noEmit && yarn -s tslint",
"clean": "rimraf --glob \"./{src,test}/**/*.js\"",
"prebuild": "yarn build:schema",
"build": "yarn build:cjs && yarn build:esm",
"build-prod": "yarn build",
"build:cjs": "rimraf cjs && tsc -p tsconfig.cjs.json",
"build:esm": "rimraf esm && tsc -p tsconfig.esm.json",
"build:schema": "tsx ./scripts/build.ts",
"check-ts": "tsc -p tsconfig.cjs.json --noEmit && yarn -s tslint -p tsconfig.cjs.json",
"clean": "rimraf esm cjs",
"clean-deps": "rimraf node_modules",
"lint": "eslint --ext .js,.ts,.json, .",
"test": "yarn test-unit",
Expand Down Expand Up @@ -95,14 +98,19 @@
"mocha-junit-reporter": "2.2.0",
"mocha-multi-reporters": "1.5.1",
"nexus": "^1.2.0-next.15",
"rimraf": "6.0.1",
"sinon": "13.0.2",
"sinon-chai": "3.7.0",
"tslint": "^6.1.3"
"tslint": "^6.1.3",
"tsx": "4.20.5",
"typescript": "5.9.2"
},
"files": [
"src"
"cjs/*",
"esm/*"
],
"types": "src/index.ts",
"module": "esm/index.js",
"nx": {
"targets": {
"build": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const fs = require('fs-extra')
const { buildSchema, introspectionFromSchema } = require('graphql')
const path = require('path')
const { minifyIntrospectionQuery } = require('@urql/introspection')
import fs from 'fs-extra'
import { buildSchema, introspectionFromSchema } from 'graphql'
import path from 'path'
import { minifyIntrospectionQuery } from '@urql/introspection'

const graphQlPackageRoot = path.join(__dirname, '..', '..', 'graphql')
const dataContextRoot = path.join(__dirname, '..')
Expand Down
2 changes: 1 addition & 1 deletion packages/data-context/src/actions/DataEmitterActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ export class DataEmitterActions extends DataEmitterEvents {
[Symbol.asyncIterator] () {
return iterator
},
}
} as unknown as AsyncGenerator<T>

return iterator
}
Expand Down
Loading