Danielduel
Danielduel
DDeno
Created by Danielduel on 11/18/2024 in #help
Skipping time in tests; time delay setTimeout setInterval
(the title is just so people can get to this one easier by using search) I have a deadline/delay based (@std/async) functionality and in tests I want to skip time (so I don't have to pass lower values for timeouts). I want something like jest's advanceTimersByTime (very bright page warning, usage is at the bottom) https://jestjs.io/docs/timer-mocks (jest uses sinon's fake timers, sinon uses sinon/fake-timers (install, then createClock, it's basically a big orchiestrated mock on time-based apis)) No idea if sinon works with deno (and if it is the deno's way), I would prefer something jsr/deno for this, any recommendation?
5 replies
DDeno
Created by Danielduel on 5/30/2024 in #help
Deno.test with "each" support
I tried to find in docs if something like https://deno.land/x/test_each@v0.0.2 or jest's https://jestjs.io/docs/api#each exists in Deno.test Looks like it is not, if you know that I missed something or there's a common pattern of doing this in Deno.test (like idk... mapping an array into an array of asserts and somehow getting the correct message out - please steer me into the correct direction.
2 replies
DDeno
Created by Danielduel on 4/7/2024 in #help
Missing resource in deno's docs
https://docs.deno.com/runtime/manual/basics/testing/assertions Leads to not existing chai example, please remove.
3 replies
DDeno
Created by Danielduel on 12/1/2023 in #help
Recommended `denoland/deno` contributor editor setup
I have a problem with deno trying to redefine itself via random declare namespace Deno { ... } throughout the deno repo. I use vscodium with TypeScript 5.2.2, latest Deno. I fail to find any docs on how you recommend to setup the editor to make lsp correctly pick up things.
5 replies
DDeno
Created by Danielduel on 11/28/2023 in #help
Contributing doc is 404
Refer to https://deno.com/manual/contributing (it is a part of deno's PR template)
2 replies
DDeno
Created by Danielduel on 11/27/2023 in #help
Deno+vite crashes on node dependency
Earlier today I was happy because everything worked on my m1 macbook. When I've returned home (arch) I got errors from latest deno... (I am running deno on the metal, but I will provide a way to reproduce it with docker:)
FROM denoland/deno:1.38.3

WORKDIR /app

RUN deno run --allow-read --allow-write --allow-env npm:create-vite-extra@latest vite-project --template deno-react

WORKDIR /app/vite-project
RUN deno task build
FROM denoland/deno:1.38.3

WORKDIR /app

RUN deno run --allow-read --allow-write --allow-env npm:create-vite-extra@latest vite-project --template deno-react

WORKDIR /app/vite-project
RUN deno task build
error: Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'getReport')
at isMusl (file:///app/vite-project/node_modules/.deno/rollup@4.6.0/node_modules/rollup/dist/native.js:5:30)
at getPackageBase (file:///app/vite-project/node_modules/.deno/rollup@4.6.0/node_modules/rollup/dist/native.js:53:28)
at Object.<anonymous> (file:///app/vite-project/node_modules/.deno/rollup@4.6.0/node_modules/rollup/dist/native.js:28:21)
at Object.<anonymous> (file:///app/vite-project/node_modules/.deno/rollup@4.6.0/node_modules/rollup/dist/native.js:81:4)
at Module._compile (node:module:733:34)
at Object.Module._extensions..js (node:module:747:10)
at Module.load (node:module:658:32)
at Function.Module._load (node:module:539:12)
at Module.require (node:module:677:19)
at require (node:module:791:16)
error: Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'getReport')
at isMusl (file:///app/vite-project/node_modules/.deno/rollup@4.6.0/node_modules/rollup/dist/native.js:5:30)
at getPackageBase (file:///app/vite-project/node_modules/.deno/rollup@4.6.0/node_modules/rollup/dist/native.js:53:28)
at Object.<anonymous> (file:///app/vite-project/node_modules/.deno/rollup@4.6.0/node_modules/rollup/dist/native.js:28:21)
at Object.<anonymous> (file:///app/vite-project/node_modules/.deno/rollup@4.6.0/node_modules/rollup/dist/native.js:81:4)
at Module._compile (node:module:733:34)
at Object.Module._extensions..js (node:module:747:10)
at Module.load (node:module:658:32)
at Function.Module._load (node:module:539:12)
at Module.require (node:module:677:19)
at require (node:module:791:16)
12 replies
DDeno
Created by Danielduel on 11/12/2023 in #help
Read-only FS detection
Hi, I have few deps that by default create cache/log dirs... I can disable it, but the detection itself is unclear. Is there a better way than
const canWriteToFs = (() => {
try {
Deno.mkdirSync("./log", { recursive: true });
return true;
}
catch {
return false;
}
})();
const canWriteToFs = (() => {
try {
Deno.mkdirSync("./log", { recursive: true });
return true;
}
catch {
return false;
}
})();
3 replies
DDeno
Created by Danielduel on 10/29/2023 in #help
500 on deno.land/x/fp_ts with ?s=either
No description
2 replies
DDeno
Created by Danielduel on 9/23/2023 in #help
Peer dependency
Can I somehow mark a dependency as "peer"? So this dependency (which is known to shuffle typings between versions, but generally it is nonbreaking if you use it on highlevel) will not enforce a specific version onto a project? I depend on Pentagon and Zod Pentagon also depends on Zod While I initially wanted to use different version of Zod than pentagon's (using different versions of Zod makes some inner types clash) (I can switch zod version to pentagon's, but I feel not everybody would have the same luxury in the future) If possible - I would like to avoid this solution: https://github.com/denoland/deno/issues/10356#issuecomment-1580352563
4 replies