diff --git a/.all-contributorsrc b/.all-contributorsrc index 007c6aaf..82b5d043 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -1589,6 +1589,15 @@ "contributions": [ "doc" ] + }, + { + "login": "DaniAcu", + "name": "Daniel AcuΓ±a", + "avatar_url": "https://avatars.githubusercontent.com/u/26409015?v=4", + "profile": "https://github.com/DaniAcu", + "contributions": [ + "code" + ] } ], "repoHost": "https://github.com", diff --git a/.codesandbox/ci.json b/.codesandbox/ci.json index 6457dc94..e650cd6f 100644 --- a/.codesandbox/ci.json +++ b/.codesandbox/ci.json @@ -1,5 +1,5 @@ { "installCommand": "install:csb", "sandboxes": ["github/kentcdodds/react-testing-library-examples"], - "node": "12" + "node": "14" } diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 8d626849..e6ee331b 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -26,7 +26,7 @@ jobs: # Otherwise we would not know if the problem is tied to the Node.js version fail-fast: false matrix: - node: [12, 14, 16] + node: [14, 16, 18] runs-on: ubuntu-latest steps: - name: πŸ›‘ Cancel Previous Runs diff --git a/README.md b/README.md index f286c57e..64706a7e 100644 --- a/README.md +++ b/README.md @@ -133,215 +133,216 @@ Thanks goes to these people ([emoji key][emojis]): - - - - - - - + + + + + + + - - - - - - - + + + + + + + - - - - - - - + + + + + + + - - - - - - - + + + + + + + - - - - - - - + + + + + + + - - - - - - - + + + + + + + - - - - - - - + + + + + + + - - - - - - - + + + + + + + - - - - - - - + + + + + + + - - - - - - - + + + + + + + - - - - - - - + + + + + + + - - - - - - - + + + + + + + - - - - - - - + + + + + + + - - - - - - - + + + + + + + - - - - - - - + + + + + + + - - - - - - - + + + + + + + - - - - - - - + + + + + + + - - - - - - - + + + + + + + - - - - - - - + + + + + + + - - - - - - - + + + + + + + - - - - - - - + + + + + + + - - - - - - - + + + + + + + - - - - - - - + + + + + + + - - + + +
Kent C. Dodds
Kent C. Dodds

πŸ’» πŸ“– πŸš‡ ⚠️
Greg BergΓ©
Greg BergΓ©

πŸ€”
Ryan Castner
Ryan Castner

πŸ“–
Daniel Sandiego
Daniel Sandiego

πŸ’»
PaweΕ‚ MikoΕ‚ajczyk
PaweΕ‚ MikoΕ‚ajczyk

πŸ’»
Alejandro ÑÑñez Ortiz
Alejandro ÑÑñez Ortiz

πŸ“–
Matt Parrish
Matt Parrish

πŸ› πŸ’» πŸ“– ⚠️
Kent C. Dodds
Kent C. Dodds

πŸ’» πŸ“– πŸš‡ ⚠️
Greg BergΓ©
Greg BergΓ©

πŸ€”
Ryan Castner
Ryan Castner

πŸ“–
Daniel Sandiego
Daniel Sandiego

πŸ’»
PaweΕ‚ MikoΕ‚ajczyk
PaweΕ‚ MikoΕ‚ajczyk

πŸ’»
Alejandro ÑÑñez Ortiz
Alejandro ÑÑñez Ortiz

πŸ“–
Matt Parrish
Matt Parrish

πŸ› πŸ’» πŸ“– ⚠️
Justin Hall
Justin Hall

πŸ“¦
Anto Aravinth
Anto Aravinth

πŸ’» ⚠️ πŸ“–
Jonah Moses
Jonah Moses

πŸ“–
Łukasz Gandecki
Łukasz Gandecki

πŸ’» ⚠️ πŸ“–
Ivan Babak
Ivan Babak

πŸ› πŸ€” πŸ’» πŸ“–
Jesse Day
Jesse Day

πŸ’»
Ernesto GarcΓ­a
Ernesto GarcΓ­a

πŸ’¬ πŸ’» πŸ“–
Justin Hall
Justin Hall

πŸ“¦
Anto Aravinth
Anto Aravinth

πŸ’» ⚠️ πŸ“–
Jonah Moses
Jonah Moses

πŸ“–
Łukasz Gandecki
Łukasz Gandecki

πŸ’» ⚠️ πŸ“–
Ivan Babak
Ivan Babak

πŸ› πŸ€” πŸ’» πŸ“–
Jesse Day
Jesse Day

πŸ’»
Ernesto GarcΓ­a
Ernesto GarcΓ­a

πŸ’¬ πŸ’» πŸ“–
Josef Maxx Blake
Josef Maxx Blake

πŸ’» πŸ“– ⚠️
Alex Cook
Alex Cook

πŸ“– πŸ’‘ πŸ‘€
Daniel Cook
Daniel Cook

πŸ’» πŸ“– ⚠️
Thomas Chia
Thomas Chia

πŸ› πŸ’»
Tim Deschryver
Tim Deschryver

πŸ’» ⚠️ πŸ‘€
Alex Krolick
Alex Krolick

πŸ’»
Maddi Joyce
Maddi Joyce

πŸ’»
Josef Maxx Blake
Josef Maxx Blake

πŸ’» πŸ“– ⚠️
Alex Cook
Alex Cook

πŸ“– πŸ’‘ πŸ‘€
Daniel Cook
Daniel Cook

πŸ’» πŸ“– ⚠️
Thomas Chia
Thomas Chia

πŸ› πŸ’»
Tim Deschryver
Tim Deschryver

πŸ’» ⚠️ πŸ‘€
Alex Krolick
Alex Krolick

πŸ’»
Maddi Joyce
Maddi Joyce

πŸ’»
Peter Kamps
Peter Kamps

πŸ› πŸ’» ⚠️
Jonathan Stoye
Jonathan Stoye

πŸ“– πŸ’»
Sanghyeon Lee
Sanghyeon Lee

πŸ’‘
Justice Mba
Justice Mba

πŸ’» πŸ“– πŸ€”
Wayne Crouch
Wayne Crouch

πŸ’»
Ben Elliott
Ben Elliott

πŸ’»
Ruben Costa
Ruben Costa

πŸ’»
Peter Kamps
Peter Kamps

πŸ› πŸ’» ⚠️
Jonathan Stoye
Jonathan Stoye

πŸ“– πŸ’»
Sanghyeon Lee
Sanghyeon Lee

πŸ’‘
Justice Mba
Justice Mba

πŸ’» πŸ“– πŸ€”
Wayne Crouch
Wayne Crouch

