test: verify dist WASM files exist (#3048)

Add test to verify presence of all required WASM files in dist directory:
- tiktoken_bg.wasm for tokenization
- tree-sitter.wasm core parser
- Language-specific tree-sitter WASM files for syntax highlighting

Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Co-authored-by: Eric Wheeler <roo-code@z.ewheeler.org>
This commit is contained in:
KJ7LNW 2025-04-29 16:10:51 -07:00 committed by GitHub
parent 664d5b1dd5
commit f120de6a34
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -0,0 +1,57 @@
import * as fs from "fs"
import * as path from "path"
describe("dist assets", () => {
const distPath = path.join(__dirname, "../../dist")
describe("tiktoken", () => {
it("should have tiktoken wasm file", () => {
expect(fs.existsSync(path.join(distPath, "tiktoken_bg.wasm"))).toBe(true)
})
})
describe("tree-sitter", () => {
const treeSitterFiles = [
"tree-sitter-bash.wasm",
"tree-sitter-cpp.wasm",
"tree-sitter-c_sharp.wasm",
"tree-sitter-css.wasm",
"tree-sitter-c.wasm",
"tree-sitter-elisp.wasm",
"tree-sitter-elixir.wasm",
"tree-sitter-elm.wasm",
"tree-sitter-embedded_template.wasm",
"tree-sitter-go.wasm",
"tree-sitter-html.wasm",
"tree-sitter-javascript.wasm",
"tree-sitter-java.wasm",
"tree-sitter-json.wasm",
"tree-sitter-kotlin.wasm",
"tree-sitter-lua.wasm",
"tree-sitter-objc.wasm",
"tree-sitter-ocaml.wasm",
"tree-sitter-php.wasm",
"tree-sitter-python.wasm",
"tree-sitter-ql.wasm",
"tree-sitter-rescript.wasm",
"tree-sitter-ruby.wasm",
"tree-sitter-rust.wasm",
"tree-sitter-scala.wasm",
"tree-sitter-solidity.wasm",
"tree-sitter-swift.wasm",
"tree-sitter-systemrdl.wasm",
"tree-sitter-tlaplus.wasm",
"tree-sitter-toml.wasm",
"tree-sitter-tsx.wasm",
"tree-sitter-typescript.wasm",
"tree-sitter-vue.wasm",
"tree-sitter.wasm",
"tree-sitter-yaml.wasm",
"tree-sitter-zig.wasm",
]
test.each(treeSitterFiles)("should have %s file", (filename) => {
expect(fs.existsSync(path.join(distPath, filename))).toBe(true)
})
})
})