Skip to content

Commit 3c6a092

Browse files
authored
chore: update mobx from 5.15.4 to 6.13.5 and mobx-react from 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]
1 parent a8a3cb9 commit 3c6a092

29 files changed

+94
-47
lines changed

.circleci/cache-version.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# Bump this version to force CI to re-create the cache from scratch.
22

3-
10-23-24
3+
11-1-24-mobx-bust-cache1

.circleci/workflows.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ mainBuildFilters: &mainBuildFilters
3030
- /^release\/\d+\.\d+\.\d+$/
3131
# use the following branch as well to ensure that v8 snapshot cache updates are fully tested
3232
- 'update-v8-snapshot-cache-on-develop'
33-
- 'ryanm/chore/fix-windows-tests'
33+
- 'chore/update_reporter_mobx'
3434
- 'publish-binary'
3535

3636
# usually we don't build Mac app - it takes a long time
@@ -42,7 +42,7 @@ macWorkflowFilters: &darwin-workflow-filters
4242
- equal: [ develop, << pipeline.git.branch >> ]
4343
# use the following branch as well to ensure that v8 snapshot cache updates are fully tested
4444
- equal: [ 'update-v8-snapshot-cache-on-develop', << pipeline.git.branch >> ]
45-
- equal: [ 'ryanm/chore/fix-windows-tests', << pipeline.git.branch >> ]
45+
- equal: [ 'chore/update_reporter_mobx', << pipeline.git.branch >> ]
4646
- matches:
4747
pattern: /^release\/\d+\.\d+\.\d+$/
4848
value: << pipeline.git.branch >>
@@ -53,7 +53,7 @@ linuxArm64WorkflowFilters: &linux-arm64-workflow-filters
5353
- equal: [ develop, << pipeline.git.branch >> ]
5454
# use the following branch as well to ensure that v8 snapshot cache updates are fully tested
5555
- equal: [ 'update-v8-snapshot-cache-on-develop', << pipeline.git.branch >> ]
56-
- equal: [ 'ryanm/chore/fix-windows-tests', << pipeline.git.branch >> ]
56+
- equal: [ 'chore/update_reporter_mobx', << pipeline.git.branch >> ]
5757
- matches:
5858
pattern: /^release\/\d+\.\d+\.\d+$/
5959
value: << pipeline.git.branch >>
@@ -76,7 +76,7 @@ windowsWorkflowFilters: &windows-workflow-filters
7676
- equal: [ develop, << pipeline.git.branch >> ]
7777
# use the following branch as well to ensure that v8 snapshot cache updates are fully tested
7878
- equal: [ 'update-v8-snapshot-cache-on-develop', << pipeline.git.branch >> ]
79-
- equal: [ 'ryanm/chore/fix-windows-tests', << pipeline.git.branch >> ]
79+
- equal: [ 'chore/update_reporter_mobx', << pipeline.git.branch >> ]
8080
- matches:
8181
pattern: /^release\/\d+\.\d+\.\d+$/
8282
value: << pipeline.git.branch >>
@@ -152,7 +152,7 @@ commands:
152152
name: Set environment variable to determine whether or not to persist artifacts
153153
command: |
154154
echo "Setting SHOULD_PERSIST_ARTIFACTS variable"
155-
echo 'if ! [[ "$CIRCLE_BRANCH" != "develop" && "$CIRCLE_BRANCH" != "release/"* && "$CIRCLE_BRANCH" != "ryanm/chore/fix-windows-tests" ]]; then
155+
echo 'if ! [[ "$CIRCLE_BRANCH" != "develop" && "$CIRCLE_BRANCH" != "release/"* && "$CIRCLE_BRANCH" != "chore/update_reporter_mobx" ]]; then
156156
export SHOULD_PERSIST_ARTIFACTS=true
157157
fi' >> "$BASH_ENV"
158158
# You must run `setup_should_persist_artifacts` command and be using bash before running this command

