Files
coder/scripts/docgenenv
Nick Vigilante 12caf883fc test(scripts/docgenenv): match missing include by fs.ErrNotExist (#30285)
## Summary

`TestBuildManifestErrors/IncludeMissingFile` fails deterministically on
Windows because it matches the POSIX error text `no such file or
directory`.
Windows reports the same condition as `The system cannot find the file
specified.`
This asserts `fs.ErrNotExist` in the error chain instead, plus the
included file name.

Fixes [ENG-3439](https://linear.app/codercom/issue/ENG-3439).

## Changes

- Add an optional `wantErrIs` field to the `TestBuildManifestErrors`
table, checked with `require.ErrorIs`.
- `IncludeMissingFile` now expects `fs.ErrNotExist` and the text
`nope.yml` (not `ref/nope.yml`, since Windows renders the path with
escaped backslashes).

No production code changes: `DecodeSourceFile` already wraps the
`os.ReadFile` error with `%w`, and `errors.Join` preserves it.

## Testing

- `go test ./scripts/docgenenv/... -count=1` passes on Linux.
- `GOOS=windows go test -c ./scripts/docgenenv` compiles.
- `golangci-lint run ./scripts/docgenenv/...` reports 0 issues;
pre-commit hook passed.
- Not run on Windows locally; the `test-go-pg (windows-2022)` job is the
real check.

---

_Generated by Coder Agents on behalf of @nickvigilante._
2026-10-02 14:52:57 -04:00
..