Skip to content

Commit 7d87da9

Browse files
authored
chore: refactor log function to class (#20382)
1 parent 047aefc commit 7d87da9

File tree

5 files changed

+389
-385
lines changed

5 files changed

+389
-385
lines changed

packages/driver/cypress/integration/cypress/log_spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const $Log = require('@packages/driver/src/cypress/log').default
1+
const { create } = require('@packages/driver/src/cypress/log')
22

33
describe('src/cypress/log', function () {
44
context('#snapshot', function () {
@@ -11,7 +11,7 @@ describe('src/cypress/log', function () {
1111
this.config = cy.stub()
1212
this.config.withArgs('isInteractive').returns(true)
1313
this.config.withArgs('numTestsKeptInMemory').returns(50)
14-
this.log = $Log.create(Cypress, this.cy, this.state, this.config)
14+
this.log = create(Cypress, this.cy, this.state, this.config)
1515
})
1616

1717
it('creates a snapshot and returns the log', function () {

packages/driver/src/cy/commands/navigation.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import Promise from 'bluebird'
55

66
import $utils from '../../cypress/utils'
77
import $errUtils from '../../cypress/error_utils'
8-
import $Log from '../../cypress/log'
8+
import { LogUtils } from '../../cypress/log'
99
import { bothUrlsMatchAndOneHasHash } from '../navigation'
1010
import { $Location } from '../../cypress/location'
1111

@@ -1022,7 +1022,7 @@ export default (Commands, Cypress, cy, state, config) => {
10221022
s.passed = Cypress.runner.countByTestState(s.tests, 'passed')
10231023
s.failed = Cypress.runner.countByTestState(s.tests, 'failed')
10241024
s.pending = Cypress.runner.countByTestState(s.tests, 'pending')
1025-
s.numLogs = $Log.countLogsByTests(s.tests)
1025+
s.numLogs = LogUtils.countLogsByTests(s.tests)
10261026

10271027
return Cypress.action('cy:collect:run:state')
10281028
.then((a = []) => {

packages/driver/src/cypress.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import $dom from './dom'
1717
import $Downloads from './cypress/downloads'
1818
import $errorMessages from './cypress/error_messages'
1919
import $errUtils from './cypress/error_utils'
20-
import $Log from './cypress/log'
20+
import { create as createLogFn, LogUtils } from './cypress/log'
2121
import $LocalStorage from './cypress/local_storage'
2222
import $Mocha from './cypress/mocha'
2323
import { create as createMouse } from './cy/mouse'
@@ -115,7 +115,7 @@ class $Cypress {
115115
errorMessages = $errorMessages
116116
Keyboard = $Keyboard
117117
Location = $Location
118-
Log = $Log
118+
Log = LogUtils
119119
LocalStorage = $LocalStorage
120120
Mocha = $Mocha
121121
resolveWindowReference = resolvers.resolveWindowReference
@@ -323,7 +323,7 @@ class $Cypress {
323323
this.cy = new $Cy(specWindow, this, this.Cookies, this.state, this.config)
324324
window.cy = this.cy
325325
this.isCy = this.cy.isCy
326-
this.log = $Log.create(this, this.cy, this.state, this.config)
326+
this.log = createLogFn(this, this.cy, this.state, this.config)
327327
this.mocha = $Mocha.create(specWindow, this, this.config)
328328
this.runner = $Runner.create(specWindow, this.mocha, this, this.cy, this.state)
329329
this.downloads = $Downloads.create(this)

0 commit comments

Comments
 (0)