Skip to content

Commit

Permalink
remove the experimentalJIT flag and make it GA (default still false) …
Browse files Browse the repository at this point in the history
…[run ci]
  • Loading branch information
AtofStryker committed Nov 18, 2024
1 parent ecd2fa3 commit 2e83679
Show file tree
Hide file tree
Showing 46 changed files with 131 additions and 75 deletions.
16 changes: 8 additions & 8 deletions cli/types/cypress.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3113,14 +3113,6 @@ declare namespace Cypress {
* @default null
*/
experimentalSkipDomainInjection: string[] | null
/**
* Allows for just-in-time compiling of a component test, which will only compile assets related to the component.
* This results in a smaller bundle under test, reducing resource constraints on a given machine. This option is recommended
* for users with large component testing projects and those who are running into webpack 'chunk load error' issues.
* Supported for webpack-dev-server only. For component testing only.
* @see https://on.cypress.io/experiments#Configuration
*/
experimentalJustInTimeCompile: boolean
/**
* Enables AST-based JS/HTML rewriting. This may fix issues caused by the existing regex-based JS/HTML replacement algorithm.
* @default false
Expand All @@ -3141,6 +3133,14 @@ declare namespace Cypress {
* @default false
*/
experimentalMemoryManagement: boolean
/**
* Allows for just-in-time compiling of a component test, which will only compile assets related to the component.
* This results in a smaller bundle under test, reducing resource constraints on a given machine. This option is recommended
* for users with large component testing projects and those who are running into webpack 'chunk load error' issues.
* Supported for webpack-dev-server only. For component testing only.
* @see https://on.cypress.io/experiments#Configuration
*/
justInTimeCompile: boolean
/**
* Number of times to retry a failed test.
* If a number is set, tests will retry in both runMode and openMode.
Expand Down
6 changes: 3 additions & 3 deletions npm/webpack-dev-server/src/makeDefaultWebpackConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export function makeCypressWebpackConfig (
const {
devServerConfig: {
cypressConfig: {
experimentalJustInTimeCompile,
justInTimeCompile,
port,
projectRoot,
devServerPublicPathRoute,
Expand Down Expand Up @@ -100,8 +100,8 @@ export function makeCypressWebpackConfig (
} as any

if (isRunMode) {
// if experimentalJustInTimeCompile is configured, we need to watch for file changes as the spec entries are going to be updated per test
const ignored = experimentalJustInTimeCompile ? /node_modules/ : '**/*'
// if justInTimeCompile is configured, we need to watch for file changes as the spec entries are going to be updated per test
const ignored = justInTimeCompile ? /node_modules/ : '**/*'

// Disable file watching when executing tests in `run` mode
finalConfig.watchOptions = {
Expand Down
4 changes: 2 additions & 2 deletions npm/webpack-dev-server/src/makeWebpackConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,12 @@ export async function makeWebpackConfig (
cypressConfig: {
projectRoot,
supportFile,
experimentalJustInTimeCompile,
justInTimeCompile,
},
framework,
} = config.devServerConfig

const files = experimentalJustInTimeCompile ? [] : config.devServerConfig.specs
const files = justInTimeCompile ? [] : config.devServerConfig.specs

if (!userWebpackConfig && !frameworkWebpackConfig) {
debug('Not user or framework webpack config received. Trying to automatically source it')
Expand Down
4 changes: 2 additions & 2 deletions npm/webpack-dev-server/test/makeWebpackConfig.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ describe('makeWebpackConfig', () => {
})
})

describe('experimentalJustInTimeCompile', () => {
describe('justInTimeCompile', () => {
let devServerConfig: WebpackDevServerConfig

const WEBPACK_MATRIX: {
Expand All @@ -419,7 +419,7 @@ describe('makeWebpackConfig', () => {
cypressConfig: {
projectRoot: '.',
devServerPublicPathRoute: '/test-public-path',
experimentalJustInTimeCompile: true,
justInTimeCompile: true,
baseUrl: null,
} as Cypress.PluginConfigOptions,
webpackConfig: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@ import type { fixtureDirs } from '@tooling/system-tests'

type ProjectDirs = typeof fixtureDirs

const EXPERIMENTAL_JIT_DIR: ProjectDirs[number] = 'experimental-JIT'
const JIT_DIR: ProjectDirs[number] = 'justInTimeCompile'

const PROJECTS: {bundler: 'vite' | 'webpack'}[] = [
// when running for vite, experimentalJustInTimeCompile=true is set but is a no-op for vite since JIT compiling is not supported in vite
// when running for vite, justInTimeCompile=true is set but is a no-op for vite since JIT compiling is not supported in vite
{ bundler: 'vite' },
{ bundler: 'webpack' },
]

for (const { bundler } of PROJECTS) {
const PROJECT_NAME = `${EXPERIMENTAL_JIT_DIR}/${bundler}`
const PROJECT_NAME = `${JIT_DIR}/${bundler}`

describe(`CT experimentalJustInTimeCompile: ${bundler}`, { viewportWidth: 1500, defaultCommandTimeout: 30000 }, () => {
describe(`CT justInTimeCompile: ${bundler}`, { viewportWidth: 1500, defaultCommandTimeout: 30000 }, () => {
const visitComponentSpecAndVerifyPass = (specNumber: number) => {
cy.contains(`Component-${specNumber}.cy.jsx`).click()
cy.waitForSpecToFinish(undefined)
Expand Down
4 changes: 2 additions & 2 deletions packages/app/src/runner/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -445,8 +445,8 @@ async function executeSpec (spec: SpecFile, isRerun: boolean = false) {
}

if (window.__CYPRESS_TESTING_TYPE__ === 'component') {
if (config.experimentalJustInTimeCompile && !config.isTextTerminal) {
// If running with experimentalJustInTimeCompile enabled and in open mode,
if (config.justInTimeCompile && !config.isTextTerminal) {
// If running with justInTimeCompile enabled and in open mode,
// send a signal to the dev server to load the spec before running
// since the spec and related resources are not yet compiled.
await updateDevServerWithSpec(spec)
Expand Down
6 changes: 3 additions & 3 deletions packages/config/__snapshots__/index.spec.ts.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ exports['config/src/index .getDefaultValues returns list of public config keys 1
'experimentalMemoryManagement': false,
'experimentalModifyObstructiveThirdPartyCode': false,
'experimentalSkipDomainInjection': null,
'experimentalJustInTimeCompile': false,
'experimentalOriginDependencies': false,
'experimentalSourceRewriting': false,
'experimentalSingleTabRunMode': false,
Expand All @@ -49,6 +48,7 @@ exports['config/src/index .getDefaultValues returns list of public config keys 1
'fixturesFolder': 'cypress/fixtures',
'excludeSpecPattern': '*.hot-update.js',
'includeShadowDom': false,
'justInTimeCompile': false,
'keystrokeDelay': 0,
'modifyObstructiveCode': true,
'numTestsKeptInMemory': 50,
Expand Down Expand Up @@ -129,7 +129,6 @@ exports['config/src/index .getDefaultValues returns list of public config keys f
'experimentalMemoryManagement': false,
'experimentalModifyObstructiveThirdPartyCode': false,
'experimentalSkipDomainInjection': null,
'experimentalJustInTimeCompile': false,
'experimentalOriginDependencies': false,
'experimentalSourceRewriting': false,
'experimentalSingleTabRunMode': false,
Expand All @@ -139,6 +138,7 @@ exports['config/src/index .getDefaultValues returns list of public config keys f
'fixturesFolder': 'cypress/fixtures',
'excludeSpecPattern': '*.hot-update.js',
'includeShadowDom': false,
'justInTimeCompile': false,
'keystrokeDelay': 0,
'modifyObstructiveCode': true,
'numTestsKeptInMemory': 50,
Expand Down Expand Up @@ -215,7 +215,6 @@ exports['config/src/index .getPublicConfigKeys returns list of public config key
'experimentalMemoryManagement',
'experimentalModifyObstructiveThirdPartyCode',
'experimentalSkipDomainInjection',
'experimentalJustInTimeCompile',
'experimentalOriginDependencies',
'experimentalSourceRewriting',
'experimentalSingleTabRunMode',
Expand All @@ -225,6 +224,7 @@ exports['config/src/index .getPublicConfigKeys returns list of public config key
'fixturesFolder',
'excludeSpecPattern',
'includeShadowDom',
'justInTimeCompile',
'keystrokeDelay',
'modifyObstructiveCode',
'numTestsKeptInMemory',
Expand Down
16 changes: 10 additions & 6 deletions packages/config/src/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,10 +232,9 @@ const driverConfigOptions: Array<DriverConfigOption> = [
isExperimental: true,
requireRestartOnChange: 'server',
}, {
name: 'experimentalJustInTimeCompile',
name: 'justInTimeCompile',
defaultValue: false,
validation: validate.isBoolean,
isExperimental: true,
requireRestartOnChange: 'server',
}, {
name: 'experimentalOriginDependencies',
Expand Down Expand Up @@ -632,6 +631,11 @@ export const breakingOptions: Readonly<BreakingOption[]> = [
errorKey: 'EXPERIMENTAL_SAMESITE_REMOVED',
isWarning: true,
}, {
name: 'experimentalJustInTimeCompile',
errorKey: 'EXPERIMENTAL_JIT_COMPILE_REMOVED',
isWarning: true,
},
{
name: 'experimentalNetworkStubbing',
errorKey: 'EXPERIMENTAL_NETWORK_STUBBING_REMOVED',
isWarning: true,
Expand Down Expand Up @@ -736,8 +740,8 @@ export const breakingRootOptions: Array<BreakingOption> = [
testingTypes: ['e2e'],
},
{
name: 'experimentalJustInTimeCompile',
errorKey: 'EXPERIMENTAL_JIT_COMPONENT_TESTING',
name: 'justInTimeCompile',
errorKey: 'JIT_COMPONENT_TESTING',
isWarning: false,
testingTypes: ['component'],
},
Expand All @@ -756,8 +760,8 @@ export const testingTypeBreakingOptions: { e2e: Array<BreakingOption>, component
isWarning: false,
},
{
name: 'experimentalJustInTimeCompile',
errorKey: 'EXPERIMENTAL_JIT_COMPONENT_TESTING',
name: 'justInTimeCompile',
errorKey: 'JIT_COMPONENT_TESTING',
isWarning: false,
},
],
Expand Down
42 changes: 26 additions & 16 deletions packages/config/test/project/utils.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -969,6 +969,16 @@ describe('config/src/project/utils', () => {
expect(warning).to.be.calledWith('EXPERIMENTAL_SAMESITE_REMOVED')
})

it('warns if experimentalJustInTimeCompile is passed', async function () {
const warning = sinon.spy(errors, 'warning')

await this.defaults('experimentalJustInTimeCompile', true, {
experimentalJustInTimeCompile: true,
})

expect(warning).to.be.calledWith('EXPERIMENTAL_JIT_COMPILE_REMOVED')
})

it('warns if experimentalSessionSupport is passed', async function () {
const warning = sinon.spy(errors, 'warning')

Expand Down Expand Up @@ -1057,10 +1067,10 @@ describe('config/src/project/utils', () => {
defaultCommandTimeout: { value: 4000, from: 'default' },
downloadsFolder: { value: 'cypress/downloads', from: 'default' },
env: {},
excludeSpecPattern: { value: '*.hot-update.js', from: 'default' },
execTimeout: { value: 60000, from: 'default' },
experimentalModifyObstructiveThirdPartyCode: { value: false, from: 'default' },
experimentalSkipDomainInjection: { value: null, from: 'default' },
experimentalJustInTimeCompile: { value: false, from: 'default' },
experimentalCspAllowList: { value: false, from: 'default' },
experimentalInteractiveRunEvents: { value: false, from: 'default' },
experimentalMemoryManagement: { value: false, from: 'default' },
Expand All @@ -1073,8 +1083,8 @@ describe('config/src/project/utils', () => {
fileServerFolder: { value: '', from: 'default' },
fixturesFolder: { value: 'cypress/fixtures', from: 'default' },
hosts: { value: null, from: 'default' },
excludeSpecPattern: { value: '*.hot-update.js', from: 'default' },
includeShadowDom: { value: false, from: 'default' },
justInTimeCompile: { value: false, from: 'default' },
isInteractive: { value: true, from: 'default' },
keystrokeDelay: { value: 0, from: 'default' },
modifyObstructiveCode: { value: true, from: 'default' },
Expand Down Expand Up @@ -1153,19 +1163,6 @@ describe('config/src/project/utils', () => {
clientCertificates: { value: [], from: 'default' },
defaultCommandTimeout: { value: 4000, from: 'default' },
downloadsFolder: { value: 'cypress/downloads', from: 'default' },
execTimeout: { value: 60000, from: 'default' },
experimentalModifyObstructiveThirdPartyCode: { value: false, from: 'default' },
experimentalSkipDomainInjection: { value: null, from: 'default' },
experimentalJustInTimeCompile: { value: false, from: 'default' },
experimentalCspAllowList: { value: false, from: 'default' },
experimentalInteractiveRunEvents: { value: false, from: 'default' },
experimentalMemoryManagement: { value: false, from: 'default' },
experimentalOriginDependencies: { value: false, from: 'default' },
experimentalRunAllSpecs: { value: false, from: 'default' },
experimentalSingleTabRunMode: { value: false, from: 'default' },
experimentalStudio: { value: false, from: 'default' },
experimentalSourceRewriting: { value: false, from: 'default' },
experimentalWebKitSupport: { value: false, from: 'default' },
env: {
foo: {
value: 'foo',
Expand All @@ -1188,11 +1185,24 @@ describe('config/src/project/utils', () => {
from: 'env',
},
},
excludeSpecPattern: { value: '*.hot-update.js', from: 'default' },
execTimeout: { value: 60000, from: 'default' },
experimentalModifyObstructiveThirdPartyCode: { value: false, from: 'default' },
experimentalSkipDomainInjection: { value: null, from: 'default' },
experimentalCspAllowList: { value: false, from: 'default' },
experimentalInteractiveRunEvents: { value: false, from: 'default' },
experimentalMemoryManagement: { value: false, from: 'default' },
experimentalOriginDependencies: { value: false, from: 'default' },
experimentalRunAllSpecs: { value: false, from: 'default' },
experimentalSingleTabRunMode: { value: false, from: 'default' },
experimentalStudio: { value: false, from: 'default' },
experimentalSourceRewriting: { value: false, from: 'default' },
experimentalWebKitSupport: { value: false, from: 'default' },
fileServerFolder: { value: '', from: 'default' },
fixturesFolder: { value: 'cypress/fixtures', from: 'default' },
hosts: { value: null, from: 'default' },
excludeSpecPattern: { value: '*.hot-update.js', from: 'default' },
includeShadowDom: { value: false, from: 'default' },
justInTimeCompile: { value: false, from: 'default' },
isInteractive: { value: true, from: 'default' },
keystrokeDelay: { value: 0, from: 'default' },
modifyObstructiveCode: { value: true, from: 'default' },
Expand Down
2 changes: 1 addition & 1 deletion packages/data-context/src/data/ProjectLifecycleManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ export class ProjectLifecycleManager {
/**
* We need to start the dev server in the ProjectLifecycleManager when:
* 1. GA component testing is running so we can compile the dev server will all specs matching the specPattern
* 2. experimentalJustInTimeCompile is enabled (for webpack-dev-server). In this case, we start a dev server
* 2. justInTimeCompile is enabled (for webpack-dev-server). In this case, we start a dev server
* with an empty specs list to initially compile the support file and related dependencies in order to hopefully
* leverage the dev server cache for recompiling for when we actually have a spec to add to the dev server entry.
* The empty specs are handled within the @cypress/webpack-dev-server package as this has no impact on vite.
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 8 additions & 4 deletions packages/errors/src/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1239,6 +1239,12 @@ export const AllCypressErrors = {
You can safely remove this option from your config.`
},
EXPERIMENTAL_JIT_COMPILE_REMOVED: () => {
return errTemplate`\
The ${fmt.highlight(`experimentalJustInTimeCompile`)} configuration option was removed in ${fmt.cypressVersion(`14.0.0`)}.
A new ${fmt.highlightSecondary(`justInTimeCompile`)} configuration option is available and is now ${fmt.highlightSecondary(`false`)} by default.
You can safely remove this option from your config.`
},
// TODO: verify configFile is absolute path
// TODO: make this relative path, not absolute
EXPERIMENTAL_COMPONENT_TESTING_REMOVED: (arg1: {configFile: string}) => {
Expand Down Expand Up @@ -1338,11 +1344,9 @@ export const AllCypressErrors = {
${fmt.code(code)}`
},
EXPERIMENTAL_JIT_COMPONENT_TESTING: () => {
JIT_COMPONENT_TESTING: () => {
return errTemplate`\
The ${fmt.highlight(`experimentalJustInTimeCompile`)} experiment is currently only supported for Component Testing.
If you have feedback about the experiment, please join the discussion here: http://on.cypress.io/just-in-time-compile`
The ${fmt.highlight(`justInTimeCompile`)} configuration is only supported for Component Testing.`
},
EXPERIMENTAL_USE_DEFAULT_DOCUMENT_DOMAIN_E2E_ONLY: () => {
const code = errPartial`
Expand Down
Loading

0 comments on commit 2e83679

Please sign in to comment.