πŸ’»
Ben Elliott
Ben Elliott

πŸ’»
Ruben Costa
Ruben Costa

πŸ’»
Robert Smith
Robert Smith

πŸ› πŸ€” πŸ“–
dadamssg
dadamssg

πŸ’»
Neil Kistner
Neil Kistner

πŸ’» ⚠️
Ben Chauvette
Ben Chauvette

πŸ’»
Jeff Baumgardt
Jeff Baumgardt

πŸ’» πŸ“–
Matan Kushner
Matan Kushner

πŸ’» πŸ“– πŸ€” ⚠️
Alex Wendte
Alex Wendte

πŸ’» πŸ“– ⚠️
Robert Smith
Robert Smith

πŸ› πŸ€” πŸ“–
dadamssg
dadamssg

πŸ’»
Neil Kistner
Neil Kistner

πŸ’» ⚠️
Ben Chauvette
Ben Chauvette

πŸ’»
Jeff Baumgardt
Jeff Baumgardt

πŸ’» πŸ“–
Matan Kushner
Matan Kushner

πŸ’» πŸ“– πŸ€” ⚠️
Alex Wendte
Alex Wendte

πŸ’» πŸ“– ⚠️
Tamas Fodor
Tamas Fodor

πŸ“–
Benjamin Eckardt
Benjamin Eckardt

πŸ’»
Ryan Campbell
Ryan Campbell

πŸ“–
Taylor Briggs
Taylor Briggs

⚠️
John Gozde
John Gozde

πŸ’»
C. T. Lin
C. T. Lin

πŸ“–
Terrence Wong
Terrence Wong

πŸ’»
Tamas Fodor
Tamas Fodor

πŸ“–
Benjamin Eckardt
Benjamin Eckardt

πŸ’»
Ryan Campbell
Ryan Campbell

πŸ“–
Taylor Briggs
Taylor Briggs

⚠️
John Gozde
John Gozde

πŸ’»
C. T. Lin
C. T. Lin

πŸ“–
Terrence Wong
Terrence Wong

πŸ’»
Soo Jae Hwang
Soo Jae Hwang

πŸ’»
Royston Shufflebotham
Royston Shufflebotham

πŸ› πŸ’» πŸ“– ⚠️
Vadim Brodsky
Vadim Brodsky

πŸ’»
Eunjae Lee
Eunjae Lee

πŸ’»
David Peter
David Peter

πŸ’»
Shy Alter
Shy Alter

πŸ’» πŸ“–
Łukasz Makuch
Łukasz Makuch

πŸ“¦
Soo Jae Hwang
Soo Jae Hwang

πŸ’»
Royston Shufflebotham
Royston Shufflebotham

πŸ› πŸ’» πŸ“– ⚠️
Vadim Brodsky
Vadim Brodsky

πŸ’»
Eunjae Lee
Eunjae Lee

πŸ’»
David Peter
David Peter

πŸ’»
Shy Alter
Shy Alter

πŸ’» πŸ“–
Łukasz Makuch
Łukasz Makuch

πŸ“¦
Tyler Haas
Tyler Haas

πŸ’» ⚠️
Vesa Laakso
Vesa Laakso

πŸ’» ⚠️
Tulsi Sapkota
Tulsi Sapkota

πŸ’»
Tiago Nunes
Tiago Nunes

πŸ’» ⚠️
JaxCavalera
JaxCavalera

πŸ’» πŸ‘€
bopfer
bopfer

⚠️
Jan Pfitzner
Jan Pfitzner

πŸ’»
Tyler Haas
Tyler Haas

πŸ’» ⚠️
Vesa Laakso
Vesa Laakso

πŸ’» ⚠️
Tulsi Sapkota
Tulsi Sapkota

πŸ’»
Tiago Nunes
Tiago Nunes

πŸ’» ⚠️
JaxCavalera
JaxCavalera

πŸ’» πŸ‘€
bopfer
bopfer

⚠️
Jan Pfitzner
Jan Pfitzner

πŸ’»
David
David

πŸ’»
Diego Hernandez
Diego Hernandez

πŸ’» ⚠️
Alex Young
Alex Young

πŸ’»
Paul Armstrong
Paul Armstrong

πŸ’» ⚠️
TamΓ‘s SzabΓ³
TamΓ‘s SzabΓ³

πŸ’» ⚠️
Dylan Piercey
Dylan Piercey

πŸ’» ⚠️
Michael Lasky
Michael Lasky

πŸ’» ⚠️ πŸ“–
David
David

πŸ’»
Diego Hernandez
Diego Hernandez

πŸ’» ⚠️
Alex Young
Alex Young

πŸ’»
Paul Armstrong
Paul Armstrong

πŸ’» ⚠️
TamΓ‘s SzabΓ³
TamΓ‘s SzabΓ³

πŸ’» ⚠️
Dylan Piercey
Dylan Piercey

πŸ’» ⚠️
Michael Lasky
Michael Lasky

πŸ’» ⚠️ πŸ“–
Sebastian Silbermann
Sebastian Silbermann

πŸ’» ⚠️ πŸ“– πŸš‡ πŸ‘€
Dylan Vann
Dylan Vann

πŸ’»
AdriΓ  Fontcuberta
AdriΓ  Fontcuberta

πŸ’» ⚠️ πŸ“–
Thomas Lombart
Thomas Lombart

πŸ’»
Sam Horton
Sam Horton

πŸ’» ⚠️
Andrew Hill
Andrew Hill

πŸ’»
Jan Amann
Jan Amann

πŸ’» ⚠️
Sebastian Silbermann
Sebastian Silbermann

πŸ’» ⚠️ πŸ“– πŸš‡ πŸ‘€
Dylan Vann
Dylan Vann

πŸ’»
AdriΓ  Fontcuberta
AdriΓ  Fontcuberta

πŸ’» ⚠️ πŸ“–
Thomas Lombart
Thomas Lombart

πŸ’»
Sam Horton
Sam Horton

πŸ’» ⚠️
Andrew Hill
Andrew Hill

πŸ’»
Jan Amann
Jan Amann

πŸ’» ⚠️
Brais PiΓ±eiro
Brais PiΓ±eiro

πŸ’» ⚠️
Dominykas BlyΕΎΔ—
Dominykas BlyΕΎΔ—

πŸ’» ⚠️
Olzhas Askar
Olzhas Askar

πŸ’» ⚠️ πŸ“–
Max Belsky
Max Belsky

πŸ’» ⚠️
Michael Mantel
Michael Mantel

⚠️
Tom Nagle
Tom Nagle

πŸ’»
Westbrook Johnson
Westbrook Johnson

