bennyp
bennyp
DDeno
Created by bennyp on 4/20/2025 in #help
Using scopes in deno.json to mock modules for tests
Hello, I have something like this in my deno.json
"imports": {
"#css": "./src/css/documents.ts",
"@std/assert": "jsr:@std/assert@1",
"@std/collections": "jsr:@std/collections@^1.0.10",
"@std/expect": "jsr:@std/expect@^1.0.15",
"@std/io": "jsr:@std/io@^0.225.2",
"@std/testing": "jsr:@std/testing@^1.0.11",
},
"scopes": {
"./src/lsp/methods/textDocument/completion.test.ts": {
"#css": "./test/css-mock.ts"
}
}
"imports": {
"#css": "./src/css/documents.ts",
"@std/assert": "jsr:@std/assert@1",
"@std/collections": "jsr:@std/collections@^1.0.10",
"@std/expect": "jsr:@std/expect@^1.0.15",
"@std/io": "jsr:@std/io@^0.225.2",
"@std/testing": "jsr:@std/testing@^1.0.11",
},
"scopes": {
"./src/lsp/methods/textDocument/completion.test.ts": {
"#css": "./test/css-mock.ts"
}
}
completion.test.ts imports completion.ts which imports #css. I expect that when I run deno test -A, my mock module would be loaded, not the real one instead the real one is loaded. Please advise how I can mock modules for testing.
2 replies
DDeno
Created by bennyp on 4/17/2025 in #help
deno compile --include whatev.wasm
I'd like to include a wasm file as data, but when I try to --include it I get
error: Relative import path "env" not prefixed with / or ./ or ../ and not in import map from "file:///var/home/bennyp/Developer/design-tokens-language-server/src/server/css/tree-sitter/tree-sitter-css.wasm"
error: Relative import path "env" not prefixed with / or ./ or ../ and not in import map from "file:///var/home/bennyp/Developer/design-tokens-language-server/src/server/css/tree-sitter/tree-sitter-css.wasm"
I'm aware that the docs say to add wasm imports to the import map, but that's not what I'm getting at: I just want to include a tree sitter grammar as data so that web-tree-sitter can load it up.
2 replies
DDeno
Created by bennyp on 4/16/2025 in #help
Writing the whole buffer to stdout
No description
3 replies
DDeno
Created by bennyp on 4/3/2025 in #help
Bundling node-tree-sitter
Hello there! I'm working on a language server written in Deno TS. I'd like to bundle it with node-tree-sitter, and I'm using esbuild as the docs recommend., but node-tree-sitter doesn't bundle nicely. https://github.com/bennypowers/design-tokens-language-server/issues/1#issuecomment-2776935304 If you have some ideas how I might work around this, I'd appreciate your input. Maybe with a dynamic import and --include?
3 replies