deno test
error: ReferenceError: document is not defined
deno.json
import { renderHook } from "@testing-library/preact"; import { useFetch } from "@/hooks/use-fetch.ts"; import { expect } from "@std/expect"; Deno.test("Use fetch", () => { const { result } = renderHook(()=> useFetch("https://jsonplaceholder.typicode.com/todos/1")) expect(result.current.data).not.toEqual(null); });
{ "workspace": [ "./packages/pretch-core", "./packages/pretch-preact", "./packages/pretch-react" ], "compilerOptions": { "lib": [ "dom", "dom.iterable", "dom.asynciterable", "deno.ns" ], "jsx": "react-jsx", "jsxImportSource": "preact" }, "lint": { "rules": { "include": [ "no-console", "ban-types", "camelcase", "verbatim-module-syntax" ] } }, "exclude": [ ".git", ".vscode" ], "imports": { "@std/expect": "jsr:@std/expect@^1.0.5", "@testing-library/dom": "npm:@testing-library/dom@^10.4.0" } }
{ "name": "@prefetch/preact", "version": "0.1.2", "tasks": { "doc": "deno doc --html --name='Pretch' src" }, "imports": { "@preact/signals": "npm:@preact/signals@^1.3.0", "@std/assert": "jsr:@std/assert@1", "preact": "npm:preact@^10.24.1", "@/": "./", "@std/expect": "jsr:@std/expect@^1.0.5", "@testing-library/preact": "npm:@testing-library/preact@^3.2.4" }, "exports": { ".": "./mod.ts" } }
Join the Discord to ask follow-up questions and connect with the community
Chat about Deno, a modern runtime for JavaScript and TypeScript.
20,934 Members