Skip to content
Closed
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
4 changes: 4 additions & 0 deletions cli/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@

_Released 2/25/2025 (PENDING)_

**Features:**

- Add `log: boolean` option to hide the `cy.origin()` log. Addressed in [#31114](https://github.com/cypress-io/cypress/pull/31114).

## 14.0.3

_Released 2/11/2025_
Expand Down
2 changes: 1 addition & 1 deletion cli/types/cypress.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1663,7 +1663,7 @@ declare namespace Cypress {
* expect(foo).to.equal('foo')
* })
*/
origin<T, S extends any>(urlOrDomain: string, options: {
origin<T, S extends any>(urlOrDomain: string, options: Partial<Loggable> & {
args: T
}, fn: (args: T) => void): Chainable<S>

Expand Down
2 changes: 2 additions & 0 deletions cli/types/tests/cypress-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1012,6 +1012,8 @@ namespace CypressOriginTests {
cy.origin('example.com', { args: 'value' }, (value: string) => { })
cy.origin('example.com', { args: 1 }, (value: number) => { })
cy.origin('example.com', { args: true }, (value: boolean) => { })
cy.origin('example.com', { args: true, log: true }, (value: boolean) => { })
cy.origin('example.com', { args: true, log: false }, (value: boolean) => { })

cy.origin() // $ExpectError
cy.origin('example.com') // $ExpectError
Expand Down
4 changes: 3 additions & 1 deletion packages/driver/src/cy/commands/origin/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const normalizeOrigin = (urlOrDomain) => {
return $Location.normalize(origin)
}

type OptionsOrFn<T> = { args: T } | (() => {})
type OptionsOrFn<T> = (Partial<Cypress.Loggable> & { args: T }) | (() => {})
type Fn<T> = (args?: T) => {}

export default (Commands, Cypress: Cypress.Cypress, cy: Cypress.cy, state: StateFunc, config: Cypress.InternalConfig) => {
Expand Down Expand Up @@ -57,6 +57,7 @@ export default (Commands, Cypress: Cypress.Cypress, cy: Cypress.cy, state: State
callbackFn = optionsOrFn
options = {
args: undefined,
log: undefined,
}
}

Expand All @@ -67,6 +68,7 @@ export default (Commands, Cypress: Cypress.Cypress, cy: Cypress.cy, state: State
type: 'parent',
message: urlOrDomain,
timeout,
log: !(options.log === false),
// @ts-ignore TODO: revisit once log-grouping has more implementations
}, (_log) => {
log = _log
Expand Down