Skip to content

Commit 0c72261

Browse files
authored
Merge pull request #426 from vim-denops/fix-for-v2
Fix for Deno v2
2 parents 3a38e08 + 5b23d4d commit 0c72261

File tree

5 files changed

+29
-11
lines changed

5 files changed

+29
-11
lines changed

.github/workflows/test.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ on:
1616
verbose:
1717
type: boolean
1818
required: false
19-
description: 'Enable verbose output'
19+
description: "Enable verbose output"
2020
default: false
2121

2222
defaults:
@@ -34,6 +34,7 @@ jobs:
3434
- ubuntu-latest
3535
version:
3636
- "1.x"
37+
- "2.x"
3738
runs-on: ${{ matrix.runner }}
3839
steps:
3940
- run: git config --global core.autocrlf false
@@ -68,6 +69,7 @@ jobs:
6869
deno_version:
6970
- "1.45.0"
7071
- "1.x"
72+
- "2.x"
7173
host_version:
7274
- vim: "v9.1.0448"
7375
nvim: "v0.10.0"

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,9 @@ can ask questions in English.
172172
173173
### YouTube
174174
175-
[![Revolutionizing Vim/Neovim Plugin Development ~ An In-Depth Look into Denops
176-
](http://img.youtube.com/vi/hu9EN7jl2kA/0.jpg)](https://www.youtube.com/watch?v=hu9EN7jl2kA)<br>
177-
[English slide](https://bit.ly/4eQ8LH5) in a talk at [VimConf 2023 Tiny](https://vimconf.org/2023/) (with Japanese)
175+
[![Revolutionizing Vim/Neovim Plugin Development ~ An In-Depth Look into Denops](http://img.youtube.com/vi/hu9EN7jl2kA/0.jpg)](https://www.youtube.com/watch?v=hu9EN7jl2kA)<br>
176+
[English slide](https://bit.ly/4eQ8LH5) in a talk at
177+
[VimConf 2023 Tiny](https://vimconf.org/2023/) (with Japanese)
178178
179179
## Misc.
180180

denops/@denops-private/service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ class Plugin {
275275
try {
276276
return await this.#denops.dispatcher[fn](...args);
277277
} catch (err) {
278-
const errMsg = err.message ?? err;
278+
const errMsg = err instanceof Error ? err.message : String(err);
279279
throw new Error(
280280
`Failed to call '${fn}' API in '${this.name}': ${errMsg}`,
281281
);

tests/denops/testutil/mock.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ export function pendingPromise(): Promise<never> {
77
}
88

99
/** Returns a fake `TcpListener` instance. */
10-
export function createFakeTcpListener(): Deno.TcpListener {
10+
// NOTE: 'rid' is removed from Deno v2
11+
export function createFakeTcpListener(): { rid: unknown } & Deno.TcpListener {
1112
let closeWaiter: PromiseWithResolvers<never> | undefined = Promise
1213
.withResolvers();
1314
closeWaiter.promise.catch(() => {});
@@ -54,7 +55,8 @@ export function createFakeTcpListener(): Deno.TcpListener {
5455
}
5556

5657
/** Returns a fake `TcpConn` instance. */
57-
export function createFakeTcpConn(): Deno.TcpConn {
58+
// NOTE: 'rid' is removed from Deno v2
59+
export function createFakeTcpConn(): { rid: unknown } & Deno.TcpConn {
5860
return {
5961
get localAddr() {
6062
return unimplemented();

tests/denops/testutil/mock_test.ts

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,11 @@ Deno.test("createFakeTcpListener()", async (t) => {
5757
close: 0,
5858
[Symbol.asyncIterator]: 0,
5959
[Symbol.dispose]: 0,
60-
} as const satisfies Record<keyof Deno.TcpListener, 0>,
60+
} as const satisfies Record<
61+
// NOTE: 'rid' is removed from Deno v2
62+
keyof { rid: unknown } & Deno.TcpListener,
63+
0
64+
>,
6165
);
6266
for (const key of keys) {
6367
await t.step(key.toString(), () => {
@@ -70,7 +74,10 @@ Deno.test("createFakeTcpListener()", async (t) => {
7074
const unimplementedProps = [
7175
"addr",
7276
"rid",
73-
] as const satisfies readonly GetterKeyOf<Deno.TcpListener>[];
77+
] as const satisfies readonly GetterKeyOf<
78+
// NOTE: 'rid' is removed from Deno v2
79+
{ rid: unknown } & Deno.TcpListener
80+
>[];
7481
for (const key of unimplementedProps) {
7582
await t.step(`.${key}`, () => {
7683
assertThrows(() => listener[key], Error, "Unimplemented");
@@ -230,7 +237,11 @@ Deno.test("createFakeTcpConn()", async (t) => {
230237
close: 0,
231238
closeWrite: 0,
232239
[Symbol.dispose]: 0,
233-
} as const satisfies Record<keyof Deno.TcpConn, 0>,
240+
} as const satisfies Record<
241+
// NOTE: 'rid' is removed from Deno v2
242+
keyof { rid: unknown } & Deno.TcpConn,
243+
0
244+
>,
234245
);
235246
for (const key of keys) {
236247
await t.step(key.toString(), () => {
@@ -246,7 +257,10 @@ Deno.test("createFakeTcpConn()", async (t) => {
246257
"rid",
247258
"readable",
248259
"writable",
249-
] as const satisfies readonly GetterKeyOf<Deno.TcpConn>[];
260+
] as const satisfies readonly GetterKeyOf<
261+
// NOTE: 'rid' is removed from Deno v2
262+
{ rid: unknown } & Deno.TcpConn
263+
>[];
250264
for (const key of unimplementedProps) {
251265
await t.step(`.${key}`, () => {
252266
assertThrows(() => conn[key], Error, "Unimplemented");

0 commit comments

Comments
 (0)