[Question] How to ignore first argument in test()

See original GitHub issue

I’m using @playwright/test v1.14.1. I followed the instruction in this page https://playwright.dev/docs/test-parallel/#reusing-single-page-between-tests. All seems fine, until I try to ignore first parameter in the test() by using _ as I normally doing in typescript. When I try to run the test I got this error: Error: First argument must use the object destructuring pattern: _

test.describe.serial('test case 1', () => {
  test('test step 1', async (_, testInfo) => {
    // Error: First argument must use the object destructuring pattern: _
  })
})

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
A-ZC-Laucommented, Nov 19, 2021

Curious, why is the destructuring required?

Why can’t I just do test("test", async (t) => t.page.goto(somewhere))

2reactions
Nhasacommented, Nov 9, 2021

@mxschmitt thanks for your answer. Yes, that solve the error, but I need to turn off my eslint rule. https://eslint.org/docs/rules/no-empty-pattern I will live with this for now. It would be great if we could use _ instead of {} in the future.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Jest test function ignoring first two arguments - Stack Overflow
I'm currently trying to test some of my code using jest but for some reason if I send in 4 arguments in the...
Read more >
How to skip the first argument in a script - Unix Stack Exchange
You can use shift command like this: shift for arg in "$@" do cat "$arg" done.
Read more >
Ignore some arguments · Issue #30 · gojuno/minimock - GitHub
I personally like first solution better because func that we pass to the Inspect has exactly same arguments as the method we're mocking....
Read more >
Loose assertions on arguments passed to function with Jest
Use the asymetric matcher expect.anything() to ignore the first argument passed to foo . test("Match any argument" ...
Read more >
Chapter 4 Labeled arguments - OCaml
Note that if that argument is labeled, you will only be able to eliminate optional arguments by totally applying the function, omitting all...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found