Skip to content

fix(fixtures): make undefined option mean "default value"#16026

Merged
dgozman merged 1 commit into
microsoft:mainfrom
dgozman:tr-undefined-to-default
Jul 28, 2022
Merged

fix(fixtures): make undefined option mean "default value"#16026
dgozman merged 1 commit into
microsoft:mainfrom
dgozman:tr-undefined-to-default

Conversation

@dgozman
Copy link
Copy Markdown
Collaborator

@dgozman dgozman commented Jul 28, 2022

In the following example, locale inside the describe would be reverted to the default value:

test.use({ locale: 'en-GB' });

test.decsribe(() => {
  test.use({ locale: undefined });
});

Fixes #14989.

In the following example, `locale` inside the `describe`
would be reverted to the default value:

```js
test.use({ locale: 'en-GB' });

test.decsribe(() => {
  test.use({ locale: undefined });
});
```

// Overriding option with "undefined" value means setting it to the default value
// from the original declaration of the option.
if (fn === undefined && options.option && previous) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fn is a bit weird in this context, consider a more descriptive name valueOrFn maybe?

@dgozman dgozman merged commit 3d89506 into microsoft:main Jul 28, 2022
mxschmitt pushed a commit to mxschmitt/playwright that referenced this pull request Aug 9, 2022
…16026)

In the following example, `locale` inside the `describe`
would be reverted to the default value:

```js
test.use({ locale: 'en-GB' });

test.decsribe(() => {
  test.use({ locale: undefined });
});
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Setting the use.trace option to undefined causes TypeError: Cannot read property 'mode' of undefined

2 participants