Skip to content

Commit

Permalink
chore: refactor log function to class (#20382)
Browse files Browse the repository at this point in the history
  • Loading branch information
sainthkh committed Mar 9, 2022
1 parent 047aefc commit 7d87da9
Show file tree
Hide file tree
Showing 5 changed files with 389 additions and 385 deletions.
4 changes: 2 additions & 2 deletions packages/driver/cypress/integration/cypress/log_spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const $Log = require('@packages/driver/src/cypress/log').default
const { create } = require('@packages/driver/src/cypress/log')

describe('src/cypress/log', function () {
context('#snapshot', function () {
Expand All @@ -11,7 +11,7 @@ describe('src/cypress/log', function () {
this.config = cy.stub()
this.config.withArgs('isInteractive').returns(true)
this.config.withArgs('numTestsKeptInMemory').returns(50)
this.log = $Log.create(Cypress, this.cy, this.state, this.config)
this.log = create(Cypress, this.cy, this.state, this.config)
})

it('creates a snapshot and returns the log', function () {
Expand Down
4 changes: 2 additions & 2 deletions packages/driver/src/cy/commands/navigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Promise from 'bluebird'

import $utils from '../../cypress/utils'
import $errUtils from '../../cypress/error_utils'
import $Log from '../../cypress/log'
import { LogUtils } from '../../cypress/log'
import { bothUrlsMatchAndOneHasHash } from '../navigation'
import { $Location } from '../../cypress/location'

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

return Cypress.action('cy:collect:run:state')
.then((a = []) => {
Expand Down
6 changes: 3 additions & 3 deletions packages/driver/src/cypress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import $dom from './dom'
import $Downloads from './cypress/downloads'
import $errorMessages from './cypress/error_messages'
import $errUtils from './cypress/error_utils'
import $Log from './cypress/log'
import { create as createLogFn, LogUtils } from './cypress/log'
import $LocalStorage from './cypress/local_storage'
import $Mocha from './cypress/mocha'
import { create as createMouse } from './cy/mouse'
Expand Down Expand Up @@ -115,7 +115,7 @@ class $Cypress {
errorMessages = $errorMessages
Keyboard = $Keyboard
Location = $Location
Log = $Log
Log = LogUtils
LocalStorage = $LocalStorage
Mocha = $Mocha
resolveWindowReference = resolvers.resolveWindowReference
Expand Down Expand Up @@ -323,7 +323,7 @@ class $Cypress {
this.cy = new $Cy(specWindow, this, this.Cookies, this.state, this.config)
window.cy = this.cy
this.isCy = this.cy.isCy
this.log = $Log.create(this, this.cy, this.state, this.config)
this.log = createLogFn(this, this.cy, this.state, this.config)
this.mocha = $Mocha.create(specWindow, this, this.config)
this.runner = $Runner.create(specWindow, this.mocha, this, this.cy, this.state)
this.downloads = $Downloads.create(this)
Expand Down
Loading

3 comments on commit 7d87da9

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 7d87da9 Mar 9, 2022

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 platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/9.5.2/linux-x64/develop-7d87da9a73f9cc01d294fa99632bd550e803dbb5/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 7d87da9 Mar 9, 2022

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 platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/9.5.2/darwin-x64/develop-7d87da9a73f9cc01d294fa99632bd550e803dbb5/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 7d87da9 Mar 9, 2022

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 platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/9.5.2/win32-x64/develop-7d87da9a73f9cc01d294fa99632bd550e803dbb5/cypress.tgz

Please sign in to comment.