Skip to content

Commit

Permalink
[SEO 18.] Add more docs + Vitest (#224)
Browse files Browse the repository at this point in the history
* update(rspec docs): make more actionable "Run a subset of tests" by adding links to env vars

* update(jest cookbook): add "Run a subset of tests"

* update(cypress cookbook): add "Run a subset of tests"

* update(vitest cookbook): add "Run a subset of tests"

* Update docusaurus.rb

* update(js clients): use one level indentation for the "Run a subset of tests" cookbook
  • Loading branch information
ArturT authored Jan 8, 2025
1 parent fe0900d commit 65560fa
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 2 deletions.
3 changes: 3 additions & 0 deletions _plugins/docusaurus.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ def system!(*args)
system!("mkdir -p _site/vitest/reference")
system!("cp docusaurus/build/vitest/reference/index.html _site/vitest/reference")

system!("mkdir -p _site/vitest/cookbook")
system!("cp docusaurus/build/vitest/cookbook/index.html _site/vitest/cookbook")

system!("mkdir -p _site/vitest/troubleshooting")
system!("cp docusaurus/build/vitest/troubleshooting/index.html _site/vitest/troubleshooting")

Expand Down
8 changes: 8 additions & 0 deletions docusaurus/docs/cypress/cookbook.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,11 @@ You should replace `$MY_CI_BUILD_ID` with the correct environment variable provi
| Semaphore 2.0 | `SEMAPHORE_WORKFLOW_ID` |
| Travis | `TRAVIS_BUILD_ID` |
| Codefresh.io | `CF_BUILD_ID` |

## Run a subset of tests

To run a subset of your test suite you can use the `KNAPSACK_PRO_TEST_FILE_*` environment variables:

- [`KNAPSACK_PRO_TEST_FILE_PATTERN`](reference.md#knapsack_pro_test_file_pattern)
- [`KNAPSACK_PRO_TEST_FILE_EXCLUDE_PATTERN`](reference.md#knapsack_pro_test_file_exclude_pattern)
- [`KNAPSACK_PRO_TEST_FILE_LIST_SOURCE_FILE`](reference.md#knapsack_pro_test_file_list_source_file)
8 changes: 8 additions & 0 deletions docusaurus/docs/jest/cookbook.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,11 @@ npx knapsack-pro-jest --ci --reporters=jest-junit
```

Knapsack Pro will generate one XML reports for each batch of tests executed on the CI node. Some CI providers (e.g., GitLab CI) can merge multiple XML files from parallel CI nodes.

## Run a subset of tests

To run a subset of your test suite you can use the `KNAPSACK_PRO_TEST_FILE_*` environment variables:

- [`KNAPSACK_PRO_TEST_FILE_PATTERN`](reference.md#knapsack_pro_test_file_pattern)
- [`KNAPSACK_PRO_TEST_FILE_EXCLUDE_PATTERN`](reference.md#knapsack_pro_test_file_exclude_pattern)
- [`KNAPSACK_PRO_TEST_FILE_LIST_SOURCE_FILE`](reference.md#knapsack_pro_test_file_list_source_file)
8 changes: 6 additions & 2 deletions docusaurus/docs/ruby/rspec.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,12 @@ bundle exec rake "knapsack_pro:queue:rspec[--fail-fast 3]"

To run a subset of your test suite you have a couple of options:

- `KNAPSACK_PRO_TEST_FILE_*` [environment variables](reference.md) (recommended)
- RSpec's `--tag MY_TAG`, `--tag ~MY_TAG`, `--tag type:feature`, or `--tag ~type:feature`
- `KNAPSACK_PRO_TEST_FILE_*` environment variables (recommended):
- [`KNAPSACK_PRO_TEST_FILE_PATTERN`](reference.md#knapsack_pro_test_file_pattern)
- [`KNAPSACK_PRO_TEST_FILE_EXCLUDE_PATTERN`](reference.md#knapsack_pro_test_file_exclude_pattern)
- [`KNAPSACK_PRO_TEST_FILE_LIST_SOURCE_FILE`](reference.md#knapsack_pro_test_file_list_source_file)
- [`KNAPSACK_PRO_TEST_FILE_LIST`](reference.md#knapsack_pro_test_file_list)
- RSpec's `--tag MY_TAG`, `--tag ~MY_TAG`, `--tag type:feature`, or `--tag ~type:feature`. See how to [pass command-line arguments](reference.md#command-line-arguments) here.

If you are seeking faster performance on your CI, you may want to read [Parallelize test examples (instead of files)](#parallelize-test-examples-instead-of-files)

Expand Down
14 changes: 14 additions & 0 deletions docusaurus/docs/vitest/cookbook.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
pagination_next: null
pagination_prev: null
---

# Vitest Cookbook

## Run a subset of tests

To run a subset of your test suite you can use the `KNAPSACK_PRO_TEST_FILE_*` environment variables:

- [`KNAPSACK_PRO_TEST_FILE_PATTERN`](reference.md#knapsack_pro_test_file_pattern)
- [`KNAPSACK_PRO_TEST_FILE_EXCLUDE_PATTERN`](reference.md#knapsack_pro_test_file_exclude_pattern)
- [`KNAPSACK_PRO_TEST_FILE_LIST_SOURCE_FILE`](reference.md#knapsack_pro_test_file_list_source_file)
5 changes: 5 additions & 0 deletions docusaurus/sidebars.ts
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,11 @@ const sidebars: SidebarsConfig = {
label: "Troubleshooting",
id: "vitest/troubleshooting",
},
{
type: "doc",
label: "Cookbook",
id: "vitest/cookbook",
},
{
type: "link",
label: "GitHub",
Expand Down

0 comments on commit 65560fa

Please sign in to comment.