Skip to content

Commit

Permalink
root.ts .
Browse files Browse the repository at this point in the history
  • Loading branch information
sainthkh committed Mar 15, 2022
1 parent 9f2abe6 commit 67dcf9b
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions packages/driver/src/cy/commands/querying/root.ts
@@ -1,23 +1,24 @@
import _ from 'lodash'

interface InternalRootOptions extends Partial<Cypress.Loggable & Cypress.Timeoutable> {
_log?: any
}

export default (Commands, Cypress, cy, state) => {
Commands.addAll({
// TODO: any -> Partial<Cypress.Loggable & Cypress.Timeoutable>
root (options: any = {}) {
const userOptions = options

options = _.defaults({}, userOptions, { log: true })
root (options: Partial<Cypress.Loggable & Cypress.Timeoutable> = {}) {
const _options: InternalRootOptions = _.defaults({}, options, { log: true })

if (options.log !== false) {
options._log = Cypress.log({
if (_options.log !== false) {
_options._log = Cypress.log({
message: '',
timeout: options.timeout,
timeout: _options.timeout,
})
}

const log = ($el) => {
if (options.log) {
options._log.set({ $el })
if (_options.log) {
_options._log.set({ $el })
}

return $el
Expand Down

0 comments on commit 67dcf9b

Please sign in to comment.