Run the module's Bicep Pester or Terraform unit-test tier.
For Bicep, runs module tests/unit/*.tests.ps1 only by default. Pester runs in a child PowerShell process and receives repoRootPath and moduleFolderPaths. -Recurse includes nested module scopes. -IncludeCompliance adds packaged native conventions, metadata and README requirements in one in-process Pester run. Authored unit tests remain isolated in a child process. -CompliancePath selects an explicit alternate suite and implies -IncludeCompliance.
For Terraform, runs 'terraform test' against tests/unit/ through Invoke-AvmTerraformTestSuite -Tier unit.
Unlike the bare 'avm test' verb (which is the cheap, offline 'terraform validate' build pass), this tier executes real 'terraform test' HCL run blocks. A missing suite or a Pester filter matching no tests reports 'skipped' with zero runs, never a pass. Explicitly skipped Pester tests fail the tier.
Warnings and errors are reported after the tests and remain available in the returned Issues. Bicep test values are redacted in diagnostics. Runtime failures are reported with values redacted and rethrown with their original exception.
This is a standalone credential-free tier. The Terraform tier also runs in 'avm pr-check'. Bicep convention checks are separate; the existing registry CI remains authoritative until that work is complete and a cutover is approved.
Routed by the dispatcher: 'avm test unit'.
avm test unit
Invoke-AvmTestUnit [[-Path] <string>] [-Ecosystem <string>] [-AllowPathFallback] [-NoInit] [-Tag <string[]>] [-TestName <string[]>] [-Recurse] [-IncludeCompliance] [-CompliancePath <string>] [-RepositoryRoot <string>] [-SkipModuleVersionCheck] [<CommonParameters>]When set, accept a PATH-resolved tool binary that self-reports the lock-pinned version.
| Property | Value |
|---|---|
| Type | Switch |
| Required | false |
| Position | named |
| Default value | False |
| Accept pipeline input | false |
| Accept wildcard characters | false |
Bicep-only: explicit compliance Pester suite file. Relative paths resolve under -RepositoryRoot or the discovered repository root. Selecting a path enables compliance without -IncludeCompliance.
| Property | Value |
|---|---|
| Type | String |
| Required | false |
| Position | named |
| Default value | |
| Accept pipeline input | false |
| Accept wildcard characters | false |
Force the ecosystem selector. Defaults to 'auto'.
| Property | Value |
|---|---|
| Type | String |
| Required | false |
| Position | named |
| Default value | auto |
| Accept pipeline input | false |
| Accept wildcard characters | false |
Bicep-only: also run the packaged compliance suite. This is an explicit transition option, not part of the default unit tier.
| Property | Value |
|---|---|
| Type | Switch |
| Required | false |
| Position | named |
| Default value | False |
| Accept pipeline input | false |
| Accept wildcard characters | false |
Terraform-only: skip the automatic terraform init step.
| Property | Value |
|---|---|
| Type | Switch |
| Required | false |
| Position | named |
| Default value | False |
| Accept pipeline input | false |
| Accept wildcard characters | false |
Working directory whose enclosing module to test. Defaults to the current location.
| Property | Value |
|---|---|
| Type | String |
| Required | false |
| Position | 1 |
| Default value | $PWD.Path |
| Accept pipeline input | false |
| Accept wildcard characters | false |
Bicep-only: include child module scopes and their unit tests.
| Property | Value |
|---|---|
| Type | Switch |
| Required | false |
| Position | named |
| Default value | False |
| Accept pipeline input | false |
| Accept wildcard characters | false |
| Aliases | PesterTestRecurse |
Bicep-only: override the repository root passed to authored tests.
| Property | Value |
|---|---|
| Type | String |
| Required | false |
| Position | named |
| Default value | |
| Accept pipeline input | false |
| Accept wildcard characters | false |
Skip the PowerShell Gallery check that otherwise stops the command when a newer Avm.Authoring version is available. Writes a warning once.
| Property | Value |
|---|---|
| Type | Switch |
| Required | false |
| Position | named |
| Default value | False |
| Accept pipeline input | false |
| Accept wildcard characters | false |
Bicep-only Pester tag filter. Alias: PesterTag.
| Property | Value |
|---|---|
| Type | String[] |
| Required | false |
| Position | named |
| Default value | @() |
| Accept pipeline input | false |
| Accept wildcard characters | false |
| Aliases | PesterTag, PesterTags |
Bicep-only Pester full-name filter (supports Pester wildcards).
| Property | Value |
|---|---|
| Type | String[] |
| Required | false |
| Position | named |
| Default value | @() |
| Accept pipeline input | false |
| Accept wildcard characters | false |
avm test unitInvoke-AvmTestUnit -Path C:\repos\terraform-azurerm-avm-res-fooavm test unit --ecosystem bicep --tag UDT --recurseavm test unit --include-compliancepscustomobject from the engine: Engine, Tool, ToolPath, ToolSource, Status, FilesProcessed, RunsTotal, RunsPassed, RunsFailed, Issues. Bicep also reports RunsSkipped, RunsInconclusive, RunsFiltered, UnitFiles, ComplianceFile and ModuleScopes. When authored Pester runs in a child, Bicep also returns Authoring: the child's process ID, admitted source manifest/base/SHA256, observed post-suite loaded and discoverable module bases, loaded manifest/SHA256/version/GUID, and the module bases owning Get-AvmTool and Install-AvmTool. The receipt is validated against the admitted source and exact child copy before it is returned; failed identity checks throw. A skipped run without an authored suite has no Authoring receipt. RunsFailed includes native compliance warning assertions; their warning severity does not fail the tier. Authored test failures always fail it.