Skip to content

Commit 6fe792e

Browse files
authored
Docusaurus v3 (#272)
* Upgrade to Docusaurus v3 and React v18 * Escape curly braces in MDX for v5 docs This needs to be fixed in source. MDX v2 allows expressions inside curly braces outside of codefences * Escape curly braces in MDX for v4 docs Manually fixed as v4 docs are not updated anymore MDX v2 allows expressions inside curly braces outside of codefences * Remove unused @svgr/webpack dependency * Replace classnames dependency with clsx clsx is faster, has same syntax and is also used in docusaurus * Fix summary in details-elements Summary got wrapped in the contents paragraph-element MDX v2 doesn't produce blocks for single line ocntent. We fix this by adding a blank line after summary, or just wrap text in ex. div-element * Upgrade to 3.0.0-beta.0 * Remove legacy prefix from versioned sidebars Support removed in 3.0.0-beta.0. Fix was documented in build error * Replace deprecated caution admonitions `:::caution` is deprecated in v3. `:::warning` has been updated with the same styling, so only real change is default title. * Upgrade to 3.0.0-rc.0 * Make config prism-react-renderer v2 compatible Remove xml as additional language * Cleanup dependencies Removes unused url-loader and file-loader. Adds prism-react-renderer as direct deps to support strict package manages without hoisting. * Bump Docusaurus to 3.0 GA
1 parent a71835b commit 6fe792e

32 files changed

+4239
-2543
lines changed

docs/assertions/assertions.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ Set-Content -Path TestDrive:\file.txt -Value 'I am a file.'
232232
```
233233
:::
234234

235-
:::caution
235+
:::warning
236236
Make sure the input is either a quoted string or an Item object. Otherwise PowerShell will try to invoke the
237237
path, likely throwing an error `Cannot run a document in the middle of a pipeline`.
238238

@@ -352,7 +352,7 @@ so the following assertion will pass:
352352
Wildcard-characters `?*[]` can be escaped using backtick, ex `` `*``.
353353
:::
354354

355-
:::caution
355+
:::warning
356356
The input object must be a ScriptBlock, otherwise it is processed outside of the assertion.
357357

358358
```powershell

docs/assertions/custom-assertions.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ If a problem occurs in your function, ex. it was called with invalid parameters,
2828
`Should` accepts the value to assert by pipeline but passes it to the assertion using `-ActualValue $ActualValue`. This means `ValueFromPipelineByPropertyName` is not available inside your function, but you can write your own logic to work with complex types provided to `ActualValue`.
2929
:::
3030

31-
:::caution Using advanced functions as assertions
31+
:::warning Using advanced functions as assertions
3232
Advanced functions, typically enabled by using `[CmdletBinding()]` or `[Parameter()]`, disallows arguments by default. In this scenario, make sure to accept all mandatory parameters in your param-block to avoid errors even if you don't use them. They are `ActualValue`, `Negate` and `CallerSessionState`.
3333
:::
3434

docs/commands/Assert-MockCalled.mdx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Assert-MockCalled [-CommandName] <String> [[-Times] <Int32>] [-ParameterFilter <
4242

4343
## DESCRIPTION
4444

45-
{{ Fill in the Description }}
45+
\{\{ Fill in the Description \}\}
4646

4747
## EXAMPLES
4848

@@ -52,13 +52,13 @@ Assert-MockCalled [-CommandName] <String> [[-Times] <Int32>] [-ParameterFilter <
5252
PS C:\> {{ Add example code here }}
5353
```
5454

55-
{{ Add example description here }}
55+
\{\{ Add example description here \}\}
5656

5757
## PARAMETERS
5858

5959
### -CommandName
6060

61-
{{ Fill CommandName Description }}
61+
\{\{ Fill CommandName Description \}\}
6262

6363
```yaml
6464
Type: String
@@ -74,7 +74,7 @@ Accept wildcard characters: False
7474
7575
### -Times
7676
77-
{{ Fill Times Description }}
77+
\{\{ Fill Times Description \}\}
7878
7979
```yaml
8080
Type: Int32
@@ -90,7 +90,7 @@ Accept wildcard characters: False
9090
9191
### -ParameterFilter
9292
93-
{{ Fill ParameterFilter Description }}
93+
\{\{ Fill ParameterFilter Description \}\}
9494
9595
```yaml
9696
Type: ScriptBlock
@@ -106,7 +106,7 @@ Accept wildcard characters: False
106106
107107
### -ExclusiveFilter
108108
109-
{{ Fill ExclusiveFilter Description }}
109+
\{\{ Fill ExclusiveFilter Description \}\}
110110
111111
```yaml
112112
Type: ScriptBlock
@@ -122,7 +122,7 @@ Accept wildcard characters: False
122122
123123
### -ModuleName
124124
125-
{{ Fill ModuleName Description }}
125+
\{\{ Fill ModuleName Description \}\}
126126
127127
```yaml
128128
Type: String
@@ -138,7 +138,7 @@ Accept wildcard characters: False
138138
139139
### -Scope
140140
141-
{{ Fill Scope Description }}
141+
\{\{ Fill Scope Description \}\}
142142
143143
```yaml
144144
Type: String
@@ -154,7 +154,7 @@ Accept wildcard characters: False
154154
155155
### -Exactly
156156
157-
{{ Fill Exactly Description }}
157+
\{\{ Fill Exactly Description \}\}
158158
159159
```yaml
160160
Type: SwitchParameter

docs/commands/Assert-VerifiableMock.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Assert-VerifiableMock [<CommonParameters>]
3131

3232
## DESCRIPTION
3333

34-
{{ Fill in the Description }}
34+
\{\{ Fill in the Description \}\}
3535

3636
## EXAMPLES
3737

@@ -41,7 +41,7 @@ Assert-VerifiableMock [<CommonParameters>]
4141
PS C:\> {{ Add example code here }}
4242
```
4343

44-
{{ Add example description here }}
44+
\{\{ Add example description here \}\}
4545

4646
## PARAMETERS
4747

docs/usage/_GetEmoji.mdx

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,24 @@
11
<details>
2-
<summary>Required code for samples (PowerShell 6 or later)</summary>
3-
To run the sample below, place this file in the same folder as Get-Emoji.Tests.ps1.
2+
<summary>Required code for samples (PowerShell 6 or later)</summary>
3+
<div>
4+
To run the sample below, place this file in the same folder as Get-Emoji.Tests.ps1.
45

5-
```powershell title="Get-Emoji.ps1"
6-
$emojis = @(
7-
@{ Name = 'apple'; Symbol = '🍎'; Kind = 'Fruit' }
8-
@{ Name = 'beaming face with smiling eyes'; Symbol = '😁'; Kind = 'Face' }
9-
@{ Name = 'cactus'; Symbol = '🌵'; Kind = 'Plant' }
10-
@{ Name = 'giraffe'; Symbol = '🦒'; Kind = 'Animal' }
11-
@{ Name = 'pencil'; Symbol = '✏️'; Kind = 'Item' }
12-
@{ Name = 'penguin'; Symbol = '🐧'; Kind = 'Animal' }
13-
@{ Name = 'pensive'; Symbol = '😔'; Kind = 'Face' }
14-
@{ Name = 'slightly smiling face'; Symbol = '🙂'; Kind = 'Face' }
15-
@{ Name = 'smiling face with smiling eyes'; Symbol = '😊'; Kind = 'Face' }
16-
) | ForEach-Object { [PSCustomObject]$_ }
6+
```powershell title="Get-Emoji.ps1"
7+
$emojis = @(
8+
@{ Name = 'apple'; Symbol = '🍎'; Kind = 'Fruit' }
9+
@{ Name = 'beaming face with smiling eyes'; Symbol = '😁'; Kind = 'Face' }
10+
@{ Name = 'cactus'; Symbol = '🌵'; Kind = 'Plant' }
11+
@{ Name = 'giraffe'; Symbol = '🦒'; Kind = 'Animal' }
12+
@{ Name = 'pencil'; Symbol = '✏️'; Kind = 'Item' }
13+
@{ Name = 'penguin'; Symbol = '🐧'; Kind = 'Animal' }
14+
@{ Name = 'pensive'; Symbol = '😔'; Kind = 'Face' }
15+
@{ Name = 'slightly smiling face'; Symbol = '🙂'; Kind = 'Face' }
16+
@{ Name = 'smiling face with smiling eyes'; Symbol = '😊'; Kind = 'Face' }
17+
) | ForEach-Object { [PSCustomObject]$_ }
1718
18-
function Get-Emoji ([string]$Name = '*') {
19-
$emojis | Where-Object Name -like $Name | ForEach-Object Symbol
20-
}
21-
```
19+
function Get-Emoji ([string]$Name = '*') {
20+
$emojis | Where-Object Name -like $Name | ForEach-Object Symbol
21+
}
22+
```
23+
</div>
2224
</details>

docs/usage/_PesterDemoFunctions.mdx

Lines changed: 46 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,55 @@
11
<details>
2-
<summary>Required code for samples (PowerShell 6 or later)</summary>
3-
This module is required for the Emoji and Fruit tests below. Copy and paste this in your console before running the tests.
2+
<summary>Required code for samples (PowerShell 6 or later)</summary>
3+
<div>
4+
This module is required for the Emoji and Fruit tests below. Copy and paste this in your console before running the tests.
45

5-
```powershell
6-
Get-Module PesterDemoFunctions | Remove-Module
7-
New-Module PesterDemoFunctions -ScriptBlock {
8-
$emojis = @(
9-
@{ Name = 'apple'; Symbol = '🍎'; Kind = 'Fruit' }
10-
@{ Name = 'beaming face with smiling eyes'; Symbol = '😁'; Kind = 'Face' }
11-
@{ Name = 'cactus'; Symbol = '🌵'; Kind = 'Plant' }
12-
@{ Name = 'giraffe'; Symbol = '🦒'; Kind = 'Animal' }
13-
@{ Name = 'pencil'; Symbol = '✏️'; Kind = 'Item' }
14-
@{ Name = 'penguin'; Symbol = '🐧'; Kind = 'Animal' }
15-
@{ Name = 'pensive'; Symbol = '😔'; Kind = 'Face' }
16-
@{ Name = 'slightly smiling face'; Symbol = '🙂'; Kind = 'Face' }
17-
@{ Name = 'smiling face with smiling eyes'; Symbol = '😊'; Kind = 'Face' }
18-
) | ForEach-Object { [PSCustomObject]$_ }
6+
```powershell
7+
Get-Module PesterDemoFunctions | Remove-Module
8+
New-Module PesterDemoFunctions -ScriptBlock {
9+
$emojis = @(
10+
@{ Name = 'apple'; Symbol = '🍎'; Kind = 'Fruit' }
11+
@{ Name = 'beaming face with smiling eyes'; Symbol = '😁'; Kind = 'Face' }
12+
@{ Name = 'cactus'; Symbol = '🌵'; Kind = 'Plant' }
13+
@{ Name = 'giraffe'; Symbol = '🦒'; Kind = 'Animal' }
14+
@{ Name = 'pencil'; Symbol = '✏️'; Kind = 'Item' }
15+
@{ Name = 'penguin'; Symbol = '🐧'; Kind = 'Animal' }
16+
@{ Name = 'pensive'; Symbol = '😔'; Kind = 'Face' }
17+
@{ Name = 'slightly smiling face'; Symbol = '🙂'; Kind = 'Face' }
18+
@{ Name = 'smiling face with smiling eyes'; Symbol = '😊'; Kind = 'Face' }
19+
) | ForEach-Object { [PSCustomObject]$_ }
1920
20-
function Get-Emoji ([string]$Name = '*') {
21-
$script:emojis | Where-Object Name -like $Name | ForEach-Object Symbol
22-
}
21+
function Get-Emoji ([string]$Name = '*') {
22+
$script:emojis | Where-Object Name -like $Name | ForEach-Object Symbol
23+
}
2324
24-
function Get-EmojiKind {
25-
param(
26-
[Parameter(Mandatory = $true, ValueFromPipeline = $true)]
27-
[string]$Emoji
28-
)
29-
process {
30-
$script:emojis | Where-Object Symbol -eq $Emoji | Foreach-Object Kind
31-
}
32-
}
25+
function Get-EmojiKind {
26+
param(
27+
[Parameter(Mandatory = $true, ValueFromPipeline = $true)]
28+
[string]$Emoji
29+
)
30+
process {
31+
$script:emojis | Where-Object Symbol -eq $Emoji | Foreach-Object Kind
32+
}
33+
}
3334
34-
$fruitBasket = [System.Collections.ArrayList]@('🍎','🍌','🥝','🥑','🍇','🍐')
35+
$fruitBasket = [System.Collections.ArrayList]@('🍎','🍌','🥝','🥑','🍇','🍐')
3536
36-
function Get-FruitBasket {
37-
$script:fruitBasket
38-
}
37+
function Get-FruitBasket {
38+
$script:fruitBasket
39+
}
3940
40-
function Remove-FruitBasket {
41-
param(
42-
[Parameter(Mandatory = $true)]
43-
[string]$Item
44-
)
45-
$script:fruitBasket.Remove($Item)
46-
}
41+
function Remove-FruitBasket {
42+
param(
43+
[Parameter(Mandatory = $true)]
44+
[string]$Item
45+
)
46+
$script:fruitBasket.Remove($Item)
47+
}
4748
48-
function Reset-FruitBasket {
49-
$script:fruitBasket = [System.Collections.ArrayList]@('🍎','🍌','🥝','🥑','🍇','🍐')
50-
}
51-
} | Import-Module
52-
```
49+
function Reset-FruitBasket {
50+
$script:fruitBasket = [System.Collections.ArrayList]@('🍎','🍌','🥝','🥑','🍇','🍐')
51+
}
52+
} | Import-Module
53+
```
54+
</div>
5355
</details>

docs/usage/importing-tested-functions.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ BeforeAll {
3232

3333
This avoids spelling out the name of the referenced file every time.
3434

35-
:::caution
35+
:::warning
3636
The code above is using `string.Replace()` method which is case sensitive. Make sure you say `Tests` and that the test file is named `.Tests.ps1`.
3737
:::
3838

39-
:::caution
39+
:::warning
4040
Pester v4 users might be inclined not to use the `BeforeAll` block or to use `$MyInvocation.MyCommand.Path` in `BeforeAll`. Neither will work. See [Migrating from Pester v4](#migrating-from-pester-v4).
4141
:::
4242

docs/usage/modules.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ Describe "Unit testing the module's internal Build function:" {
112112

113113
Notice that when using `InModuleScope`, you no longer need to specify a `-ModuleName` parameter when calling `Mock` or `Should -Invoke` for commands within that module. You are also able to directly call the `Build` function, which the module does not export.
114114

115-
:::caution Avoid putting in InModuleScope around your Describe and It blocks.
115+
:::warning Avoid putting in InModuleScope around your Describe and It blocks.
116116

117117
`InModuleScope` is a simple way to expose your internal module functions to be tested, but it prevents you from properly testing your published functions, does not ensure that your functions are actually published and slows down test discovery by loading the module. Aim to avoid it altogether by using `-ModuleName` on `Mock` when possible or at least limit it to inside the It block like the sample above.
118118
:::

docs/usage/skip.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ Tests completed in 1.03s
5454
Tests Passed: 1, Failed: 0, Skipped: 4, Total: 5, NotRun: 0
5555
```
5656

57-
:::caution
57+
:::warning
5858
Pending is translated to skipped, Inconclusive does not exist anymore.
5959
:::
6060

docs/usage/test-file-structure.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Describe "Get-Emoji" {
2525
}
2626
```
2727

28-
:::caution
28+
:::warning
2929
Put all your code into `It`, `BeforeAll`, `BeforeEach`, `AfterAll` or `AfterEach`. Put no code directly into `Describe`, `Context` or on the top of your file, without wrapping it in one of these blocks, unless you have a good reason to do so.
3030

3131
All misplaced code will run during Discovery, and its results won't be available during Run which will lead to confusing results.

0 commit comments

Comments
 (0)