Skip to content

Commit

Permalink
chore: update mobx from 5.15.4 to 6.13.5 and mobx-react from …
Browse files Browse the repository at this point in the history
…`6.1.8` to `9.1.1` inside @packages/reporter (#30514)

* chore: do the minimal to update mobx from 5 to 6 [run ci]

chore: update mobx-react from v7 to v9 [run ci]

bump cache [run ci]

* do not alias mobx or mobx-react. This causes an issue where webpack, in production mode, bundles the cjs production dependency of mobx (mobx.cjs.production.min.js) into cypress_runner.js (in the runner package), but @packages/app (bundled via vite), bundles mobx.esm.js, which is NOT minimized and is expecting the global store/state set by the app to also not be minimized. [run ci]

* run update on all machines [run ci]

* add changelog entry [run ci]
  • Loading branch information
AtofStryker authored Nov 4, 2024
1 parent a8a3cb9 commit 3c6a092
Show file tree
Hide file tree
Showing 29 changed files with 94 additions and 47 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.

10-23-24
11-1-24-mobx-bust-cache1
10 changes: 5 additions & 5 deletions .circleci/workflows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ mainBuildFilters: &mainBuildFilters
- /^release\/\d+\.\d+\.\d+$/
# use the following branch as well to ensure that v8 snapshot cache updates are fully tested
- 'update-v8-snapshot-cache-on-develop'
- 'ryanm/chore/fix-windows-tests'
- 'chore/update_reporter_mobx'
- 'publish-binary'

# usually we don't build Mac app - it takes a long time
Expand All @@ -42,7 +42,7 @@ macWorkflowFilters: &darwin-workflow-filters
- 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: [ 'ryanm/chore/fix-windows-tests', << pipeline.git.branch >> ]
- equal: [ 'chore/update_reporter_mobx', << pipeline.git.branch >> ]
- matches:
pattern: /^release\/\d+\.\d+\.\d+$/
value: << pipeline.git.branch >>
Expand All @@ -53,7 +53,7 @@ linuxArm64WorkflowFilters: &linux-arm64-workflow-filters
- 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: [ 'ryanm/chore/fix-windows-tests', << pipeline.git.branch >> ]
- equal: [ 'chore/update_reporter_mobx', << pipeline.git.branch >> ]
- matches:
pattern: /^release\/\d+\.\d+\.\d+$/
value: << pipeline.git.branch >>
Expand All @@ -76,7 +76,7 @@ windowsWorkflowFilters: &windows-workflow-filters
- 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: [ 'ryanm/chore/fix-windows-tests', << pipeline.git.branch >> ]
- equal: [ 'chore/update_reporter_mobx', << pipeline.git.branch >> ]
- matches:
pattern: /^release\/\d+\.\d+\.\d+$/
value: << pipeline.git.branch >>
Expand Down Expand Up @@ -152,7 +152,7 @@ commands:
name: Set environment variable to determine whether or not to persist artifacts
command: |
echo "Setting SHOULD_PERSIST_ARTIFACTS variable"
echo 'if ! [[ "$CIRCLE_BRANCH" != "develop" && "$CIRCLE_BRANCH" != "release/"* && "$CIRCLE_BRANCH" != "ryanm/chore/fix-windows-tests" ]]; then
echo 'if ! [[ "$CIRCLE_BRANCH" != "develop" && "$CIRCLE_BRANCH" != "release/"* && "$CIRCLE_BRANCH" != "chore/update_reporter_mobx" ]]; then
export SHOULD_PERSIST_ARTIFACTS=true
fi' >> "$BASH_ENV"
# You must run `setup_should_persist_artifacts` command and be using bash before running this command
Expand Down
1 change: 1 addition & 0 deletions cli/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ _Released 11/5/2024 (PENDING)_

**Dependency Updates:**

- Updated `mobx` from `5.15.4` to `6.13.5` and `mobx-react` from `6.1.8` to `9.1.1`. Addresses [#30509](https://github.com/cypress-io/cypress/issues/30509).
- Updated `@cypress/request` from `3.0.4` to `3.0.6`. Addressed in [#30488](https://github.com/cypress-io/cypress/pull/30488).

## 13.15.1
Expand Down
2 changes: 1 addition & 1 deletion packages/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"javascript-time-ago": "2.3.8",
"just-my-luck": "3.0.0",
"lodash": "4.17.21",
"mobx": "5.15.4",
"mobx": "6.13.5",
"nanoid": "3.3.4",
"pinia": "2.0.0-rc.14",
"rollup-plugin-copy": "3.4.0",
Expand Down
3 changes: 2 additions & 1 deletion packages/app/src/store/mobx-runner-store.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { nanoid } from 'nanoid'
import { action, observable } from 'mobx'
import { action, observable, makeObservable } from 'mobx'
import type { AutomationStatus } from '../store'

const defaults = {
Expand All @@ -25,6 +25,7 @@ export class MobxRunnerStore {
@observable canSaveStudioLogs = false

constructor (testingType: Cypress.TestingType) {
makeObservable(this)
this.width = defaults[testingType].width
this.height = defaults[testingType].height
}
Expand Down
1 change: 1 addition & 0 deletions packages/app/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
],
"compilerOptions": {
"noImplicitThis": true,
"useDefineForClassFields": true,
"paths": {
"@cy/i18n": ["../frontend-shared/src/locales/i18n"],
"@cy/components/*": ["../frontend-shared/src/components/*"],
Expand Down
4 changes: 2 additions & 2 deletions packages/reporter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
"cypress-real-events": "1.6.0",
"lodash": "^4.17.21",
"markdown-it": "^14.0.0",
"mobx": "5.15.4",
"mobx-react": "6.1.8",
"mobx": "6.13.5",
"mobx-react": "9.1.1",
"prismjs": "1.27.0",
"prop-types": "15.7.2",
"react": "16.8.6",
Expand Down
4 changes: 3 additions & 1 deletion packages/reporter/src/agents/agent-model.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { observable } from 'mobx'
import { observable, makeObservable } from 'mobx'
import Instrument, { InstrumentProps } from '../instruments/instrument-model'

export interface AgentProps extends InstrumentProps {
Expand All @@ -13,6 +13,8 @@ export default class Agent extends Instrument {
constructor (props: AgentProps) {
super(props)

makeObservable(this)

this.callCount = props.callCount
this.functionName = props.functionName
}
Expand Down
3 changes: 2 additions & 1 deletion packages/reporter/src/attempts/attempt-model.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import _ from 'lodash'
import { action, computed, observable } from 'mobx'
import { action, computed, observable, makeObservable } from 'mobx'

import Agent, { AgentProps } from '../agents/agent-model'
import Command, { CommandProps } from '../commands/command-model'
Expand Down Expand Up @@ -47,6 +47,7 @@ export default class Attempt {
_logs: {[key: string]: Log} = {}

constructor (props: TestProps, test: Test) {
makeObservable(this)
this.testId = props.id
this.id = props.currentRetry || 0
this.test = test
Expand Down
4 changes: 3 additions & 1 deletion packages/reporter/src/commands/command-model.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import _ from 'lodash'
import { action, computed, observable } from 'mobx'
import { action, computed, observable, makeObservable } from 'mobx'

import Err, { ErrProps } from '../errors/err-model'
import Instrument, { InstrumentProps } from '../instruments/instrument-model'
Expand Down Expand Up @@ -131,6 +131,8 @@ export default class Command extends Instrument {
constructor (props: CommandProps) {
super(props)

makeObservable(this)

if (props.err) {
this.err = new Err(props.err)
}
Expand Down
7 changes: 6 additions & 1 deletion packages/reporter/src/commands/command.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import _ from 'lodash'
import cs from 'classnames'
import Markdown from 'markdown-it'
import { action, observable } from 'mobx'
import { action, observable, makeObservable } from 'mobx'
import { observer } from 'mobx-react'
import React, { Component } from 'react'
import Tooltip from '@cypress/react-tooltip'
Expand Down Expand Up @@ -379,6 +379,11 @@ class Command extends Component<Props> {
runnablesStore,
}

constructor (props: Props) {
super(props)
makeObservable(this)
}

render () {
const { model, aliasesWithDuplicates } = this.props

Expand Down
3 changes: 2 additions & 1 deletion packages/reporter/src/errors/err-model.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable padding-line-between-statements */
import _ from 'lodash'
import { computed, observable } from 'mobx'
import { computed, observable, makeObservable } from 'mobx'

import type { FileDetails } from '@packages/types'

Expand Down Expand Up @@ -45,6 +45,7 @@ export default class Err {
@observable isRecovered: boolean = false

constructor (props?: Partial<ErrProps>) {
makeObservable(this)
this.update(props)
}

Expand Down
6 changes: 5 additions & 1 deletion packages/reporter/src/header/stats-store.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import _ from 'lodash'
import { action, computed, observable } from 'mobx'
import { action, computed, observable, makeObservable } from 'mobx'
import { TestState } from '../test/test-model'
import { IntervalID } from '../lib/types'

Expand All @@ -25,6 +25,10 @@ class StatsStore {

private _interval?: IntervalID

constructor () {
makeObservable(this)
}

@computed get duration () {
if (!this._startTime) return 0

Expand Down
3 changes: 2 additions & 1 deletion packages/reporter/src/hooks/hook-model.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import _ from 'lodash'
import { observable, computed } from 'mobx'
import { observable, computed, makeObservable } from 'mobx'

import { FileDetails } from '@packages/types'

Expand Down Expand Up @@ -30,6 +30,7 @@ export default class Hook implements HookProps {
private _currentNumber = 1

constructor (props: HookProps) {
makeObservable(this)
this.hookId = props.hookId
this.hookName = props.hookName
this.invocationDetails = props.invocationDetails
Expand Down
3 changes: 2 additions & 1 deletion packages/reporter/src/instruments/instrument-model.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { observable } from 'mobx'
import { observable, makeObservable } from 'mobx'
import { Instrument, TestState } from '@packages/types'

export interface AliasObject {
Expand Down Expand Up @@ -38,6 +38,7 @@ export default class Log {
testId: string

constructor (props: InstrumentProps) {
makeObservable(this)
this.id = props.id
this.alias = props.alias
this.aliasType = props.aliasType
Expand Down
6 changes: 5 additions & 1 deletion packages/reporter/src/lib/app-state.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import _ from 'lodash'
import { observable } from 'mobx'
import { observable, makeObservable } from 'mobx'

interface DefaultAppState {
isPaused: boolean
Expand Down Expand Up @@ -36,6 +36,10 @@ class AppState {
_resetAutoScrollingEnabledTo = true;
[key: string]: any

constructor () {
makeObservable(this)
}

startRunning () {
this.isRunning = true
this.isStopped = false
Expand Down
7 changes: 6 additions & 1 deletion packages/reporter/src/lib/flash-on-click.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { action, observable } from 'mobx'
import { action, observable, makeObservable } from 'mobx'
import { observer } from 'mobx-react'
import PropTypes from 'prop-types'
import React, { Children, cloneElement, Component, MouseEvent, ReactElement, ReactNode } from 'react'
Expand Down Expand Up @@ -27,6 +27,11 @@ class FlashOnClick extends Component<Props> {

@observable _show = false

constructor (props: Props) {
super(props)
makeObservable(this)
}

render () {
const child = Children.only<ReactNode>(this.props.children)

Expand Down
7 changes: 6 additions & 1 deletion packages/reporter/src/lib/switch.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { action } from 'mobx'
import { action, makeObservable } from 'mobx'
import { observer } from 'mobx-react'
import React, { Component } from 'react'

Expand All @@ -17,6 +17,11 @@ class Switch extends Component<Props> {
onUpdate(e)
}

constructor (props: Props) {
super(props)
makeObservable(this)
}

render () {
const { 'data-cy': dataCy, size = 'lg', value } = this.props

Expand Down
5 changes: 3 additions & 2 deletions packages/reporter/src/main-runner.scss.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
interface CssExports {

}
export const cssExports: CssExports;
export default cssExports;
export const cssExports: CssExports

export default cssExports
4 changes: 3 additions & 1 deletion packages/reporter/src/routes/route-model.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { observable } from 'mobx'
import { observable, makeObservable } from 'mobx'
import Instrument, { InstrumentProps } from '../instruments/instrument-model'

export interface RouteProps extends InstrumentProps {
Expand All @@ -17,6 +17,8 @@ export default class Route extends Instrument {
constructor (props: RouteProps) {
super(props)

makeObservable(this)

this.isStubbed = props.isStubbed
this.method = props.method
this.numResponses = props.numResponses
Expand Down
3 changes: 2 additions & 1 deletion packages/reporter/src/runnables/runnable-model.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { observable } from 'mobx'
import { observable, makeObservable } from 'mobx'
import { HookProps } from '../hooks/hook-model'

export interface RunnableProps {
Expand All @@ -14,6 +14,7 @@ export default class Runnable {
@observable hooks: Array<HookProps> = []

constructor (props: RunnableProps, level: number) {
makeObservable(this)
this.id = props.id
this.title = props.title
this.level = level
Expand Down
3 changes: 2 additions & 1 deletion packages/reporter/src/runnables/runnables-store.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { TestFilter } from '@packages/types'
import _ from 'lodash'
import { action, observable } from 'mobx'
import { action, observable, makeObservable } from 'mobx'
import AgentModel, { AgentProps } from '../agents/agent-model'
import CommandModel, { CommandProps } from '../commands/command-model'
import { HookProps } from '../hooks/hook-model'
Expand Down Expand Up @@ -74,6 +74,7 @@ export class RunnablesStore {
showingSnapshot = defaults.showingSnapshot

constructor ({ appState, scroller }: Props) {
makeObservable(this)
this.appState = appState
this.scroller = scroller
}
Expand Down
8 changes: 7 additions & 1 deletion packages/reporter/src/runnables/suite-model.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import _ from 'lodash'
import { computed, observable } from 'mobx'
import { computed, observable, makeObservable } from 'mobx'
import Runnable, { RunnableProps } from './runnable-model'
import TestModel, { TestProps } from '../test/test-model'
import { TestState } from '@packages/types'
Expand All @@ -13,6 +13,12 @@ export default class Suite extends Runnable {
@observable children: Array<TestModel | Suite> = []
type = 'suite'

constructor (props: SuiteProps, level: number) {
super(props, level)

makeObservable(this)
}

@computed get state (): TestState {
if (this._anyChildrenFailed) {
return 'failed'
Expand Down
5 changes: 3 additions & 2 deletions packages/reporter/src/sessions/sessions-model.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { observable } from 'mobx'
import { observable, makeObservable } from 'mobx'
import Instrument, { InstrumentProps } from '../instruments/instrument-model'
import { determineTagType } from './utils'
import type { SessionStatus } from './utils'
Expand All @@ -15,13 +15,14 @@ export interface SessionProps extends InstrumentProps {
}

export default class Session extends Instrument {
@observable name: string
name: string
@observable status: string
@observable isGlobalSession: boolean = false
@observable tagType: string

constructor (props: SessionProps) {
super(props)
makeObservable(this)
const { state, sessionInfo: { isGlobalSession, id, status } } = props

this.isGlobalSession = isGlobalSession
Expand Down
4 changes: 3 additions & 1 deletion packages/reporter/src/test/test-model.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import _ from 'lodash'
import { action, computed, observable } from 'mobx'
import { action, computed, observable, makeObservable } from 'mobx'

import { FileDetails, TestState } from '@packages/types'
import Attempt from '../attempts/attempt-model'
Expand Down Expand Up @@ -62,6 +62,8 @@ export default class Test extends Runnable {
constructor (props: TestProps, level: number, private store: RunnablesStore) {
super(props, level)

makeObservable(this)

this.invocationDetails = props.invocationDetails

this.hooks = [...props.hooks, {
Expand Down
Loading

5 comments on commit 3c6a092

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 3c6a092 Nov 4, 2024

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.15.2/linux-x64/develop-3c6a0929d5d83b33d4c8cbe26b36ef68b5b4d38d/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 3c6a092 Nov 4, 2024

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.15.2/linux-arm64/develop-3c6a0929d5d83b33d4c8cbe26b36ef68b5b4d38d/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 3c6a092 Nov 4, 2024

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.15.2/win32-x64/develop-3c6a0929d5d83b33d4c8cbe26b36ef68b5b4d38d/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 3c6a092 Nov 4, 2024

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.15.2/darwin-arm64/develop-3c6a0929d5d83b33d4c8cbe26b36ef68b5b4d38d/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 3c6a092 Nov 4, 2024

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.15.2/darwin-x64/develop-3c6a0929d5d83b33d4c8cbe26b36ef68b5b4d38d/cypress.tgz

Please sign in to comment.