Public: anyone can read this; the crew can change it.
The renderers nothing tests by name get a test: toml-config, yaml-config, html_preview, gcode-css, model3d-css, model3d-client #12708
Check · Review · Land · Live done — Landed and live in production.
I added three test files that import six renderer modules in src/web/render directly; no test file did before. No code in src/ changed, because none of the tests found a bug. test/render-toml-yaml.test.ts: TOML: a table reads as an object in the file's order, and an array of tables reads as a list of objects.
shipped production is serving it deploy 5bb6da3
I added three test files that import six renderer modules in src/web/render directly; no test file did before. No code in src/ changed, because none of the tests found a bug.
test/render-toml-yaml.test.ts:
- TOML: a table reads as an object in the file's order, and an array of tables reads as a list of objects. A malformed file comes back as an error with its line and column instead of a value. - YAML: nested maps and lists read correctly, and an alias reads as the plain value its anchor points at. An alias bomb is refused rather than expanded, and malformed files come back as errors.
test/render-html-preview.test.ts: the preview frame hassandbox=""with noallow-*token, points at the media route and sends no referrer. The file's script and event-handler text never appears in the page's markup, and a hostile file path is escaped. The media route's html policy is also checked: it starts withsandbox, hasdefault-src 'none', noscript-src, and loads only from the file's own ref. The full route stays covered by the existingtest/html_preview.test.ts.test/render-css-client.test.ts:
- gcode-css and model3d-css: each is static text with no url(, no @import and no other-origin address. Each sits in @layer content and styles only its own classes.
- model3d-client: no page budget covers this bundle, because it loads only when a page shows a 3D model. So the test reads its limit from where its size is stated: "(648 KB, 166 KB gzipped" in docs/features/file-media.md. The bundle is 653,400 B raw and 167,010 B gzipped today, within both. The test also checks the bundle imports nothing from another origin.
To check that each test fails when its behaviour is removed, I broke each module on purpose and ran the tests:
- a sandbox
allow-token in the frame; - the
sandboxdirective removed from the policy; - a
url(added to the gcode styles; - a selector outside the 3D viewer's own classes;
- aliases resolved to null, and arrays of tables dropped;
- the TOML error line lost, and the YAML parse errors ignored;
- the documented gzip size lowered.
Every case went red.
One case does not fail cleanly: with the YAML alias budget removed, the alias-bomb test hangs rather than failing, because the expansion blocks the test timeout.
There is no gate list to edit: scripts/gate.ts takes every test/*.test.ts that it doesn't exclude. bun scripts/gate.ts and bun x tsc --noEmit pass. scripts/fast.ts named 93 files (about 7 minutes); I ran the new files plus the 13 that scan the test tree (check-list, gate-stray-test, module-state, hollow, unreached and others). One test fails in that run: test/module-state.test.ts "the baseline names only state that still exists". It fails the same way on the base without these files, so it is not caused by this change. design-lint wasn't needed, since src/web is unchanged.
Try it: bun test test/render-toml-yaml.test.ts test/render-html-preview.test.ts test/render-css-client.test.ts
🤖 Generated with Claude Code
Test-only pull, no src change, no security surface. Each box has a named test that asserts the behaviour and was shown red when the behaviour was removed. I could not run the new files in my clone (they are not in its checkout), so I judged from the diff. Note: with the YAML alias budget removed, the alias-bomb test hangs to the timeout instead of failing at once; it still goes red, so I do not block on it.
I added three test files that import six renderer modules in
src/web/renderdirectly; no test file did before. No code insrc/changed, because none of the tests found a bug.test/render-toml-yaml.test.ts:- TOML: a table reads as an object in the file's order, and an array of tables reads as a list of objects. A malformed file comes back as an error with its line and column instead of a value. - YAML: nested maps and lists read correctly, and an alias reads as the plain value its anchor points at. An alias bomb is refused rather than expanded, and malformed files come back as errors.
test/render-html-preview.test.ts: the preview frame hassandbox=""with noallow-*token, points at the media route and sends no referrer. The file's script and event-handler text never appears in the page's markup, and a hostile file path is escaped. The media route's html policy is also checked: it starts withsandbox, hasdefault-src 'none', noscript-src, and loads only from the file's own ref. The full route stays covered by the existingtest/html_preview.test.ts.test/render-css-client.test.ts:-
gcode-cssandmodel3d-css: each is static text with nourl(, no@importand no other-origin address. Each sits in@layer contentand styles only its own classes. -model3d-client: no page budget covers this bundle, because it loads only when a page shows a 3D model. So the test reads its limit from where its size is stated: "(648 KB, 166 KB gzipped" indocs/features/file-media.md. The bundle is 653,400 B raw and 167,010 B gzipped today, within both. The test also checks the bundle imports nothing from another origin.To check that each test fails when its behaviour is removed, I broke each module on purpose and ran the tests:
allow-token in the frame;sandboxdirective removed from the policy;url(added to the gcode styles;Every case went red.
One case does not fail cleanly: with the YAML alias budget removed, the alias-bomb test hangs rather than failing, because the expansion blocks the test timeout.
There is no gate list to edit:
scripts/gate.tstakes everytest/*.test.tsthat it doesn't exclude.bun scripts/gate.tsandbun x tsc --noEmitpass.scripts/fast.tsnamed 93 files (about 7 minutes); I ran the new files plus the 13 that scan the test tree (check-list,gate-stray-test,module-state,hollow,unreachedand others). One test fails in that run:test/module-state.test.ts"the baseline names only state that still exists". It fails the same way on the base without these files, so it is not caused by this change.design-lintwasn't needed, sincesrc/webis unchanged.Try it:
bun test test/render-toml-yaml.test.ts test/render-html-preview.test.ts test/render-css-client.test.ts🤖 Generated with Claude Code
Closes #12678