Birk Skyum
Birk Skyum
DDeno
Created by Birk Skyum on 9/10/2024 in #help
canary `deno install` - can't find npm modules
deno 2.0.0-rc.1+7bfcb4d I'm having a deno.json like this
{
"tasks": {
"test": "vitest"
},
"imports": {
"vitest": "npm:vitest@^2.0.5"
}
}
{
"tasks": {
"test": "vitest"
},
"imports": {
"vitest": "npm:vitest@^2.0.5"
}
}
I run deno install I have a test like this:
import { expect, test } from "vitest"; // <- "Cannot find module 'vitest' or its corresponding type declarations.ts(2307)
function sum(a, b) {
return a + b
}
test('adds 1 + 2 to equal 3', () => {
expect(sum(1, 2)).toBe(3)
})
import { expect, test } from "vitest"; // <- "Cannot find module 'vitest' or its corresponding type declarations.ts(2307)
function sum(a, b) {
return a + b
}
test('adds 1 + 2 to equal 3', () => {
expect(sum(1, 2)).toBe(3)
})
Why can the type declarations not be found? deno install doesn't seem to make a node_modules folder by default - is that necessary for this this type to be found, or can the import mapping work? I also have the vitest.config.ts like this:
import {defineConfig} from "vitest/config";

export default defineConfig({
test: {
include: ['sum.test.ts']
}
})
import {defineConfig} from "vitest/config";

export default defineConfig({
test: {
include: ['sum.test.ts']
}
})
and when I run the task deno task test I get an error that "vitest/config" also can't be found:
deno task test
Task test vitest
[ERROR] Unterminated string literal

vitest.config.ts:1:366:
1 │ ...e:///Users/admin/repos/deno-kitchensink/vitest-demo/vitest.config.ts";import {defineConfig} from "vitest/config';
╵ ^

failed to load config from /Users/admin/repos/deno-kitchensink/vitest-demo/vitest.config.ts
deno task test
Task test vitest
[ERROR] Unterminated string literal

vitest.config.ts:1:366:
1 │ ...e:///Users/admin/repos/deno-kitchensink/vitest-demo/vitest.config.ts";import {defineConfig} from "vitest/config';
╵ ^

failed to load config from /Users/admin/repos/deno-kitchensink/vitest-demo/vitest.config.ts
7 replies
DDeno
Created by Birk Skyum on 11/29/2023 in #help
Webgl2 in Deno i.e. for unit testing
nodejs has this challenge that there is no way to run webgl2 (or webgpu), i.e. for unit testing. There is a solution for webgl1, through the use of https://github.com/stackgl/headless-gl. Is there a way to run webgl2 in deno, headless?
6 replies
DDeno
Created by Birk Skyum on 11/12/2023 in #help
byonm - force use of Deno
When I use byonm enabled in my deno.json, and say I have a vite project triggered from a package.json with i.e. "deno task dev", it appears to just my code with Node.js underneath. Is there a way to force use of deno througout, somewhat similar to what bun has with --bun flag to overwrite uses of Node.js?
3 replies