html-syntax-test
main
看板大半的邏輯寫在 index.html 的 inline script 裡(二十幾萬字元),只有瀏覽器會執行。node --test 不會碰它,所以語法打壞了 CI 照樣綠燈,網站卻整頁空白。
index.html
node --test
今天做 CODA 分配規則介面時就寫錯了一個反引號,是我手動檢查才抓到的。這個測試把那道手動檢查變成自動的。
新增 tests/html-scripts.test.mjs:
tests/html-scripts.test.mjs
my.html
permissions.html
archive.html
node:vm
Script
calc-core.js
scope-ui.js
i18n.js
type
只檢查語法,不檢查邏輯。但語法錯誤正是會讓整個看板掛掉的那一類。
🤖 Generated with Claude Code
https://claude.ai/code/session_01VDJVpPiGiWjJP1yVvvGhzQ
Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VDJVpPiGiWjJP1yVvvGhzQ
No dependencies set.
The note is not visible to the blocked user.
為什麼
看板大半的邏輯寫在
index.html的 inline script 裡(二十幾萬字元),只有瀏覽器會執行。node --test不會碰它,所以語法打壞了 CI 照樣綠燈,網站卻整頁空白。今天做 CODA 分配規則介面時就寫錯了一個反引號,是我手動檢查才抓到的。這個測試把那道手動檢查變成自動的。
做了什麼
新增
tests/html-scripts.test.mjs:index.html、my.html、permissions.html、archive.html每一段 inline script 交給 V8 解析(node:vm的Script,只解析不執行)。calc-core.js、scope-ui.js、i18n.js。type屬性的 script(module 或 JSON),測試會明確失敗並要求先更新測試,而不是默默跳過。只檢查語法,不檢查邏輯。但語法錯誤正是會讓整個看板掛掉的那一類。
🤖 Generated with Claude Code
https://claude.ai/code/session_01VDJVpPiGiWjJP1yVvvGhzQ