Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions packages/driver/src/cy/commands/agents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,6 @@ const onInvoke = function (Cypress, obj, args) {
const { agent } = obj
const agentName = agent._cyName

// bail if we've turned off logging this agent
if (agent._log === false) {
return
}

// fakes are children of the agent created with `withArgs`
const fakes = agent.matchingFakes(args)

Expand All @@ -59,6 +54,11 @@ const onInvoke = function (Cypress, obj, args) {
fake._cyLog.set('callCount', fake.callCount)
}

// bail if we've turned off logging this agent
if (agent._log === false) {
return
}

const logProps = {
name: agentName,
message: obj.message,
Expand Down
9 changes: 9 additions & 0 deletions packages/runner/cypress/fixtures/issues/issue-18042.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
it('test', () => {
const obj = {
foo () {},
}
const stub = cy.stub(obj, 'foo').log(false).as('foo')

obj.foo('foo', 'bar')
expect(stub).to.be.called
})
16 changes: 16 additions & 0 deletions packages/runner/cypress/integration/issues/issue-18042.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const helpers = require('../../support/helpers')

const { createCypress } = helpers
const { runIsolatedCypress } = createCypress()

// https://github.com/cypress-io/cypress/issues/18042
describe('issue 18042', () => {
beforeEach(function () {
return runIsolatedCypress(`cypress/fixtures/issues/issue-18042.js`)
})

it('Call count is shown even if cy.stub().log(false)', function () {
cy.contains('Spies / Stubs (1)').click()
cy.get('.call-count').eq(1).should('have.text', '1')
})
})