BicepConsoleTTK
0.2.0
Bicep Console Test Tool Kit (BicepConsoleTTK) — test Bicep imported types, functions and variables via the Bicep Console REPL using Pester
Minimum PowerShell version
5.1
Installation Options
Owners
Copyright
(c) Andrew Wilson. MIT License.
Package Details
Author(s)
- Andrew Wilson
Tags
Functions
Import-Bicep Invoke-BicepExpression ConvertTo-BicepConsoleResult ConvertTo-BicepLiteral Read-BicepLiteral
PSEditions
Dependencies
This module has no dependencies.
Release Notes
## 0.2.0 (2026-05-18)
### New Features
- Added ConvertTo-BicepConsoleResult: converts a PowerShell null, bool, number, string, [ordered]@{}, [pscustomobject], or array to the exact string that Invoke-BicepExpression returns for an equivalent Bicep value, enabling clean Should -Be assertions without hand-crafting multi-line escape sequences
- Added ConvertTo-BicepLiteral: converts a PowerShell value to a Bicep literal expression string (the value portion after =). Use it inside a PS subexpression when building SetupDeclarations so complex typed values can be written as structured PowerShell data rather than hand-crafted single-line strings. Shares the same Format-BicepValue private helper as ConvertTo-BicepConsoleResult — output format is identical
- Added Read-BicepLiteral: reads a JSON file and returns the Bicep literal string for its content. Enables large or shared fixture objects to live in separate JSON files rather than inlined in tests. Uses ConvertFrom-Json (preserves JSON key order as PSCustomObject on PS 5.1 and PS 7+) then delegates to Format-BicepValue — same output as ConvertTo-BicepLiteral. Throws a clear Read-BicepLiteral: File not found error on a missing path, consistent with Import-Bicep error style
## 0.1.1 (2026-05-09)
### Bug Fixes
- Fixed multi-line object literal bodies in func declarations being collapsed without commas between properties, causing a Bicep console parse error (e.g. `func generateBaseTags` using `union(origTags, { ... })`)
- Fixed array type aliases (e.g. `type Foo = Bar[]`) being emitted before their element type when imported by name, causing a "not a valid type" error in the Bicep console. Import-Bicep now resolves and emits element type dependencies first.
## 0.1.0 (2026-05-08)
Initial release of BicepConsoleTTK (Bicep Console Test Tool Kit).
### Features
- Import-Bicep: parse named and wildcard import statements to extract exported func, type and var declarations from Bicep files
- Invoke-BicepExpression: evaluate a Bicep expression via the bicep console REPL and return the result for Pester assertions
- Multi-file imports with preserved declaration order
- Automatic deduplication of imported members
- SetupDeclarations support for pre-declaring typed variables before the test expression
- Pipeline input support for Import-Bicep
- Clear error messages: Bicep console errors are caught, tilde/caret noise stripped, and re-thrown as readable exceptions
- 30-second process timeout to prevent CI pipeline hangs
- Compatible with Windows PowerShell 5.1 (Desktop) and PowerShell 7+ (Core)
FileList
- BicepConsoleTTK.nuspec
- BicepConsoleTTK.psd1
- BicepConsoleTTK.psm1
- README.md
Version History
| Version | Downloads | Last updated |
|---|---|---|
| 0.2.0 (current version) | 6 | 5/18/2026 |
| 0.1.1 | 7 | 5/9/2026 |
| 0.1.0 | 7 | 5/8/2026 |