Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/usage/discovery-and-run.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ In this case the `foreach` is evaluated during `Discovery` because we simply run
The example above has one more problem, if we move the setup to `BeforeDiscovery`, we will generate the tests correctly, and the `foreach` will define `$file` variable. But we won't be able to use the `$file` variable in the `It`. We need to attach it to the `It` using `-TestCases` with a single test case:

```powershell
BeforeDiscovery { # <- this will run during Discovery
BeforeDiscovery { # <- this runs in the Discovery phase, before the tests below are generated
# check all script files
$files = Get-ChildItem *.ps1
}
Expand Down
2 changes: 1 addition & 1 deletion versioned_docs/version-v5/usage/discovery-and-run.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ In this case the `foreach` is evaluated during `Discovery` because we simply run
The example above has one more problem, if we move the setup to `BeforeDiscovery`, we will generate the tests correctly, and the `foreach` will define `$file` variable. But we won't be able to use the `$file` variable in the `It`. We need to attach it to the `It` using `-TestCases` with a single test case:

```powershell
BeforeDiscovery { # <- this will run during Discovery
BeforeDiscovery { # <- this runs in the Discovery phase, before the tests below are generated
# check all script files
$files = Get-ChildItem *.ps1
}
Expand Down