Skip to content

Commit e10e4db

Browse files
committed
feat: add "log" option to hide displayed log of cy.origin()
1 parent 2dce6d5 commit e10e4db

File tree

4 files changed

+10
-2
lines changed

4 files changed

+10
-2
lines changed

cli/CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33

44
_Released 2/25/2025 (PENDING)_
55

6+
**Features:**
7+
8+
- Add `log: boolean` option to hide the `cy.origin()` log. Addressed in [#31114](https://github.com/cypress-io/cypress/pull/31114).
9+
610
## 14.0.3
711

812
_Released 2/11/2025_

cli/types/cypress.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1663,7 +1663,7 @@ declare namespace Cypress {
16631663
* expect(foo).to.equal('foo')
16641664
* })
16651665
*/
1666-
origin<T, S extends any>(urlOrDomain: string, options: {
1666+
origin<T, S extends any>(urlOrDomain: string, options: Partial<Loggable> & {
16671667
args: T
16681668
}, fn: (args: T) => void): Chainable<S>
16691669

cli/types/tests/cypress-tests.ts

+2
Original file line numberDiff line numberDiff line change
@@ -1012,6 +1012,8 @@ namespace CypressOriginTests {
10121012
cy.origin('example.com', { args: 'value' }, (value: string) => { })
10131013
cy.origin('example.com', { args: 1 }, (value: number) => { })
10141014
cy.origin('example.com', { args: true }, (value: boolean) => { })
1015+
cy.origin('example.com', { args: true, log: true }, (value: boolean) => { })
1016+
cy.origin('example.com', { args: true, log: false }, (value: boolean) => { })
10151017

10161018
cy.origin() // $ExpectError
10171019
cy.origin('example.com') // $ExpectError

packages/driver/src/cy/commands/origin/index.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const normalizeOrigin = (urlOrDomain) => {
2525
return $Location.normalize(origin)
2626
}
2727

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

3131
export default (Commands, Cypress: Cypress.Cypress, cy: Cypress.cy, state: StateFunc, config: Cypress.InternalConfig) => {
@@ -57,6 +57,7 @@ export default (Commands, Cypress: Cypress.Cypress, cy: Cypress.cy, state: State
5757
callbackFn = optionsOrFn
5858
options = {
5959
args: undefined,
60+
log: undefined,
6061
}
6162
}
6263

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

0 commit comments

Comments
 (0)