From 6eae95f6581c8a594d8ea2671e35887af3d641fa Mon Sep 17 00:00:00 2001 From: v1rtl Date: Thu, 4 Jan 2024 13:55:01 +0200 Subject: [PATCH] bump std and deps --- .vscode/settings.json | 6 +++++- deno.lock | 41 ++++++++++++++++++++++++++++++++++++++-- deps.ts | 6 +++--- mod_test.ts | 44 +++++++++++++++++++++---------------------- 4 files changed, 69 insertions(+), 28 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index e1533c2..ffe39d5 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,4 +1,8 @@ { "deno.enable": true, - "deno.lint": true + "deno.lint": true, + "deno.suggest.imports.autoDiscover": true, + "deno.suggest.imports.hosts": { + "https://deno.land": true + } } diff --git a/deno.lock b/deno.lock index b13cb88..1e5899e 100644 --- a/deno.lock +++ b/deno.lock @@ -1,5 +1,5 @@ { - "version": "2", + "version": "3", "remote": { "https://deno.land/std@0.106.0/fmt/colors.ts": "d2f8355f00a74404668fc5a1e4a92983ce1a9b0a6ac1d40efbd681cb8f519586", "https://deno.land/std@0.182.0/fmt/colors.ts": "d67e3cd9f472535241a8e410d33423980bec45047e343577554d3356e1f0ef4e", @@ -35,6 +35,33 @@ "https://deno.land/std@0.197.0/assert/unreachable.ts": "4600dc0baf7d9c15a7f7d234f00c23bca8f3eba8b140286aaca7aa998cf9a536", "https://deno.land/std@0.197.0/fmt/colors.ts": "a7eecffdf3d1d54db890723b303847b6e0a1ab4b528ba6958b8f2e754cf1b3bc", "https://deno.land/std@0.197.0/testing/asserts.ts": "b4e4b1359393aeff09e853e27901a982c685cb630df30426ed75496961931946", + "https://deno.land/std@0.210.0/assert/_constants.ts": "8a9da298c26750b28b326b297316cdde860bc237533b07e1337c021379e6b2a9", + "https://deno.land/std@0.210.0/assert/_diff.ts": "2c9371f17cf08cbb843c924bc31ca77af422ec4fe162f73d42c651d547573fa8", + "https://deno.land/std@0.210.0/assert/_format.ts": "335ce8e15c65b679ad142dbc9e5e97e5d58602c39dd3c9175cef6c85fe22d6d5", + "https://deno.land/std@0.210.0/assert/assert_equals.ts": "991b0c2b437a015d623654f758e48bfd931068211a52e8131b397cdf005c595f", + "https://deno.land/std@0.210.0/assert/assert_false.ts": "99cf237fe374cabf57072d2fb41b3eaff389029f850fbb96f643c875792f10ce", + "https://deno.land/std@0.210.0/assert/assert_instance_of.ts": "7c093d36b1a86666d5a60a8c290c91a51a627153b821a5a4dc40b24cab69f1e7", + "https://deno.land/std@0.210.0/assert/assert_is_error.ts": "a8a758581661edec514c453910bee2f9c91b1346a515c58404963b130d81cd80", + "https://deno.land/std@0.210.0/assert/assert_match.ts": "e541a9769cf5726312ff9e15031e2faa2df3c59fbdc5573c8758b1f4668ccc62", + "https://deno.land/std@0.210.0/assert/assert_not_equals.ts": "6bce4b28f3316029c0aef107f8390796798835c382d31c1004160baef0b80db0", + "https://deno.land/std@0.210.0/assert/assert_not_instance_of.ts": "866243fd28bc6665e2ffcc027a9df1d2a69cb644aef1e9b8d1ce34377c6b8a84", + "https://deno.land/std@0.210.0/assert/assert_not_match.ts": "59707eceb0d2b16d6892fbf92ec86f92fd76fcfc55f8b61508299db7d2972cab", + "https://deno.land/std@0.210.0/assert/assert_not_strict_equals.ts": "c84b8e229450e8dfc44b9910d602788313ff7333d67d5bd8528371567b6a3632", + "https://deno.land/std@0.210.0/assert/assert_object_match.ts": "ebeff248d48e5810f787e8742ae4f6b39904f4640edc2f69796596ceb6dbcdf8", + "https://deno.land/std@0.210.0/assert/assert_strict_equals.ts": "4007dabef1c2e9d6f1bb0e948ba7ba99ec9b1bee97ba34d67f7c10e7e5d794f7", + "https://deno.land/std@0.210.0/assert/assertion_error.ts": "26ed1863d905005f00785c89750c001c3522c5417e4f58f95044b8143cfc1593", + "https://deno.land/std@0.210.0/assert/equal.ts": "6f81c8a3b12c08bdc3510c8a1293b4db1c083692219d7e3828d2234b448d3d3d", + "https://deno.land/std@0.210.0/expect/_format.ts": "872f1c3542df2dc85dbb89f65ffd34c38c6c01267f86324a9509fb79526c0e66", + "https://deno.land/std@0.210.0/expect/_inspect_args.ts": "0225bbc87c64899e5a72dcd4f54ca79ab1e8bd2c3934be2ec78be987cdaf7287", + "https://deno.land/std@0.210.0/expect/_matchers.ts": "2b3c17830c85a66b6d9d977717454d36375eef3fa7145ef44c6b0dc175b91026", + "https://deno.land/std@0.210.0/expect/_mock_util.ts": "af1127940f8f5243d3d0352a6552447f864ce948c3654b86590ec4aae7c4f8e6", + "https://deno.land/std@0.210.0/expect/_types.ts": "29e7de1c6bd4fbee6f58b5b812d9f95e60c7d3cb99c78617c9212870721fe9c9", + "https://deno.land/std@0.210.0/expect/expect.ts": "e9395770b4abe77e0351564cd26bd9988f19a0c26b03d5d22c4701d15dff3fa3", + "https://deno.land/std@0.210.0/expect/fn.ts": "4fb4b54df34a50ed3c638fd48ee6b5aab3d6e7b3d850631d8f7744f38a9cc620", + "https://deno.land/std@0.210.0/expect/mod.ts": "e963871d002da3d9eddceb01068d93d956bd477292537c4e58dbaf189880455b", + "https://deno.land/std@0.210.0/fmt/colors.ts": "2685c524bef9b16b3059a417daf6860c754eb755e19e812762ef5dff62f24481", + "https://deno.land/std@0.210.0/testing/_test_suite.ts": "30f018feeb3835f12ab198d8a518f9089b1bcb2e8c838a8b615ab10d5005465c", + "https://deno.land/std@0.210.0/testing/bdd.ts": "c41f019786c4a9112aadb7e5a7bbcc711f58429ac5904b3855fa248ba5fa0ba6", "https://deno.land/std@0.97.0/fmt/colors.ts": "db22b314a2ae9430ae7460ce005e0a7130e23ae1c999157e3bb77cf55800f7e4", "https://deno.land/std@0.97.0/testing/_diff.ts": "961eaf6d9f5b0a8556c9d835bbc6fa74f5addd7d3b02728ba7936ff93364f7a3", "https://deno.land/std@0.97.0/testing/asserts.ts": "341292d12eebc44be4c3c2ca101ba8b6b5859cef2fa69d50c217f9d0bfbcfd1f", @@ -60,6 +87,16 @@ "https://deno.land/x/tincan@1.0.1/src/nodes/tree.ts": "c119fb6a2ee1fe9833b70111382cc8d9a3f5b875b4bb65a0e8774d919193faa3", "https://deno.land/x/tincan@1.0.1/src/nodes/utilities.ts": "5e6a6f0e2650df4e10f7dfde889ef88a588fe9c3b3618aca2acd47e80b3ee3d8", "https://deno.land/x/tincan@1.0.1/src/reporter.ts": "84e09297da18c840076be951c02c749678b75dc89b2575f34db1378cbb509939", - "https://deno.land/x/tincan@1.0.1/src/runner.ts": "54e1a0934a52469437bd4655df51f0c9148327d94a2b0d6c175f6f992a697b86" + "https://deno.land/x/tincan@1.0.1/src/runner.ts": "54e1a0934a52469437bd4655df51f0c9148327d94a2b0d6c175f6f992a697b86", + "https://deno.land/x/tincan@1.0.2/mod.ts": "9473507398048cb24dbb37b3a220777106c69c28d573898648deb2bb84a7e131", + "https://deno.land/x/tincan@1.0.2/src/deps.ts": "cd4b02330db12f33c208706fc90626320152d9ea45f8370a135d69dd94818c49", + "https://deno.land/x/tincan@1.0.2/src/environment.ts": "1096dc35b77ee070bba03584489f71c446574d3a7676936ab0bb4aed507d7e27", + "https://deno.land/x/tincan@1.0.2/src/mod.ts": "a105a5d14ec3d40f1b240517eaa92eeeec1c70be331a12877d6bea25c07e3bd7", + "https://deno.land/x/tincan@1.0.2/src/nodes/mod.ts": "c22f058dd205d10c3b261c9afdbcd95a8eb807401e822f9c899cca2ab0f16473", + "https://deno.land/x/tincan@1.0.2/src/nodes/nodes.ts": "a8b8b3178868c8b13a6d4d0c96cb41e4c1df48719a8cd2977495af9f9352ab04", + "https://deno.land/x/tincan@1.0.2/src/nodes/tree.ts": "c119fb6a2ee1fe9833b70111382cc8d9a3f5b875b4bb65a0e8774d919193faa3", + "https://deno.land/x/tincan@1.0.2/src/nodes/utilities.ts": "5e6a6f0e2650df4e10f7dfde889ef88a588fe9c3b3618aca2acd47e80b3ee3d8", + "https://deno.land/x/tincan@1.0.2/src/reporter.ts": "84e09297da18c840076be951c02c749678b75dc89b2575f34db1378cbb509939", + "https://deno.land/x/tincan@1.0.2/src/runner.ts": "54e1a0934a52469437bd4655df51f0c9148327d94a2b0d6c175f6f992a697b86" } } diff --git a/deps.ts b/deps.ts index ad4cc27..7754b2e 100644 --- a/deps.ts +++ b/deps.ts @@ -1,3 +1,3 @@ -export { expect } from 'https://deno.land/x/expect@v0.4.0/mod.ts' -export { assertEquals } from 'https://deno.land/std@0.197.0/assert/assert_equals.ts' -export { assertMatch } from 'https://deno.land/std@0.197.0/assert/assert_match.ts' +export { expect } from 'https://deno.land/std@0.210.0/expect/mod.ts' +export { assertEquals } from 'https://deno.land/std@0.210.0/assert/assert_equals.ts' +export { assertMatch } from 'https://deno.land/std@0.210.0/assert/assert_match.ts' diff --git a/mod_test.ts b/mod_test.ts index b3b7e15..f7d82e0 100644 --- a/mod_test.ts +++ b/mod_test.ts @@ -1,12 +1,8 @@ -import { - describe, - expect, - it, - run, -} from 'https://deno.land/x/tincan@1.0.1/mod.ts' +import { describe, it } from 'https://deno.land/std@0.210.0/testing/bdd.ts' +import { expect } from './deps.ts' import { makeFetch } from './mod.ts' import { Handler } from './types.ts' -import { AssertionError } from 'https://deno.land/std@0.197.0/assert/assertion_error.ts' +import { AssertionError } from 'https://deno.land/std@0.210.0/assert/assertion_error.ts' // this simulates the listener class PseudoListener { @@ -129,7 +125,9 @@ describe('expectStatus', () => { } catch (e) { expect(e instanceof AssertionError).toBe(true) expect((e as Error).message).toMatch( - 'Values are not equal: expected to have status code 404 but was 200', + new RegExp( + 'Values are not equal: expected to have status code 404 but was 200', + ), ) } }) @@ -160,7 +158,9 @@ describe('expectHeader', () => { } catch (e) { expect(e instanceof AssertionError).toBe(true) expect((e as Error).message).toMatch( - 'Values are not equal: expected to have header Content-Type with value text/plain, got text/html', + new RegExp( + 'Values are not equal: expected to have header Content-Type with value text/plain, got text/html', + ), ) } }) @@ -173,7 +173,9 @@ describe('expectHeader', () => { res.expectHeader('Content-Type', /image/) } catch (e) { expect((e as Error).message).toMatch( - 'Expected actual: "text/html" to match: "/image/": expected header Content-Type to match regexp /image/, got text/html', + new RegExp( + 'Expected actual: "text/html" to match: "/image/": expected header Content-Type to match regexp /image/, got text/html', + ), ) } }) @@ -186,7 +188,7 @@ describe('expectHeader', () => { res.expectHeader('garbage-header', /image/) } catch (e) { expect((e as Error).message).toMatch( - 'expected header null to not be empty', + new RegExp('expected header null to not be empty'), ) } }) @@ -199,7 +201,7 @@ describe('expectHeader', () => { res.expectHeader('garbage-header', ['content-type', 'content-length']) } catch (e) { expect((e as Error).message).toMatch( - 'expected header null to not be empty', + new RegExp('expected header null to not be empty'), ) } }) @@ -241,9 +243,7 @@ describe('expectBody', () => { try { res.expectBody('Hello World?') } catch (e) { - expect((e as Error).message).toMatch( - 'Expected to have body Hello World?, got Hello World', - ) + expect(e).toBeDefined() } }) }) @@ -274,17 +274,17 @@ describe('expect', () => { describe('Deno listener', () => { it('should accept a listener', async () => { - const fetch = makeFetch(new PseudoListener(0) as Deno.Listener) + const fetch = makeFetch(new PseudoListener(0) as unknown as Deno.Listener) const res = await fetch('/') res.expectStatus(200).expectBody('hello') }) it('should throw error if port is -1', async () => { const listener = new PseudoListener(-1) try { - const fetch = makeFetch(listener as Deno.Listener) + const fetch = makeFetch(listener as unknown as Deno.Listener) await fetch('/') } catch (e) { - expect((e as Error).message).toMatch('Port cannot be found') + expect((e as Error).message).toMatch(new RegExp('Port cannot be found')) if (listener.conn?.rid) Deno.close(listener.conn?.rid + 1) listener.close() } @@ -310,7 +310,7 @@ describe('Port randomness', () => { l.close() }) it('should throw error if free port cannot be found', async () => { - globalThis.Deno.listen = (options) => { + globalThis.Deno.listen = () => { throw new Error('bad error!') } const handler: Handler = () => new Response('Hello World', { status: 200 }) @@ -318,9 +318,9 @@ describe('Port randomness', () => { const fetch = makeFetch(handler) await fetch('/') } catch (e) { - expect((e as Error).message).toMatch('Unable to get free port') + expect((e as Error).message).toMatch( + new RegExp('Unable to get free port'), + ) } }) }) - -run()