πŸ’»
Brais PiΓ±eiro
Brais PiΓ±eiro

πŸ’» ⚠️
Dominykas BlyΕΎΔ—
Dominykas BlyΕΎΔ—

πŸ’» ⚠️
Olzhas Askar
Olzhas Askar

πŸ’» ⚠️ πŸ“–
Max Belsky
Max Belsky

πŸ’» ⚠️
Michael Mantel
Michael Mantel

⚠️
Tom Nagle
Tom Nagle

πŸ’»
Westbrook Johnson
Westbrook Johnson

πŸ’»
Mohammad Aziz
Mohammad Aziz

πŸ’» ⚠️
seetdev
seetdev

⚠️ πŸ’»
Xavier Garcia Buils
Xavier Garcia Buils

πŸ’» ⚠️
aw-davidson
aw-davidson

πŸ’» ⚠️
MichaΓ«l De Boey
MichaΓ«l De Boey

πŸ’»
Minh Nguyen
Minh Nguyen

πŸ’»
Egill SveinbjΓΆrnsson
Egill SveinbjΓΆrnsson

πŸ’»
Mohammad Aziz
Mohammad Aziz

πŸ’» ⚠️
seetdev
seetdev

⚠️ πŸ’»
Xavier Garcia Buils
Xavier Garcia Buils

πŸ’» ⚠️
aw-davidson
aw-davidson

πŸ’» ⚠️
MichaΓ«l De Boey
MichaΓ«l De Boey

πŸ’»
Minh Nguyen
Minh Nguyen

πŸ’»
Egill SveinbjΓΆrnsson
Egill SveinbjΓΆrnsson

πŸ’»
Pavel Pustovalov
Pavel Pustovalov

πŸ“–
Adam Palaniuk
Adam Palaniuk

πŸ’» ⚠️
Yama-Tomo
Yama-Tomo

πŸ’» ⚠️
Aaron Pettengill
Aaron Pettengill

πŸ’» ⚠️
Kate W. Boyd
Kate W. Boyd

πŸ’»
Rahul Suryakanth
Rahul Suryakanth

πŸ’» ⚠️
Jamie
Jamie

πŸ’» ⚠️
Pavel Pustovalov
Pavel Pustovalov

πŸ“–
Adam Palaniuk
Adam Palaniuk

πŸ’» ⚠️
Yama-Tomo
Yama-Tomo

πŸ’» ⚠️
Aaron Pettengill
Aaron Pettengill

πŸ’» ⚠️
Kate W. Boyd
Kate W. Boyd

πŸ’»
Rahul Suryakanth
Rahul Suryakanth

πŸ’» ⚠️
Jamie
Jamie

πŸ’» ⚠️
Nicolas Stepien
Nicolas Stepien

πŸ’»
Ken Powers
Ken Powers

πŸ’»
MichaΕ‚ Zdunek
MichaΕ‚ Zdunek

πŸ’»
Ali Nasserzadeh
Ali Nasserzadeh

πŸ’»
Darek Kay
Darek Kay

πŸ“– πŸ’» ⚠️
Lukas
Lukas

πŸ’» ⚠️
Tom Crockett
Tom Crockett

πŸ’» ⚠️
Nicolas Stepien
Nicolas Stepien

πŸ’»
Ken Powers
Ken Powers

πŸ’»
MichaΕ‚ Zdunek
MichaΕ‚ Zdunek

πŸ’»
Ali Nasserzadeh
Ali Nasserzadeh

πŸ’»
Darek Kay
Darek Kay

πŸ“– πŸ’» ⚠️
Lukas
Lukas

πŸ’» ⚠️
Tom Crockett
Tom Crockett

πŸ’» ⚠️
Kevin Brewer
Kevin Brewer

πŸ’» ⚠️
Ben Monro
Ben Monro

πŸ’» πŸ€” ⚠️ πŸ“–
Stephan Meijer
Stephan Meijer

πŸ€” πŸ’» ⚠️
JoΓ£o Forja
JoΓ£o Forja

πŸ’» ⚠️
Nick McCurdy
Nick McCurdy

πŸ“– πŸ’» ⚠️ πŸ‘€ πŸš‡
Caleb Meredith
Caleb Meredith

πŸ’»
Marco Moretti
Marco Moretti

πŸ’» ⚠️ πŸ‘€
Kevin Brewer
Kevin Brewer

πŸ’» ⚠️
Ben Monro
Ben Monro

πŸ’» πŸ€” ⚠️ πŸ“–
Stephan Meijer
Stephan Meijer

πŸ€” πŸ’» ⚠️
JoΓ£o Forja
JoΓ£o Forja

πŸ’» ⚠️
Nick McCurdy
Nick McCurdy

πŸ“– πŸ’» ⚠️ πŸ‘€ πŸš‡
Caleb Meredith
Caleb Meredith

πŸ’»
Marco Moretti
Marco Moretti

πŸ’» ⚠️ πŸ‘€
Travis Jefferson
Travis Jefferson

πŸ’» ⚠️
Maciej Jastrzebski
Maciej Jastrzebski

πŸ›
Geoff Harcourt
Geoff Harcourt

πŸ’»
Josh Goldberg
Josh Goldberg

πŸ’» ⚠️
Ken Gregory
Ken Gregory

πŸ’» ⚠️
Jacob Paris
Jacob Paris

πŸ’» ⚠️
keiya sasaki
keiya sasaki

πŸ“–
Travis Jefferson
Travis Jefferson

πŸ’» ⚠️
Maciej Jastrzebski
Maciej Jastrzebski

πŸ›
Geoff Harcourt
Geoff Harcourt

πŸ’»
Josh Goldberg
Josh Goldberg

πŸ’» ⚠️
Ken Gregory
Ken Gregory

πŸ’» ⚠️
Jacob Paris
Jacob Paris

πŸ’» ⚠️
keiya sasaki
keiya sasaki

πŸ“–
Idan Entin
Idan Entin

πŸ’» ⚠️
Deniz Susman
Deniz Susman

πŸ’»
Bianca Del Carretto
Bianca Del Carretto

⚠️ πŸ’»
Josh Lalonde
Josh Lalonde

πŸ’» ⚠️
Ioannis Papadopoulos
Ioannis Papadopoulos

πŸ’» ⚠️
Maxwell Newlands
Maxwell Newlands

πŸ’» ⚠️
Jared Luxenberg
Jared Luxenberg

πŸ’» ⚠️
Idan Entin
Idan Entin

πŸ’» ⚠️
Deniz Susman
Deniz Susman

πŸ’»
Bianca Del Carretto
Bianca Del Carretto

