buildkite / terminal-to-html

Converts arbitrary shell output (with ANSI) into beautifully rendered HTML
http://buildkite.github.io/terminal-to-html
MIT License
642 stars 45 forks source link

Guarantee the key sorting order of `<?bk key="value"?>` elements #90

Closed ticky closed 3 years ago

ticky commented 3 years ago

Previously, due to golang maps guaranteeing random key order, the test covering this code was flaky, as x or y might be first depending on the runtime conditions.

This changes it to allocate a list of keys, sort it, and then iterate over that instead of the map itself, guaranteeing not the input order, but at least a consistent one.

Fixes #87's flaky tests.

ticky commented 3 years ago

Yeah, I believe all usages of this syntax are maybe one or two keys, and this approach is the most efficient I can think of.