Skip to content

Commit 67dcf9b

Browse files
committed
root.ts .
1 parent 9f2abe6 commit 67dcf9b

File tree

1 file changed

+11
-10
lines changed
  • packages/driver/src/cy/commands/querying

1 file changed

+11
-10
lines changed

packages/driver/src/cy/commands/querying/root.ts

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
11
import _ from 'lodash'
22

3+
interface InternalRootOptions extends Partial<Cypress.Loggable & Cypress.Timeoutable> {
4+
_log?: any
5+
}
6+
37
export default (Commands, Cypress, cy, state) => {
48
Commands.addAll({
5-
// TODO: any -> Partial<Cypress.Loggable & Cypress.Timeoutable>
6-
root (options: any = {}) {
7-
const userOptions = options
8-
9-
options = _.defaults({}, userOptions, { log: true })
9+
root (options: Partial<Cypress.Loggable & Cypress.Timeoutable> = {}) {
10+
const _options: InternalRootOptions = _.defaults({}, options, { log: true })
1011

11-
if (options.log !== false) {
12-
options._log = Cypress.log({
12+
if (_options.log !== false) {
13+
_options._log = Cypress.log({
1314
message: '',
14-
timeout: options.timeout,
15+
timeout: _options.timeout,
1516
})
1617
}
1718

1819
const log = ($el) => {
19-
if (options.log) {
20-
options._log.set({ $el })
20+
if (_options.log) {
21+
_options._log.set({ $el })
2122
}
2223

2324
return $el

0 commit comments

Comments
 (0)