Skip to content

Commit 6a98f83

Browse files
docs(contributing): clarify testing procedures and requirements
1 parent 2a78dc8 commit 6a98f83

File tree

1 file changed

+10
-13
lines changed

1 file changed

+10
-13
lines changed

CONTRIBUTING.md

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -125,26 +125,23 @@ This script generates:
125125
- Correct icon path (usually `../../../../.icons/your-icon.svg`)
126126
- Proper tags that describe your module
127127
3. **Create tests for your module:**
128-
- **New modules**: Create `.tftest.hcl` files and test with `terraform test`
129-
- **Existing modules**: Keep `main.test.ts` files and test with `bun test`
128+
- **New modules**: Create `*.tftest.hcl` files and test with `terraform test`
129+
- **TypeScript tests**: Create `main.test.ts` files if your module runs scripts or has business logic that Terraform tests can't cover
130130
- **Both approaches** are supported
131131
4. **Add any scripts** or additional files your module needs
132132

133133
### 4. Test and Submit
134134

135135
```bash
136136
# Test your module
137-
# For new modules with .tftest.hcl:
138137
cd registry/[namespace]/modules/[module-name]
138+
139+
# Required: Test Terraform functionality
139140
terraform init -upgrade
140141
terraform test -verbose
141142

142-
# For existing modules with main.test.ts:
143-
bun test registry/[namespace]/modules/[module-name]
144-
145-
# Run all tests in the repo
146-
bun test # All TypeScript tests
147-
./scripts/terraform_test_all.sh # All Terraform tests
143+
# Optional: Test TypeScript files if you have main.test.ts
144+
bun test main.test.ts
148145

149146
# Format code
150147
bun run fmt
@@ -352,8 +349,8 @@ coder templates push test-[template-name] -d .
352349
terraform init -upgrade
353350
terraform test -verbose
354351

355-
# Test all modules
356-
./scripts/terraform_test_all.sh
352+
# Optional: If you have TypeScript tests
353+
bun test main.test.ts
357354
```
358355

359356
### 3. Maintain Backward Compatibility
@@ -403,7 +400,7 @@ Example: `https://github.com/coder/registry/compare/main...your-branch?template=
403400

404401
- `main.tf` - Terraform code
405402
- **Tests**:
406-
- `*.tftest.hcl` files with `terraform test` (to test terraform specific logoc)
403+
- `*.tftest.hcl` files with `terraform test` (to test terraform specific logic)
407404
- `main.test.ts` file with `bun test` (to test business logic, i.e., `coder_script` to install a package.)
408405
- `README.md` - Documentation with frontmatter
409406

@@ -504,6 +501,6 @@ When reporting bugs, include:
504501
2. **No tests** or broken tests
505502
3. **Hardcoded values** instead of variables
506503
4. **Breaking changes** without defaults
507-
5. **Not running** formatting (`bun run fmt`) and tests (`bun test` or `terraform test`) before submitting
504+
5. **Not running** formatting (`bun run fmt`) and tests (`terraform test`, and `bun test main.test.ts` if applicable) before submitting
508505

509506
Happy contributing! 🚀

0 commit comments

Comments
 (0)