From 2ec5e07a497b8107abd9ef1799cd3dba49389dfe Mon Sep 17 00:00:00 2001 From: Yoshiya Hinosawa Date: Wed, 9 Mar 2022 01:13:45 +0900 Subject: [PATCH] docs: fix doc testing errors (#2012) --- async/README.md | 23 ++++++++++++----------- encoding/README.md | 22 ++++++++++------------ node/integrationtest/test.ts | 8 +++++++- 3 files changed, 29 insertions(+), 24 deletions(-) diff --git a/async/README.md b/async/README.md index 041144744..c19872b71 100644 --- a/async/README.md +++ b/async/README.md @@ -14,8 +14,8 @@ cancelable. For example, in the case of `Promise`, it looks like this ```typescript -import { abortable } from "https://deno.land/std/async/mod.ts"; -import { delay } from "https://deno.land/std/async/mod.ts"; +import { abortable } from "https://deno.land/std@$STD_VERSION/async/mod.ts"; +import { delay } from "https://deno.land/std@$STD_VERSION/async/mod.ts"; const p = delay(1000); const c = new AbortController(); @@ -28,8 +28,8 @@ await abortable(p, c.signal); and for `AsyncIterable` as follows ```typescript -import { abortable } from "https://deno.land/std/async/mod.ts"; -import { delay } from "https://deno.land/std/async/mod.ts"; +import { abortable } from "https://deno.land/std@$STD_VERSION/async/mod.ts"; +import { delay } from "https://deno.land/std@$STD_VERSION/async/mod.ts"; const p = async function* () { yield "Hello"; @@ -52,7 +52,7 @@ for await (const item of abortable(p(), c.signal)) { Debounces a given function by a given time. ```typescript -import { debounce } from "https://deno.land/std/async/mod.ts"; +import { debounce } from "https://deno.land/std@$STD_VERSION/async/mod.ts"; const p = debounce( (value: string) => @@ -71,7 +71,7 @@ p("baz"); Create a Promise with the `reject` and `resolve` functions. ```typescript -import { deferred } from "https://deno.land/std/async/mod.ts"; +import { deferred } from "https://deno.land/std@$STD_VERSION/async/mod.ts"; const p = deferred(); // ... @@ -83,7 +83,7 @@ p.resolve(42); Resolve a Promise after a given amount of milliseconds. ```typescript -import { delay } from "https://deno.land/std/async/mod.ts"; +import { delay } from "https://deno.land/std@$STD_VERSION/async/mod.ts"; // ... const delayedPromise = delay(100); @@ -101,7 +101,7 @@ yielded from the iterator) does not matter. If there is any result, it is discarded. ```typescript -import { MuxAsyncIterator } from "https://deno.land/std/async/mod.ts"; +import { MuxAsyncIterator } from "https://deno.land/std@$STD_VERSION/async/mod.ts"; async function* gen123(): AsyncIterableIterator { yield 1; @@ -131,7 +131,7 @@ transforms are done concurrently, with a max concurrency defined by the poolLimit. ```typescript -import { pooledMap } from "https://deno.land/std/async/mod.ts"; +import { pooledMap } from "https://deno.land/std@$STD_VERSION/async/mod.ts"; const results = pooledMap( 2, @@ -149,7 +149,7 @@ for await (const value of results) { Branches the given async iterable into the n branches. ```typescript -import { tee } from "https://deno.land/std/async/tee.ts"; +import { tee } from "https://deno.land/std@$STD_VERSION/async/tee.ts"; const gen = async function* gen() { yield 1; @@ -178,7 +178,8 @@ Create a promise which will be rejected with `DeadlineError` when a given delay is exceeded. ```typescript -import { deadline } from "https://deno.land/std/async/mod.ts"; +import { deadline } from "https://deno.land/std@$STD_VERSION/async/mod.ts"; +import { delay } from "https://deno.land/std@$STD_VERSION/async/mod.ts"; const delayedPromise = delay(1000); // Below throws `DeadlineError` after 10 ms diff --git a/encoding/README.md b/encoding/README.md index 4174c1828..f9e71ba12 100644 --- a/encoding/README.md +++ b/encoding/README.md @@ -17,18 +17,16 @@ Implements equivalent methods to Go's `encoding/binary` package. Available Functions: -```typescript -sizeof(dataType: RawTypes): number -getNBytes(r: Deno.Reader, n: number): Promise -varnum(b: Uint8Array, o: VarnumOptions = {}): number | null -varbig(b: Uint8Array, o: VarbigOptions = {}): bigint | null -putVarnum(b: Uint8Array, x: number, o: VarnumOptions = {}): number -putVarbig(b: Uint8Array, x: bigint, o: VarbigOptions = {}): number -readVarnum(r: Deno.Reader, o: VarnumOptions = {}): Promise -readVarbig(r: Deno.Reader, o: VarbigOptions = {}): Promise -writeVarnum(w: Deno.Writer, x: number, o: VarnumOptions = {}): Promise -writeVarbig(w: Deno.Writer, x: bigint, o: VarbigOptions = {}): Promise -``` +- `sizeof(dataType: DataTypes): number` +- `getNBytes(r: Deno.Reader, n: number): Promise` +- `varnum(b: Uint8Array, o: VarnumOptions = {}): number | null` +- `varbig(b: Uint8Array, o: VarbigOptions = {}): bigint | null` +- `putVarnum(b: Uint8Array, x: number, o: VarnumOptions = {}): number` +- `putVarbig(b: Uint8Array, x: bigint, o: VarbigOptions = {}): number` +- `readVarnum(r: Deno.Reader, o: VarnumOptions = {}): Promise` +- `readVarbig(r: Deno.Reader, o: VarbigOptions = {}): Promise` +- `writeVarnum(w: Deno.Writer, x: number, o: VarnumOptions = {}): Promise` +- `writeVarbig(w: Deno.Writer, x: bigint, o: VarbigOptions = {}): Promise` ## CSV diff --git a/node/integrationtest/test.ts b/node/integrationtest/test.ts index 1972621bb..736f52164 100644 --- a/node/integrationtest/test.ts +++ b/node/integrationtest/test.ts @@ -15,7 +15,7 @@ Deno.test("integration test of compat mode", { const tempDir = await Deno.makeTempDir(); const opts = { env, cwd: tempDir }; const npmPath = join(tempDir, "node_modules", "npm"); - const gulpPath = join(tempDir, "node_modules", "gulp"); + const _gulpPath = join(tempDir, "node_modules", "gulp"); const mysql2Path = join(tempDir, "node_modules", "mysql2"); const expressPath = join(tempDir, "node_modules", "express"); let hasDocker; @@ -35,12 +35,18 @@ Deno.test("integration test of compat mode", { assert((await Deno.lstat(join(mysql2Path, "package.json"))).isFile); }); + // FIXME(kt3k): `npm install gulp` fails at postinstall step of `es5-ext` module. + // Skips this test case for now. + // See https://github.com/denoland/deno_std/runs/5466969636?check_suite_focus=true + // for details + /* await t.step("npm install gulp", async () => { const npmCli = join(npmPath, "index.js"); await exec(`deno run --compat --unstable -A ${npmCli} install gulp`, opts); const stat = await Deno.lstat(join(gulpPath, "package.json")); assert(stat.isFile); }); + */ await t.step("run express example app", async () => { await Deno.writeTextFile(