Skip to content
Myr

chore(deno): use the latest jsr libraries for testing (#3375)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by ryu · committed by GitHub · parent a1b477c · Browse files · 10 files+37 added−22 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

10 files+37 added−22 removed

  • tests:+8 added−8 removed
  • other:+29 added−14 removed

10 files+37 added−22 removed

modified:runtime_tests/deno/deno.json+3 added-1 removed
modified:runtime_tests/deno/deno.lock+24 added-11 removed
1{2 "version": "3",3 "packages": {4 "specifiers": {5 "npm:@types/node": "npm:@types/node@18.16.19"5 "jsr:@std/assert@^1.0.3": "jsr:@std/assert@1.0.3",6 "jsr:@std/internal@^1.0.2": "jsr:@std/internal@1.0.2",7 "jsr:@std/testing@^1.0.1": "jsr:@std/testing@1.0.1"8 },7 "npm": {8 "@types/node@18.16.19": {9 "integrity": "sha512-IXl7o+R9iti9eBW4Wg2hx1xQDig183jj7YLn8F7udNceyfkbn1ZxmzZXuak20gR40D7pIkIY1kYGx5VIGbaHKA==",10 "dependencies": {}9 "jsr": {10 "@std/assert@1.0.3": {11 "integrity": "b0d03ce1ced880df67132eea140623010d415848df66f6aa5df76507ca7c26d8",12 "dependencies": [13 "jsr:@std/internal@^1.0.2"14 ]15 },16 "@std/internal@1.0.2": {17 "integrity": "f4cabe2021352e8bfc24e6569700df87bf070914fc38d4b23eddd20108ac4495"18 },19 "@std/testing@1.0.1": {20 "integrity": "9c25841137ee818933e1722091bb9ed5fdc251c35e84c97979a52196bdb6c5c3",21 "dependencies": [22 "jsr:@std/assert@^1.0.3"23 ]24 }25 }26 },14 "remote": {15 "https://deno.land/std@0.147.0/fmt/colors.ts": "6f9340b7fb8cc25a993a99e5efc56fe81bb5af284ff412129dd06df06f53c0b4",16 "https://deno.land/std@0.147.0/testing/_diff.ts": "029a00560b0d534bc0046f1bce4bd36b3b41ada3f2a3178c85686eb2ff5f1413",17 "https://deno.land/std@0.147.0/testing/_format.ts": "0d8dc79eab15b67cdc532826213bbe05bccfd276ca473a50a3fc7bbfb7260642",18 "https://deno.land/std@0.147.0/testing/asserts.ts": "c17254748504f449c98476b78f4d206ca47cffc826e415026f09d7600c19535e",19 "https://deno.land/std@0.147.0/testing/mock.ts": "d9630b551fe59a81b3c214c1a6ccb67819b6e34fc20e3424a659528fe1f572c1"27 "remote": {},28 "workspace": {29 "dependencies": [30 "jsr:@std/assert@^1.0.3",31 "jsr:@std/testing@^1.0.1"32 ]33 }34}
deleted:runtime_tests/deno/deps.ts-2 removed
modified:runtime_tests/deno/hono.test.ts+1 added-1 removed
modified:runtime_tests/deno/middleware.test.tsx+2 added-1 removed
1import { serveStatic } from '../../src/adapter/deno/index.ts'2import { Hono } from '../../src/hono.ts'3import { basicAuth } from '../../src/middleware/basic-auth/index.ts'4import { jwt } from '../../src/middleware/jwt/index.ts'5import { assertEquals, assertMatch, assertSpyCall, assertSpyCalls, spy } from './deps.ts'5import { assertSpyCall, assertSpyCalls, spy } from '@std/testing/mock'6import { assertEquals, assertMatch } from '@std/assert'78// Test just only minimal patterns.9// Because others are already tested well in Cloudflare Workers environment.10
153 unmodified lines
modified:runtime_tests/deno/ssg.test.tsx+1 added-1 removed
modified:runtime_tests/deno/stream.test.ts+3 added-4 removed
1import { Hono } from '../../src/hono.ts'2import { assertEquals } from './deps.ts'2import { stream, streamSSE } from '../../src/helper/streaming/index.ts'3import { assertEquals } from '@std/assert'45Deno.test('Shuld call onAbort via stream', async () => {6 const app = new Hono()7 let aborted = false8 app.get('/stream', (c) => {9 return stream(c, async (stream) => {9 return stream(c, (stream) => {10 stream.onAbort(() => {11 aborted = true12 })13 return new Promise<void>((resolve) => {
6 unmodified lines
20 const ac = new AbortController()21 const req = new Request(`http://localhost:${server.addr.port}/stream`, {22 signal: ac.signal,23 })24 assertEquals24 const res = fetch(req).catch(() => {})25 assertEquals(aborted, false)26 await new Promise((resolve) => setTimeout(resolve, 10))27 ac.abort()
29 unmodified lines
57Deno.test('Shuld call onAbort via streamSSE', async () => {58 const app = new Hono()59 let aborted = false60 app.get('/stream', (c) => {62 return streamSSE(c, async (stream) => {61 return streamSSE(c, (stream) => {62 stream.onAbort(() => {63 aborted = true64 })65 return new Promise<void>((resolve) => {
43 unmodified lines
modified:runtime_tests/deno-jsx/deno.precompile.json+1 added
modified:runtime_tests/deno-jsx/deno.react-jsx.json+1 added
10 unmodified lines
11 "unstable": [12 "sloppy-imports"13 ],14 "imports": {15 "@std/assert": "jsr:@std/assert@^1.0.3",16 "hono/jsx/jsx-runtime": "../../src/jsx/jsx-runtime.ts"17 }18}
modified:runtime_tests/deno-jsx/jsx.test.tsx+1 added-1 removed
1 unmodified line
2import { Style, css } from '../../src/helper/css/index.ts'3import { Suspense, renderToReadableStream } from '../../src/jsx/streaming.ts'4import type { HtmlEscapedString } from '../../src/utils/html.ts'5import { HtmlEscapedCallbackPhase, resolveCallback } from '../../src/utils/html.ts'6import { assertEquals } from '../deno/deps.ts'6import { assertEquals } from '@std/assert'78Deno.test('JSX', () => {9 const Component = ({ name }: { name: string }) => <span>{name}</span>10 const html = (
102 unmodified lines