Skip to content

Commit f3b15f2

Browse files
committed
add video embeds
1 parent d1c81ce commit f3b15f2

File tree

38 files changed

+89
-15
lines changed

38 files changed

+89
-15
lines changed

exercises/01.setup/01.problem.vscode-extension/README.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Visual Studio Code extension
22

3+
<EpicVideo url="https://www.epicweb.dev/workshops/advanced-vitest-patterns/setup/01-01-problem" />
4+
35
Think about your testing loop right now. Most likely, it looks something like this:
46

57
1. You write some code;

exercises/01.setup/01.solution.vscode-extension/README.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Visual Studio Code extension
22

3+
<EpicVideo url="https://www.epicweb.dev/workshops/advanced-vitest-patterns/setup/01-01-problem/solution" />
4+
35
There is a couple of things that the Vitest extension enables you to do.
46

57
## Running tests inline

exercises/01.setup/02.problem.multiple-workspaces/README.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Multiple workspaces
22

3+
<EpicVideo url="https://www.epicweb.dev/workshops/advanced-vitest-patterns/setup/01-02-problem" />
4+
35
Vitest is an extremely versatile testing framework. You can use it for your unit tests in Node.js, for your integration tests, for component-level testing with the [Browser Mode](https://vitest.dev/guide/browser/), for benchmarking... All within the same tool. But those are still quite different tests and as such, they may require different configurations to run.
46

57
You can configure multiple test projects, or [workspaces](https://vitest.dev/guide/workspace.html#defining-a-workspace), within the same repository to help Vitest differentiate between all the layers of testing you have. This is a great way to utilize Vitest to the fullest while implementing a great test coverage.

exercises/01.setup/02.solution.multiple-workspaces/README.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Multiple workspaces
22

3+
<EpicVideo url="https://www.epicweb.dev/workshops/advanced-vitest-patterns/setup/01-02-problem/solution" />
4+
35
## Defining workspaces
46

57
First, I will configure Vitest to have two workspaces.

exercises/01.setup/03.problem.code-coverage/README.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Code coverage
22

3+
<EpicVideo url="https://www.epicweb.dev/workshops/advanced-vitest-patterns/setup/01-03-problem" />
4+
35
Code coverage can be a useful metric if done right. I find code coverage more of a guide to tell you about the state of your test suite than a barred threshold one must pass and never, ever lower. It can point to the areas you haven't covered with tests but you are still the one to decide the appropriate strategy to address that.
46

57
<callout-info>You can learn more about code coverage, its dangers, and where you would use it in my article called :scroll: [Making Sense of Code Coverage](https://www.epicweb.dev/making-use-of-code-coverage).</callout-info>

exercises/01.setup/03.solution.code-coverage/README.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Code coverage
22

3+
<EpicVideo url="https://www.epicweb.dev/workshops/advanced-vitest-patterns/setup/01-03-problem/solution" />
4+
35
Since I've got `@vitest/coverage-v8` installed, I will go straight to `vitest.config.ts` and set `test.coverage` option to `true`.
46

57
```ts file=vitest.config.ts add=6-8

exercises/01.setup/FINISHED.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
# Setup
22

3+
<EpicVideo url="https://www.epicweb.dev/workshops/advanced-vitest-patterns/setup/01-99-outro" />
4+
35
Great job! :tada: The first exercise block is done. Take a quick break and come back to continue with the test context.

exercises/01.setup/README.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Setup
22

3+
<EpicVideo url="https://www.epicweb.dev/workshops/advanced-vitest-patterns/setup/01-00-introduction" />
4+
35
<callout-success>Proficiency with any tool starts from the proper configuration.</callout-success>
46

57
Let's kick things off by getting your more productive with Vitest. Specifically, focusing on the following areas:

exercises/02.context/01.problem.custom-fixtures/README.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Custom fixtures
22

3+
<EpicVideo url="https://www.epicweb.dev/workshops/advanced-vitest-patterns/context/02-01-problem" />
4+
35
Crafting custom, domain-specific utilities is a great way to elevate your test setup and turn your tests into a _composition_ of declarative steps and assertions that follow them. As always, there are multiple ways to approach test utilities. You can just import them when you need them _or_ you can use _fixtures_ instead.
46

57
Vitest's concept of a fixture is heavily inspired by Playwright, where you can access both built-in and custom fixtures from the test context:

exercises/02.context/01.solution.custom-fixtures/README.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Custom fixtures
22

3+
<EpicVideo url="https://www.epicweb.dev/workshops/advanced-vitest-patterns/context/02-01-problem/solution" />
4+
35
Once I've got `@faker-js/faker` installed, I will head to a newly created `test-extend.ts` module and implement my custom fixture.
46

57
When it comes to any API design, I like approaching it _usage-first_. I create the usage experience I want and then deal with the implementation details to bring that vision to life. This custom fixture is no exception.

0 commit comments

Comments
 (0)