cli/CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ _Released 11/5/2024 (PENDING)_
1313

1414
**Dependency Updates:**
1515

16+
- 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).
1617
- Updated `@cypress/request` from `3.0.4` to `3.0.6`. Addressed in [#30488](https://github.com/cypress-io/cypress/pull/30488).
1718

1819
## 13.15.1

packages/app/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
"javascript-time-ago": "2.3.8",
5959
"just-my-luck": "3.0.0",
6060
"lodash": "4.17.21",
61-
"mobx": "5.15.4",
61+
"mobx": "6.13.5",
6262
"nanoid": "3.3.4",
6363
"pinia": "2.0.0-rc.14",
6464
"rollup-plugin-copy": "3.4.0",

packages/app/src/store/mobx-runner-store.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { nanoid } from 'nanoid'
2-
import { action, observable } from 'mobx'
2+
import { action, observable, makeObservable } from 'mobx'
33
import type { AutomationStatus } from '../store'
44

55
const defaults = {
@@ -25,6 +25,7 @@ export class MobxRunnerStore {
2525
@observable canSaveStudioLogs = false
2626

2727
constructor (testingType: Cypress.TestingType) {
28+
makeObservable(this)
2829
this.width = defaults[testingType].width
2930
this.height = defaults[testingType].height
3031
}

packages/app/tsconfig.json

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
],
1414
"compilerOptions": {
1515
"noImplicitThis": true,
16+
"useDefineForClassFields": true,
1617
"paths": {
1718
"@cy/i18n": ["../frontend-shared/src/locales/i18n"],
1819
"@cy/components/*": ["../frontend-shared/src/components/*"],

packages/reporter/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
"cypress-real-events": "1.6.0",
2828
"lodash": "^4.17.21",
2929
"markdown-it": "^14.0.0",
30-
"mobx": "5.15.4",
31-
"mobx-react": "6.1.8",
30+
"mobx": "6.13.5",
31+
"mobx-react": "9.1.1",
3232
"prismjs": "1.27.0",
3333
"prop-types": "15.7.2",
3434
"react": "16.8.6",

packages/reporter/src/agents/agent-model.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { observable } from 'mobx'
1+
import { observable, makeObservable } from 'mobx'
22
import Instrument, { InstrumentProps } from '../instruments/instrument-model'
33

44
export interface AgentProps extends InstrumentProps {
@@ -13,6 +13,8 @@ export default class Agent extends Instrument {
1313
constructor (props: AgentProps) {
1414
super(props)
1515

16+
makeObservable(this)
17+
1618
this.callCount = props.callCount
1719
this.functionName = props.functionName
1820
}

packages/reporter/src/attempts/attempt-model.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import _ from 'lodash'
2-
import { action, computed, observable } from 'mobx'
2+
import { action, computed, observable, makeObservable } from 'mobx'
33

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

4949
constructor (props: TestProps, test: Test) {
50+
makeObservable(this)
5051
this.testId = props.id
5152
this.id = props.currentRetry || 0
5253
this.test = test

packages/reporter/src/commands/command-model.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import _ from 'lodash'
2-
import { action, computed, observable } from 'mobx'
2+
import { action, computed, observable, makeObservable } from 'mobx'
33

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

134+
makeObservable(this)
135+
134136
if (props.err) {
135137
this.err = new Err(props.err)
136138
}

packages/reporter/src/commands/command.tsx

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import _ from 'lodash'
22
import cs from 'classnames'
33
import Markdown from 'markdown-it'
4-
import { action, observable } from 'mobx'
4+
import { action, observable, makeObservable } from 'mobx'
55
import { observer } from 'mobx-react'
66
import React, { Component } from 'react'
77
import Tooltip from '@cypress/react-tooltip'
@@ -379,6 +379,11 @@ class Command extends Component<Props> {
379379
runnablesStore,
380380
}
381381

382+
constructor (props: Props) {
383+
super(props)
384+
makeObservable(this)
385+
}
386+
382387
render () {
383388
const { model, aliasesWithDuplicates } = this.props
384389

packages/reporter/src/errors/err-model.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* eslint-disable padding-line-between-statements */
22
import _ from 'lodash'
3-
import { computed, observable } from 'mobx'
3+
import { computed, observable, makeObservable } from 'mobx'
44

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

@@ -45,6 +45,7 @@ export default class Err {
4545
@observable isRecovered: boolean = false
4646

4747
constructor (props?: Partial<ErrProps>) {
48+
makeObservable(this)
4849
this.update(props)
4950
}
5051

packages/reporter/src/header/stats-store.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import _ from 'lodash'
2-
import { action, computed, observable } from 'mobx'
2+
import { action, computed, observable, makeObservable } from 'mobx'
33
import { TestState } from '../test/test-model'
44
import { IntervalID } from '../lib/types'
55

@@ -25,6 +25,10 @@ class StatsStore {
2525

2626
private _interval?: IntervalID
2727

28+
constructor () {
29+
makeObservable(this)
30+
}
31+
2832
@computed get duration () {
2933
if (!this._startTime) return 0
3034

packages/reporter/src/hooks/hook-model.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import _ from 'lodash'
2-
import { observable, computed } from 'mobx'
2+
import { observable, computed, makeObservable } from 'mobx'
33

44
import { FileDetails } from '@packages/types'
55

@@ -30,6 +30,7 @@ export default class Hook implements HookProps {
3030
private _currentNumber = 1
3131

3232
constructor (props: HookProps) {
33+
makeObservable(this)
3334
this.hookId = props.hookId
3435
this.hookName = props.hookName
3536
this.invocationDetails = props.invocationDetails

packages/reporter/src/instruments/instrument-model.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { observable } from 'mobx'
1+
import { observable, makeObservable } from 'mobx'
22
import { Instrument, TestState } from '@packages/types'
33

44
export interface AliasObject {
@@ -38,6 +38,7 @@ export default class Log {
3838
testId: string
3939

4040
constructor (props: InstrumentProps) {
41+
makeObservable(this)
4142
this.id = props.id
4243
this.alias = props.alias
4344
this.aliasType = props.aliasType

packages/reporter/src/lib/app-state.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import _ from 'lodash'
2-
import { observable } from 'mobx'
2+
import { observable, makeObservable } from 'mobx'
33

44
interface DefaultAppState {
55
isPaused: boolean
@@ -36,6 +36,10 @@ class AppState {
3636
_resetAutoScrollingEnabledTo = true;
3737
[key: string]: any
3838

39+
constructor () {
40+
makeObservable(this)
41+
}
42+
3943
startRunning () {
4044
this.isRunning = true
4145
this.isStopped = false

packages/reporter/src/lib/flash-on-click.tsx

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { action, observable } from 'mobx'
1+
import { action, observable, makeObservable } from 'mobx'
22
import { observer } from 'mobx-react'
33
import PropTypes from 'prop-types'
44
import React, { Children, cloneElement, Component, MouseEvent, ReactElement, ReactNode } from 'react'
@@ -27,6 +27,11 @@ class FlashOnClick extends Component<Props> {
2727

2828
@observable _show = false
2929

30+
constructor (props: Props) {
31+
super(props)
32+
makeObservable(this)
33+
}
34+
3035
render () {
3136
const child = Children.only<ReactNode>(this.props.children)
3237

packages/reporter/src/lib/switch.tsx

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { action } from 'mobx'
1+
import { action, makeObservable } from 'mobx'
22
import { observer } from 'mobx-react'
33
import React, { Component } from 'react'
44

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

20+
constructor (props: Props) {
21+
super(props)
22+
makeObservable(this)
23+
}
24+
2025
render () {
2126
const { 'data-cy': dataCy, size = 'lg', value } = this.props
2227

packages/reporter/src/main-runner.scss.d.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
interface CssExports {
44

55
}
6-
export const cssExports: CssExports;
7-
export default cssExports;
6+
export const cssExports: CssExports
7+
8+
export default cssExports

packages/reporter/src/routes/route-model.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { observable } from 'mobx'
1+
import { observable, makeObservable } from 'mobx'
22
import Instrument, { InstrumentProps } from '../instruments/instrument-model'
33

44
export interface RouteProps extends InstrumentProps {
@@ -17,6 +17,8 @@ export default class Route extends Instrument {
1717
constructor (props: RouteProps) {
1818
super(props)
1919

20+
makeObservable(this)
21+
2022
this.isStubbed = props.isStubbed
2123
this.method = props.method
2224
this.numResponses = props.numResponses

packages/reporter/src/runnables/runnable-model.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { observable } from 'mobx'
1+
import { observable, makeObservable } from 'mobx'
22
import { HookProps } from '../hooks/hook-model'
33

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

1616
constructor (props: RunnableProps, level: number) {
17+
makeObservable(this)
1718
this.id = props.id
1819
this.title = props.title
1920
this.level = level

packages/reporter/src/runnables/runnables-store.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { TestFilter } from '@packages/types'
22
import _ from 'lodash'
3-
import { action, observable } from 'mobx'
3+
import { action, observable, makeObservable } from 'mobx'
44
import AgentModel, { AgentProps } from '../agents/agent-model'
55
import CommandModel, { CommandProps } from '../commands/command-model'
66
import { HookProps } from '../hooks/hook-model'
@@ -74,6 +74,7 @@ export class RunnablesStore {
7474
showingSnapshot = defaults.showingSnapshot
7575

7676
constructor ({ appState, scroller }: Props) {
77+
makeObservable(this)
7778
this.appState = appState
7879
this.scroller = scroller
7980
}

packages/reporter/src/runnables/suite-model.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import _ from 'lodash'
2-
import { computed, observable } from 'mobx'
2+
import { computed, observable, makeObservable } from 'mobx'
33
import Runnable, { RunnableProps } from './runnable-model'
44
import TestModel, { TestProps } from '../test/test-model'
55
import { TestState } from '@packages/types'
@@ -13,6 +13,12 @@ export default class Suite extends Runnable {
1313
@observable children: Array<TestModel | Suite> = []
1414
type = 'suite'
1515

16+
constructor (props: SuiteProps, level: number) {
17+
super(props, level)
18+
19+
makeObservable(this)
20+
}
21+
1622
@computed get state (): TestState {
1723
if (this._anyChildrenFailed) {
1824
return 'failed'

packages/reporter/src/sessions/sessions-model.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { observable } from 'mobx'
1+
import { observable, makeObservable } from 'mobx'
22
import Instrument, { InstrumentProps } from '../instruments/instrument-model'
33
import { determineTagType } from './utils'
44
import type { SessionStatus } from './utils'
@@ -15,13 +15,14 @@ export interface SessionProps extends InstrumentProps {
1515
}
1616

1717
export default class Session extends Instrument {
18-
@observable name: string
18+
name: string
1919
@observable status: string
2020
@observable isGlobalSession: boolean = false
2121
@observable tagType: string
2222

2323
constructor (props: SessionProps) {
2424
super(props)
25+
makeObservable(this)
2526
const { state, sessionInfo: { isGlobalSession, id, status } } = props
2627

2728
this.isGlobalSession = isGlobalSession

packages/reporter/src/test/test-model.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import _ from 'lodash'
2-
import { action, computed, observable } from 'mobx'
2+
import { action, computed, observable, makeObservable } from 'mobx'
33

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

65+
makeObservable(this)
66+
6567
this.invocationDetails = props.invocationDetails
6668

6769
this.hooks = [...props.hooks, {

0 commit comments

Comments
 (0)