Skip to content

Commit 067a8bc

Browse files
committed
add 03 and 04 exercise blocks
1 parent 8e00f66 commit 067a8bc

File tree

16 files changed

+57
-0
lines changed

16 files changed

+57
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Accessibility selectors
2+
3+
Problem: don't riddle your code with implementation details like `data-testId`. Select elements on the page like the user would actually see them—using the ARIA roles.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# User events
2+
3+
Problem: testing interactivity can be tricky. Let's explore how to use the `userEvent` object to perform user interactions like clicks, hovers, and uploads. In this one, let's test the `<App />` component and actually upload a test file to see its preview.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Inverse assertions
2+
3+
Problem: testing things that must _not_ appear on the page can lead to false-positive tests in no time. Let's learn about _inverse assertions_ that help you write such tests reliably.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Component wrappers
2+
3+
Problem: component rendering in tests can repeat things, like parent components. Let's see how to use the `wrapper` option of the `render()` function to simplify your test setup.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Page navigation
2+
3+
Problem: the component you are testing does navigation to another page. Let's see what exactly you should test here on the integration level and how to do so.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Network mocking
2+
3+
Problem: performing requests to an actual server makes your test dependent on the operability of that server, among other things. Instead, mock the network in your component tests using MSW.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Best practices
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Best practices
2+
3+
Best practices on writing integration tests.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Attach a debugger
2+
3+
1. Create a Visual Studio Code config.
4+
1. Showcase how to run Vitest with `--inspect`/`--inspect-brk` flag (and the difference between them).
5+
1. Showcase how to attach a debugger to the running browser.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "module",
3+
"name": "exercises_04.debugging_01.solution.attach-a-debugger"
4+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Breakpoints
2+
3+
1. Showcase how to step through a test using breakpoints.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "module",
3+
"name": "exercises_04.debugging_02.solution.breakpoints"
4+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Debug console
2+
3+
1. Showcase how to use the Debug Console in Visual Studio Code to evaluate expressions while at a breakpoint.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "module",
3+
"name": "exercises_04.debugging_03.solution.debug-console"
4+
}

exercises/04.debugging/README.mdx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Debugging tests
2+
3+
Learn how to debug your browser tests in Vitest. Your runbook to follow when a test fails.

tsconfig.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,15 @@
3333
},
3434
{
3535
"path": "exercises/02.vitest-browser-mode/06.solution.multiple-workspaces"
36+
},
37+
{
38+
"path": "exercises/04.debugging/01.solution.attach-a-debugger"
39+
},
40+
{
41+
"path": "exercises/04.debugging/02.solution.breakpoints"
42+
},
43+
{
44+
"path": "exercises/04.debugging/03.solution.debug-console"
3645
}
3746
]
3847
}

0 commit comments

Comments
 (0)