⚠️ πŸ’»
Josh Lalonde
Josh Lalonde

πŸ’» ⚠️
Ioannis Papadopoulos
Ioannis Papadopoulos

πŸ’» ⚠️
Maxwell Newlands
Maxwell Newlands

πŸ’» ⚠️
Jared Luxenberg
Jared Luxenberg

πŸ’» ⚠️
snizhana
snizhana

πŸ’» ⚠️
Michael van Engelshoven
Michael van Engelshoven

πŸ‘€
Asher Tuggle
Asher Tuggle

πŸ›
Winter LaMon
Winter LaMon

πŸ’» ⚠️
Victor Cordova
Victor Cordova

πŸ’» ⚠️
slowselfip
slowselfip

πŸ›
Dmitry Semigradsky
Dmitry Semigradsky

πŸ’»
snizhana
snizhana

πŸ’» ⚠️
Michael van Engelshoven
Michael van Engelshoven

πŸ‘€
Asher Tuggle
Asher Tuggle

πŸ›
Winter LaMon
Winter LaMon

πŸ’» ⚠️
Victor Cordova
Victor Cordova

πŸ’» ⚠️
slowselfip
slowselfip

πŸ›
Dmitry Semigradsky
Dmitry Semigradsky

πŸ’»
Adam
Adam

πŸ’» ⚠️
balavishnuvj
balavishnuvj

πŸ’»
Chris Colborne
Chris Colborne

πŸ’»
Romain Trotard
Romain Trotard

πŸ’»
Thomas Marshall
Thomas Marshall

πŸ’» ⚠️
johnjessewood
johnjessewood

πŸ› πŸ’»
Ari PerkkiΓΆ
Ari PerkkiΓΆ

πŸ› πŸ’» πŸ“–
Adam
Adam

πŸ’» ⚠️
balavishnuvj
balavishnuvj

πŸ’»
Chris Colborne
Chris Colborne

πŸ’»
Romain Trotard
Romain Trotard

πŸ’»
Thomas Marshall
Thomas Marshall

πŸ’» ⚠️
johnjessewood
johnjessewood

πŸ› πŸ’»
Ari PerkkiΓΆ
Ari PerkkiΓΆ

πŸ› πŸ’» πŸ“–
Nathan Force
Nathan Force

πŸ’»
Philipp Fritsche
Philipp Fritsche

πŸ’»
Renato Alencar
Renato Alencar

πŸ’» ⚠️
Simen Bekkhus
Simen Bekkhus

πŸ›
Dan Abramov
Dan Abramov

πŸ› πŸ‘€
Matan Borenkraout
Matan Borenkraout

πŸ’»
simcha90
simcha90

πŸ’»
Nathan Force
Nathan Force

πŸ’»
Philipp Fritsche
Philipp Fritsche

πŸ’»
Renato Alencar
Renato Alencar

πŸ’» ⚠️
Simen Bekkhus
Simen Bekkhus

πŸ›
Dan Abramov
Dan Abramov

πŸ› πŸ‘€
Matan Borenkraout
Matan Borenkraout

πŸ’»
simcha90
simcha90

πŸ’»
Amit Miran
Amit Miran

πŸš‡
Dominik Lesch
Dominik Lesch

πŸ“–
Gareth Jones
Gareth Jones

πŸ’» ⚠️
Rayat Rahman
Rayat Rahman

πŸ’»
Nik Savchenko
Nik Savchenko

πŸ’»
Kevin Fleischman
Kevin Fleischman

πŸ’» ⚠️
Beth Hitch
Beth Hitch

πŸ’»
Amit Miran
Amit Miran

πŸš‡
Dominik Lesch
Dominik Lesch

πŸ“–
Gareth Jones
Gareth Jones

πŸ’» ⚠️
Rayat Rahman
Rayat Rahman

πŸ’»
Nik Savchenko
Nik Savchenko

πŸ’»
Kevin Fleischman
Kevin Fleischman

πŸ’» ⚠️
Beth Hitch
Beth Hitch

πŸ’»
Jack Laurence
Jack Laurence

πŸ’»
SantoJambit
SantoJambit

πŸ’»
Yashu Mittal
Yashu Mittal

πŸ“–
Ian VanSchooten
Ian VanSchooten

πŸ’»
Vanya Prokopovich
Vanya Prokopovich

πŸ›
James Nail
James Nail

πŸ›
Rob Caldecott
Rob Caldecott

πŸ›
Jack Laurence
Jack Laurence

πŸ’»
SantoJambit
SantoJambit

πŸ’»
Yashu Mittal
Yashu Mittal

πŸ“–
Ian VanSchooten
Ian VanSchooten

πŸ’»
Vanya Prokopovich
Vanya Prokopovich

πŸ›
James Nail
James Nail

πŸ›
Rob Caldecott
Rob Caldecott

πŸ›
Dennis273
Dennis273

πŸ’»
Jackson Hardaker
Jackson Hardaker

⚠️
Robin Drexler
Robin Drexler

πŸ’»
Omer Dolev
Omer Dolev

πŸ’»
Lirlev48
Lirlev48

πŸ’»
Tarnay KΓ‘lmΓ‘n
Tarnay KΓ‘lmΓ‘n

πŸ’»
Than Hutchins
Than Hutchins

πŸ’»
Dennis273
Dennis273

πŸ’»
Jackson Hardaker
Jackson Hardaker

⚠️
Robin Drexler
Robin Drexler

πŸ’»
Omer Dolev
Omer Dolev

πŸ’»
Lirlev48
Lirlev48

πŸ’»
Tarnay KΓ‘lmΓ‘n
Tarnay KΓ‘lmΓ‘n

πŸ’»
Than Hutchins
Than Hutchins

πŸ’»
RaphaΓ«l LEMIEUX
RaphaΓ«l LEMIEUX

πŸ’»
Arthur Lauck Vilas Boas
Arthur Lauck Vilas Boas

πŸ“–
RaphaΓ«l LEMIEUX
RaphaΓ«l LEMIEUX

πŸ’»
Arthur Lauck Vilas Boas
Arthur Lauck Vilas Boas

πŸ“–
Daniel AcuΓ±a
Daniel AcuΓ±a

πŸ’»
diff --git a/package.json b/package.json index a1f50bd2..fd4a11d1 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "author": "Kent C. Dodds (https://kentcdodds.com)", "license": "MIT", "engines": { - "node": ">=12" + "node": ">=14" }, "browserslist": [ "and_chr 103", @@ -40,7 +40,7 @@ "safari 15.5", "samsung 17.0", "samsung 16.0", - "node 12.0" + "node 14.0" ], "scripts": { "build": "kcd-scripts build --no-ts-defs --ignore \"**/__tests__/**,**/__node_tests__/**,**/__mocks__/**\" && kcd-scripts build --no-ts-defs --bundle --no-clean", @@ -74,8 +74,8 @@ "jest-in-case": "^1.0.2", "jest-snapshot-serializer-ansi": "^1.0.0", "jest-watch-select-projects": "^2.0.0", - "jsdom": "^16.4.0", - "kcd-scripts": "^11.0.0", + "jsdom": "20.0.0", + "kcd-scripts": "^13.0.0", "typescript": "^4.1.2" }, "eslintConfig": { @@ -83,10 +83,14 @@ "./node_modules/kcd-scripts/eslint.js", "plugin:import/typescript" ], + "parserOptions": { + "ecmaVersion": 2020 + }, "rules": { "@typescript-eslint/prefer-optional-chain": "off", "@typescript-eslint/no-explicit-any": "off", "@typescript-eslint/no-unsafe-member-access": "off", + "@typescript-eslint/no-unnecessary-boolean-literal-compare": "off", "@typescript-eslint/prefer-includes": "off", "import/prefer-default-export": "off", "import/no-unassigned-import": "off", diff --git a/src/__tests__/config.js b/src/__tests__/config.js index 40123a53..21729a58 100644 --- a/src/__tests__/config.js +++ b/src/__tests__/config.js @@ -11,14 +11,15 @@ describe('configuration API', () => { return {} }) }) - afterEach(() => { - configure(originalConfig) - }) beforeEach(() => { configure({other: 123}) }) + afterEach(() => { + configure(originalConfig) + }) + describe('getConfig', () => { test('returns existing configuration', () => { const conf = getConfig() diff --git a/src/__tests__/element-queries.js b/src/__tests__/element-queries.js index 364de4aa..f3bc0ab0 100644 --- a/src/__tests__/element-queries.js +++ b/src/__tests__/element-queries.js @@ -788,23 +788,21 @@ test('queryAllByRole returns semantic html elements', () => { `) - expect(queryAllByRole(/table/i)).toHaveLength(1) - expect(queryAllByRole(/tabl/i, {exact: false})).toHaveLength(1) - expect(queryAllByRole(/columnheader/i)).toHaveLength(1) - expect(queryAllByRole(/rowheader/i)).toHaveLength(1) - expect(queryAllByRole(/grid/i)).toHaveLength(1) - expect(queryAllByRole(/form/i)).toHaveLength(0) - expect(queryAllByRole(/button/i)).toHaveLength(1) - expect(queryAllByRole(/heading/i)).toHaveLength(6) + expect(queryAllByRole('table')).toHaveLength(1) + expect(queryAllByRole('columnheader')).toHaveLength(1) + expect(queryAllByRole('rowheader')).toHaveLength(1) + expect(queryAllByRole('grid')).toHaveLength(1) + expect(queryAllByRole('form')).toHaveLength(0) + expect(queryAllByRole('button')).toHaveLength(1) + expect(queryAllByRole('heading')).toHaveLength(6) expect(queryAllByRole('list')).toHaveLength(2) - expect(queryAllByRole(/listitem/i)).toHaveLength(3) - expect(queryAllByRole(/textbox/i)).toHaveLength(2) - expect(queryAllByRole(/checkbox/i)).toHaveLength(1) - expect(queryAllByRole(/radio/i)).toHaveLength(1) + expect(queryAllByRole('listitem')).toHaveLength(3) + expect(queryAllByRole('textbox')).toHaveLength(2) + expect(queryAllByRole('checkbox')).toHaveLength(1) + expect(queryAllByRole('radio')).toHaveLength(1) expect(queryAllByRole('row')).toHaveLength(3) - expect(queryAllByRole(/rowgroup/i)).toHaveLength(2) - expect(queryAllByRole(/(table)|(textbox)/i)).toHaveLength(3) - expect(queryAllByRole(/img/i)).toHaveLength(1) + expect(queryAllByRole('rowgroup')).toHaveLength(2) + expect(queryAllByRole('img')).toHaveLength(1) expect(queryAllByRole('meter')).toHaveLength(1) expect(queryAllByRole('progressbar')).toHaveLength(0) expect(queryAllByRole('progressbar', {queryFallbacks: true})).toHaveLength(1) @@ -812,11 +810,6 @@ test('queryAllByRole returns semantic html elements', () => { expect(queryAllByRole('listbox')).toHaveLength(1) }) -test('queryByRole matches case with non-string matcher', () => { - const {queryByRole} = render(``) - expect(queryByRole(1)).toBeTruthy() -}) - test('getAll* matchers return an array', () => { const { getAllByAltText, @@ -827,7 +820,7 @@ test('getAll* matchers return an array', () => { getAllByText, getAllByRole, } = render(` -
+
finding nemo poster { expect(getAllByDisplayValue('Japanese cars')).toHaveLength(1) expect(getAllByDisplayValue(/cars$/)).toHaveLength(2) expect(getAllByText(/^where/i)).toHaveLength(1) - expect(getAllByRole(/container/i)).toHaveLength(1) + expect(getAllByRole('section')).toHaveLength(1) expect(getAllByRole('meter')).toHaveLength(1) expect(getAllByRole('progressbar', {queryFallbacks: true})).toHaveLength(1) }) @@ -879,7 +872,7 @@ test('getAll* matchers throw for 0 matches', () => { getAllByText, getAllByRole, } = render(` -
+
, `) diff --git a/src/__tests__/fake-timers.js b/src/__tests__/fake-timers.js index b9700af3..6cf7ca5f 100644 --- a/src/__tests__/fake-timers.js +++ b/src/__tests__/fake-timers.js @@ -70,6 +70,7 @@ test('recursive timers do not cause issues', async () => { let recurse = true function startTimer() { setTimeout(() => { + // eslint-disable-next-line jest/no-conditional-in-test -- false-positive if (recurse) startTimer() }, 1) } diff --git a/src/__tests__/get-by-errors.js b/src/__tests__/get-by-errors.js index c7e8cadf..47b4d896 100644 --- a/src/__tests__/get-by-errors.js +++ b/src/__tests__/get-by-errors.js @@ -36,8 +36,8 @@ cases( html: `
`, }, getByRole: { - query: /his/, - html: `
`, + query: 'button', + html: `
two`, }, getByTestId: { query: /his/, @@ -87,8 +87,8 @@ cases( html: `
`, }, queryByRole: { - query: /his/, - html: `
`, + query: 'button', + html: `
two`, }, queryByTestId: { query: /his/, diff --git a/src/__tests__/role.js b/src/__tests__/role.js index c709d82e..63872cda 100644 --- a/src/__tests__/role.js +++ b/src/__tests__/role.js @@ -274,6 +274,7 @@ test('accessible name filter implements TextMatch', () => { expect( getByRole('heading', { name: (name, element) => { + // eslint-disable-next-line jest/no-conditional-in-test -- false-positive return element.nodeName === 'H2' && name === 'Your Signature' }, }), @@ -564,11 +565,11 @@ describe('configuration', () => { queryByRole('button', {name: 'Hello, Dave!'}) expect(console.error).toHaveBeenCalledTimes(2) - expect(console.error.mock.calls[0][0]).toMatch( - 'Error: Not implemented: window.computedStyle(elt, pseudoElt)', + expect(console.error.mock.calls[0][0].message).toMatch( + 'Not implemented: window.computedStyle(elt, pseudoElt)', ) - expect(console.error.mock.calls[1][0]).toMatch( - 'Error: Not implemented: window.computedStyle(elt, pseudoElt)', + expect(console.error.mock.calls[1][0].message).toMatch( + 'Not implemented: window.computedStyle(elt, pseudoElt)', ) } finally { jest.restoreAllMocks() diff --git a/src/__tests__/suggestions.js b/src/__tests__/suggestions.js index 79a12821..08ce2f7c 100644 --- a/src/__tests__/suggestions.js +++ b/src/__tests__/suggestions.js @@ -612,8 +612,8 @@ test('should suggest hidden option if element is not in the accessibility tree', suggestion.toString() expect(console.warn.mock.calls).toMatchInlineSnapshot(` - Array [ - Array [ + [ + [ Element is inaccessible. This means that the element and all its children are invisible to screen readers. If you are using the aria-hidden prop, make sure this is the right choice for your case. , @@ -649,9 +649,9 @@ test('should find label text using the aria-labelledby', () => { warning: '', }, ` - Object { - queryArgs: Array [ - Object {}, + { + queryArgs: [ + {}, ], queryMethod: getByLabelText, queryName: LabelText, diff --git a/src/__tests__/text-matchers.js b/src/__tests__/text-matchers.js index d272f15a..05d096f7 100644 --- a/src/__tests__/text-matchers.js +++ b/src/__tests__/text-matchers.js @@ -291,10 +291,6 @@ cases( dom: ``, queryFn: 'queryAllByDisplayValue', }, - queryAllByRole: { - dom: ``, - queryFn: 'queryAllByRole', - }, }, ) diff --git a/src/__tests__/wait-for-element-to-be-removed.js b/src/__tests__/wait-for-element-to-be-removed.js index 775b8b82..6ea0a091 100644 --- a/src/__tests__/wait-for-element-to-be-removed.js +++ b/src/__tests__/wait-for-element-to-be-removed.js @@ -98,6 +98,7 @@ test('rethrows non-testing-lib errors', () => { const error = new Error('my own error') return expect( waitForElementToBeRemoved(() => { + // eslint-disable-next-line jest/no-conditional-in-test -- false-positive if (throwIt) { throw error } diff --git a/src/__tests__/wait-for.js b/src/__tests__/wait-for.js index a80b9fe4..03814020 100644 --- a/src/__tests__/wait-for.js +++ b/src/__tests__/wait-for.js @@ -275,7 +275,7 @@ test('does not work after it resolves', async () => { context = 'act' try { const result = callback() - // eslint-disable-next-line jest/no-if + // eslint-disable-next-line jest/no-if, jest/no-conditional-in-test -- false-positive if (typeof result?.then === 'function') { const thenable = result return { @@ -319,6 +319,7 @@ test('does not work after it resolves', async () => { await waitFor( () => { + // eslint-disable-next-line jest/no-conditional-in-test -- false-positive if (data === null) { throw new Error('not found') } diff --git a/src/helpers.ts b/src/helpers.ts index 5a068300..77d30d6a 100644 --- a/src/helpers.ts +++ b/src/helpers.ts @@ -10,6 +10,7 @@ function jestFakeTimersAreEnabled() { // legacy timers (setTimeout as any)._isMockFunction === true || // modern timers + // eslint-disable-next-line prefer-object-has-own -- not supported by our support matrix Object.prototype.hasOwnProperty.call(setTimeout, 'clock') ) } diff --git a/src/queries/label-text.ts b/src/queries/label-text.ts index 39e766d5..33eaba6b 100644 --- a/src/queries/label-text.ts +++ b/src/queries/label-text.ts @@ -71,20 +71,23 @@ const queryAllByLabelText: AllByText = ( if ( matcher(label.content, label.formControl, text, matchNormalizer) && label.formControl - ) + ) { labelledElements.push(label.formControl) + } }) const labelsValue = labelList .filter(label => Boolean(label.content)) .map(label => label.content) if ( matcher(labelsValue.join(' '), labelledElement, text, matchNormalizer) - ) + ) { labelledElements.push(labelledElement) + } if (labelsValue.length > 1) { labelsValue.forEach((labelValue, index) => { - if (matcher(labelValue, labelledElement, text, matchNormalizer)) + if (matcher(labelValue, labelledElement, text, matchNormalizer)) { labelledElements.push(labelledElement) + } const labelsFiltered = [...labelsValue] labelsFiltered.splice(index, 1) @@ -97,8 +100,9 @@ const queryAllByLabelText: AllByText = ( text, matchNormalizer, ) - ) + ) { labelledElements.push(labelledElement) + } } }) } diff --git a/src/queries/role.js b/src/queries/role.ts similarity index 73% rename from src/queries/role.js rename to src/queries/role.ts index a46d8a2b..f8e976a4 100644 --- a/src/queries/role.js +++ b/src/queries/role.ts @@ -2,7 +2,11 @@ import { computeAccessibleDescription, computeAccessibleName, } from 'dom-accessibility-api' -import {roles as allRoles, roleElements} from 'aria-query' +import { + roles as allRoles, + roleElements, + ARIARoleDefinitionKey, +} from 'aria-query' import { computeAriaSelected, computeAriaChecked, @@ -18,24 +22,24 @@ import { import {wrapAllByQueryWithSuggestion} from '../query-helpers' import {checkContainerType} from '../helpers' import { - buildQueries, - fuzzyMatches, - getConfig, - makeNormalizer, - matches, -} from './all-utils' + AllByRole, + ByRoleMatcher, + ByRoleOptions, + GetErrorFunction, + Matcher, + MatcherFunction, + MatcherOptions, +} from '../../types' + +import {buildQueries, getConfig, matches} from './all-utils' -function queryAllByRole( +const queryAllByRole: AllByRole = ( container, role, { - exact = true, - collapseWhitespace, hidden = getConfig().defaultHidden, name, description, - trim, - normalizer, queryFallbacks = false, selected, checked, @@ -44,28 +48,35 @@ function queryAllByRole( level, expanded, } = {}, -) { +) => { checkContainerType(container) - const matcher = exact ? matches : fuzzyMatches - const matchNormalizer = makeNormalizer({collapseWhitespace, trim, normalizer}) if (selected !== undefined) { // guard against unknown roles - if (allRoles.get(role)?.props['aria-selected'] === undefined) { + if ( + allRoles.get(role as ARIARoleDefinitionKey)?.props['aria-selected'] === + undefined + ) { throw new Error(`"aria-selected" is not supported on role "${role}".`) } } if (checked !== undefined) { // guard against unknown roles - if (allRoles.get(role)?.props['aria-checked'] === undefined) { + if ( + allRoles.get(role as ARIARoleDefinitionKey)?.props['aria-checked'] === + undefined + ) { throw new Error(`"aria-checked" is not supported on role "${role}".`) } } if (pressed !== undefined) { // guard against unknown roles - if (allRoles.get(role)?.props['aria-pressed'] === undefined) { + if ( + allRoles.get(role as ARIARoleDefinitionKey)?.props['aria-pressed'] === + undefined + ) { throw new Error(`"aria-pressed" is not supported on role "${role}".`) } } @@ -75,7 +86,10 @@ function queryAllByRole( // guard against unknown roles // All currently released ARIA versions support `aria-current` on all roles. // Leaving this for symetry and forward compatibility - if (allRoles.get(role)?.props['aria-current'] === undefined) { + if ( + allRoles.get(role as ARIARoleDefinitionKey)?.props['aria-current'] === + undefined + ) { throw new Error(`"aria-current" is not supported on role "${role}".`) } } @@ -89,51 +103,50 @@ function queryAllByRole( if (expanded !== undefined) { // guard against unknown roles - if (allRoles.get(role)?.props['aria-expanded'] === undefined) { + if ( + allRoles.get(role as ARIARoleDefinitionKey)?.props['aria-expanded'] === + undefined + ) { throw new Error(`"aria-expanded" is not supported on role "${role}".`) } } - const subtreeIsInaccessibleCache = new WeakMap() - function cachedIsSubtreeInaccessible(element) { + const subtreeIsInaccessibleCache = new WeakMap() + function cachedIsSubtreeInaccessible(element: Element) { if (!subtreeIsInaccessibleCache.has(element)) { subtreeIsInaccessibleCache.set(element, isSubtreeInaccessible(element)) } - return subtreeIsInaccessibleCache.get(element) + return subtreeIsInaccessibleCache.get(element) as boolean } return Array.from( - container.querySelectorAll( + container.querySelectorAll( // Only query elements that can be matched by the following filters - makeRoleSelector(role, exact, normalizer ? matchNormalizer : undefined), + makeRoleSelector(role), ), ) .filter(node => { const isRoleSpecifiedExplicitly = node.hasAttribute('role') if (isRoleSpecifiedExplicitly) { - const roleValue = node.getAttribute('role') + const roleValue = node.getAttribute('role') as string if (queryFallbacks) { return roleValue .split(' ') .filter(Boolean) - .some(text => matcher(text, node, role, matchNormalizer)) - } - // if a custom normalizer is passed then let normalizer handle the role value - if (normalizer) { - return matcher(roleValue, node, role, matchNormalizer) + .some(roleAttributeToken => roleAttributeToken === role) } - // other wise only send the first word to match - const [firstWord] = roleValue.split(' ') - return matcher(firstWord, node, role, matchNormalizer) + // other wise only send the first token to match + const [firstRoleAttributeToken] = roleValue.split(' ') + return firstRoleAttributeToken === role } - const implicitRoles = getImplicitAriaRoles(node) + const implicitRoles = getImplicitAriaRoles(node) as string[] - return implicitRoles.some(implicitRole => - matcher(implicitRole, node, role, matchNormalizer), - ) + return implicitRoles.some(implicitRole => { + return implicitRole === role + }) }) .filter(element => { if (selected !== undefined) { @@ -169,7 +182,7 @@ function queryAllByRole( getConfig().computedStyleSupportsPseudoElements, }), element, - name, + name as MatcherFunction, text => text, ) }) @@ -185,7 +198,7 @@ function queryAllByRole( getConfig().computedStyleSupportsPseudoElements, }), element, - description, + description as Matcher, text => text, ) }) @@ -198,16 +211,11 @@ function queryAllByRole( }) } -function makeRoleSelector(role, exact, customNormalizer) { - if (typeof role !== 'string') { - // For non-string role parameters we can not determine the implicitRoleSelectors. - return '*' - } - - const explicitRoleSelector = - exact && !customNormalizer ? `*[role~="${role}"]` : '*[role]' +function makeRoleSelector(role: ByRoleMatcher) { + const explicitRoleSelector = `*[role~="${role}"]` - const roleRelations = roleElements.get(role) ?? new Set() + const roleRelations = + roleElements.get(role as ARIARoleDefinitionKey) ?? new Set() const implicitRoleSelectors = new Set( Array.from(roleRelations).map(({name}) => name), ) @@ -220,7 +228,7 @@ function makeRoleSelector(role, exact, customNormalizer) { .join(',') } -const getNameHint = name => { +const getNameHint = (name: ByRoleOptions['name']): string => { let nameHint = '' if (name === undefined) { nameHint = '' @@ -233,11 +241,15 @@ const getNameHint = name => { return nameHint } -const getMultipleError = (c, role, {name} = {}) => { +const getMultipleError: GetErrorFunction< + [matcher: ByRoleMatcher, options: ByRoleOptions] +> = (c, role, {name} = {}) => { return `Found multiple elements with the role "${role}"${getNameHint(name)}` } -const getMissingError = ( +const getMissingError: GetErrorFunction< + [matcher: ByRoleMatcher, options: ByRoleOptions] +> = ( container, role, {hidden = getConfig().defaultHidden, name, description} = {}, @@ -247,7 +259,7 @@ const getMissingError = ( } let roles = '' - Array.from(container.children).forEach(childElement => { + Array.from((container as Element).children).forEach(childElement => { roles += prettyRoles(childElement, { hidden, includeDescription: description !== undefined, @@ -297,11 +309,10 @@ Unable to find an ${ ${roleMessage}`.trim() } -const queryAllByRoleWithSuggestions = wrapAllByQueryWithSuggestion( - queryAllByRole, - queryAllByRole.name, - 'queryAll', -) +const queryAllByRoleWithSuggestions = wrapAllByQueryWithSuggestion< + // @ts-expect-error -- See `wrapAllByQueryWithSuggestion` Argument constraint comment + [labelText: Matcher, options?: MatcherOptions] +>(queryAllByRole, queryAllByRole.name, 'queryAll') const [queryByRole, getAllByRole, getByRole, findAllByRole, findByRole] = buildQueries(queryAllByRole, getMultipleError, getMissingError) diff --git a/src/query-helpers.ts b/src/query-helpers.ts index 155210e1..44328e69 100644 --- a/src/query-helpers.ts +++ b/src/query-helpers.ts @@ -1,11 +1,11 @@ -import type { - GetErrorFunction, - Matcher, - MatcherOptions, - QueryMethod, - Variant, - waitForOptions as WaitForOptions, - WithSuggest, +import { + type GetErrorFunction, + type Matcher, + type MatcherOptions, + type QueryMethod, + type Variant, + type waitForOptions as WaitForOptions, + type WithSuggest, } from '../types' import {getSuggestedQuery} from './suggestions' import {fuzzyMatches, matches, makeNormalizer} from './matches' @@ -117,16 +117,16 @@ function makeGetAllQuery( // this accepts a getter query function and returns a function which calls // waitFor and passing a function which invokes the getter. -function makeFindQuery( +function makeFindQuery( getter: ( container: HTMLElement, - text: Matcher, + text: QueryMatcher, options: MatcherOptions, ) => QueryFor, ) { return ( container: HTMLElement, - text: Matcher, + text: QueryMatcher, options: MatcherOptions, waitForOptions: WaitForOptions, ) => { @@ -209,16 +209,16 @@ const wrapAllByQueryWithSuggestion = // TODO: This deviates from the published declarations // However, the implementation always required a dyadic (after `container`) not variadic `queryAllBy` considering the implementation of `makeFindQuery` // This is at least statically true and can be verified by accepting `QueryMethod` -function buildQueries( +function buildQueries( queryAllBy: QueryMethod< - [matcher: Matcher, options: MatcherOptions], + [matcher: QueryMatcher, options: MatcherOptions], HTMLElement[] >, getMultipleError: GetErrorFunction< - [matcher: Matcher, options: MatcherOptions] + [matcher: QueryMatcher, options: MatcherOptions] >, getMissingError: GetErrorFunction< - [matcher: Matcher, options: MatcherOptions] + [matcher: QueryMatcher, options: MatcherOptions] >, ) { const queryBy = wrapSingleQueryWithSuggestion( diff --git a/src/screen.ts b/src/screen.ts index 9034b159..fbe372ff 100644 --- a/src/screen.ts +++ b/src/screen.ts @@ -1,7 +1,7 @@ // WARNING: `lz-string` only has a default export but statically we assume named exports are allowd // TODO: Statically verify we don't rely on NodeJS implicit named imports. import lzString from 'lz-string' -import type {OptionsReceived} from 'pretty-format' +import {type OptionsReceived} from 'pretty-format' import {getQueriesForElement} from './get-queries-for-element' import {getDocument} from './helpers' import {logDOM} from './pretty-dom' diff --git a/tests/jest.config.dom.js b/tests/jest.config.dom.js index 72b3b24b..d67874d9 100644 --- a/tests/jest.config.dom.js +++ b/tests/jest.config.dom.js @@ -1,7 +1,12 @@ const path = require('path') -const baseConfig = require('kcd-scripts/jest') +const { + // global config options that would trigger warnings in project configs + collectCoverageFrom, + watchPlugins, + ...baseConfig +} = require('kcd-scripts/jest') -module.exports = { +const projectConfig = { ...baseConfig, rootDir: path.join(__dirname, '..'), displayName: 'dom', @@ -12,3 +17,5 @@ module.exports = { ], testEnvironment: 'jest-environment-jsdom', } + +module.exports = projectConfig diff --git a/tests/jest.config.node.js b/tests/jest.config.node.js index bf37b60b..e387de9a 100644 --- a/tests/jest.config.node.js +++ b/tests/jest.config.node.js @@ -1,7 +1,12 @@ const path = require('path') -const baseConfig = require('kcd-scripts/jest') +const { + // global config options that would trigger warnings in project configs + collectCoverageFrom, + watchPlugins, + ...baseConfig +} = require('kcd-scripts/jest') -module.exports = { +const projectConfig = { ...baseConfig, rootDir: path.join(__dirname, '..'), displayName: 'node', @@ -13,3 +18,5 @@ module.exports = { ], testMatch: ['**/__node_tests__/**.js'], } + +module.exports = projectConfig diff --git a/types/__tests__/type-tests.ts b/types/__tests__/type-tests.ts index 7a3212cf..4e1a4fb2 100644 --- a/types/__tests__/type-tests.ts +++ b/types/__tests__/type-tests.ts @@ -182,11 +182,8 @@ export async function testByRole() { }) === null, ) - // allow to query for a role that isn't included in the types console.assert(queryByRole(element, 'foo') === null) - console.assert(queryByRole(element, /foo/) === null) console.assert(screen.queryByRole('foo') === null) - console.assert(screen.queryByRole(/foo/) === null) } export function testA11yHelper() { diff --git a/types/matches.d.ts b/types/matches.d.ts index 13fa3692..9df51680 100644 --- a/types/matches.d.ts +++ b/types/matches.d.ts @@ -7,8 +7,8 @@ export type MatcherFunction = ( export type Matcher = MatcherFunction | RegExp | number | string // Get autocomplete for ARIARole union types, while still supporting another string -// Ref: https://github.com/microsoft/TypeScript/issues/29729#issuecomment-505826972 -export type ByRoleMatcher = ARIARole | MatcherFunction | {} +// Ref: https://github.com/microsoft/TypeScript/issues/29729#issuecomment-567871939 +export type ByRoleMatcher = ARIARole | (string & {}) export type NormalizerFn = (text: string) => string diff --git a/types/queries.d.ts b/types/queries.d.ts index 1fb66b7d..cea02365 100644 --- a/types/queries.d.ts +++ b/types/queries.d.ts @@ -66,7 +66,9 @@ export type FindByText = ( waitForElementOptions?: waitForOptions, ) => Promise -export interface ByRoleOptions extends MatcherOptions { +export interface ByRoleOptions { + /** suppress suggestions for a specific query */ + suggest?: boolean /** * If true includes elements in the query set that are usually excluded from * the accessibility tree. `role="none"` or `role="presentation"` are included