From 715c2a4a6552207d0d6d8274c24117793728ffe6 Mon Sep 17 00:00:00 2001 From: FUJI Goro Date: Fri, 8 Sep 2023 22:39:08 +0900 Subject: [PATCH 1/5] add node v20 to CI matrix --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1e57c578..dc27efa6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,6 +16,7 @@ jobs: - '14' - '16' - '18' + - '20' steps: - uses: actions/checkout@v3 From ad5767de069366e7567d54079f43f0aa0fdf3e07 Mon Sep 17 00:00:00 2001 From: FUJI Goro Date: Fri, 8 Sep 2023 22:43:08 +0900 Subject: [PATCH 2/5] fix CI settings; no node 14 testing --- .github/workflows/ci.yml | 3 +-- .github/workflows/fuzz.yml | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dc27efa6..79dacfa7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,7 +13,6 @@ jobs: strategy: matrix: node-version: - - '14' - '16' - '18' - '20' @@ -44,7 +43,7 @@ jobs: uses: actions/setup-node@v2 with: cache: npm - node-version: '16' + node-version: '18' - run: npm install -g npm - run: npm ci - run: npm run test:browser -- --browsers ${{ matrix.browser }} diff --git a/.github/workflows/fuzz.yml b/.github/workflows/fuzz.yml index 257e9ae4..bbafd766 100644 --- a/.github/workflows/fuzz.yml +++ b/.github/workflows/fuzz.yml @@ -21,5 +21,6 @@ jobs: cache: npm node-version: "18" + - run: npm install -g npm - run: npm ci - run: npm run test:fuzz From 39a2e5b5f8fa781f86e1e69e98aced2ce2a55c5f Mon Sep 17 00:00:00 2001 From: FUJI Goro Date: Fri, 8 Sep 2023 22:44:53 +0900 Subject: [PATCH 3/5] the latest npm does not support node 16 anymore --- .github/workflows/ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 79dacfa7..669ee02a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,7 +25,6 @@ jobs: cache: npm node-version: ${{ matrix.node-version }} - - run: npm install -g npm - run: npm install -g nyc codecov - run: npm ci - run: npm run test:cover From a3be0654047043d14d7984c3690531f15d224de7 Mon Sep 17 00:00:00 2001 From: FUJI Goro Date: Fri, 8 Sep 2023 22:47:37 +0900 Subject: [PATCH 4/5] fix test:browser --- src/index.ts | 2 +- test/CachedKeyDecoder.test.ts | 2 +- test/ExtensionCodec.test.ts | 4 ++-- test/bigint64.test.ts | 2 +- test/codec-bigint.test.ts | 2 +- test/codec-float.test.ts | 2 +- test/codec-int.test.ts | 2 +- test/codec-timestamp.test.ts | 4 ++-- test/decode-blob.test.ts | 2 +- test/decode-max-length.test.ts | 2 +- test/decodeArrayStream.test.ts | 2 +- test/decodeAsync.test.ts | 2 +- test/decodeMulti.test.ts | 2 +- test/decodeMultiStream.test.ts | 2 +- test/edge-cases.test.ts | 2 +- test/encode.test.ts | 2 +- test/msgpack-ext.test.ts | 2 +- test/msgpack-test-suite.test.ts | 4 ++-- test/prototype-pollution.test.ts | 2 +- test/readme.test.ts | 2 +- test/reuse-instances.test.ts | 2 +- test/whatwg-streams.test.ts | 2 +- 22 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/index.ts b/src/index.ts index b4765525..4141ad4d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -8,7 +8,7 @@ export type { EncodeOptions }; import { decode, decodeMulti } from "./decode"; export { decode, decodeMulti }; import type { DecodeOptions } from "./decode"; -export { DecodeOptions }; +export type { DecodeOptions }; import { decodeAsync, decodeArrayStream, decodeMultiStream, decodeStream } from "./decodeAsync"; export { decodeAsync, decodeArrayStream, decodeMultiStream, decodeStream }; diff --git a/test/CachedKeyDecoder.test.ts b/test/CachedKeyDecoder.test.ts index eaee6c8e..09f58424 100644 --- a/test/CachedKeyDecoder.test.ts +++ b/test/CachedKeyDecoder.test.ts @@ -1,4 +1,4 @@ -import assert from "node:assert"; +import assert from "assert"; import { CachedKeyDecoder, KeyDecoder } from "../src/CachedKeyDecoder"; import { utf8EncodeJs, utf8Count } from "../src/utils/utf8"; diff --git a/test/ExtensionCodec.test.ts b/test/ExtensionCodec.test.ts index 48d41738..21ae8db6 100644 --- a/test/ExtensionCodec.test.ts +++ b/test/ExtensionCodec.test.ts @@ -1,5 +1,5 @@ -import assert from "node:assert"; -import util from "node:util"; +import assert from "assert"; +import util from "util"; import { encode, decode, ExtensionCodec, decodeAsync } from "../src"; describe("ExtensionCodec", () => { diff --git a/test/bigint64.test.ts b/test/bigint64.test.ts index 10e2a65f..fabf0f54 100644 --- a/test/bigint64.test.ts +++ b/test/bigint64.test.ts @@ -1,4 +1,4 @@ -import assert from "node:assert"; +import assert from "assert"; import { encode, decode } from "../src"; describe("useBigInt64: true", () => { diff --git a/test/codec-bigint.test.ts b/test/codec-bigint.test.ts index 0a9ef27a..4ed6afff 100644 --- a/test/codec-bigint.test.ts +++ b/test/codec-bigint.test.ts @@ -1,4 +1,4 @@ -import assert from "node:assert"; +import assert from "assert"; import { encode, decode, ExtensionCodec, DecodeError } from "../src"; // There's a built-in `useBigInt64: true` option, but a custom codec might be diff --git a/test/codec-float.test.ts b/test/codec-float.test.ts index 050c563e..6b55df70 100644 --- a/test/codec-float.test.ts +++ b/test/codec-float.test.ts @@ -1,4 +1,4 @@ -import assert from "node:assert"; +import assert from "assert"; import { decode } from "../src"; import * as ieee754 from "ieee754"; diff --git a/test/codec-int.test.ts b/test/codec-int.test.ts index 2d4d6117..486f93b7 100644 --- a/test/codec-int.test.ts +++ b/test/codec-int.test.ts @@ -1,4 +1,4 @@ -import assert from "node:assert"; +import assert from "assert"; import { setInt64, getInt64, getUint64, setUint64 } from "../src/utils/int"; const INT64SPECS = { diff --git a/test/codec-timestamp.test.ts b/test/codec-timestamp.test.ts index a3927a60..de4f707b 100644 --- a/test/codec-timestamp.test.ts +++ b/test/codec-timestamp.test.ts @@ -1,5 +1,5 @@ -import assert from "node:assert"; -import util from "node:util"; +import assert from "assert"; +import util from "util"; import { encode, decode, diff --git a/test/decode-blob.test.ts b/test/decode-blob.test.ts index 11e9a8b4..4c7c536f 100644 --- a/test/decode-blob.test.ts +++ b/test/decode-blob.test.ts @@ -1,4 +1,4 @@ -import assert from "node:assert"; +import assert from "assert"; import { encode, decode, decodeAsync } from "@msgpack/msgpack"; (typeof Blob !== "undefined" ? describe : describe.skip)("Blob", () => { diff --git a/test/decode-max-length.test.ts b/test/decode-max-length.test.ts index c7489c87..7ee2e33a 100644 --- a/test/decode-max-length.test.ts +++ b/test/decode-max-length.test.ts @@ -1,4 +1,4 @@ -import assert from "node:assert"; +import assert from "assert"; import { encode, decode, decodeAsync } from "../src"; import type { DecoderOptions } from "../src"; diff --git a/test/decodeArrayStream.test.ts b/test/decodeArrayStream.test.ts index a06ed993..04861018 100644 --- a/test/decodeArrayStream.test.ts +++ b/test/decodeArrayStream.test.ts @@ -1,4 +1,4 @@ -import assert from "node:assert"; +import assert from "assert"; import { encode, decodeArrayStream } from "../src"; describe("decodeArrayStream", () => { diff --git a/test/decodeAsync.test.ts b/test/decodeAsync.test.ts index 473c1675..0e8d9017 100644 --- a/test/decodeAsync.test.ts +++ b/test/decodeAsync.test.ts @@ -1,4 +1,4 @@ -import assert from "node:assert"; +import assert from "assert"; import { encode, decodeAsync } from "../src"; describe("decodeAsync", () => { diff --git a/test/decodeMulti.test.ts b/test/decodeMulti.test.ts index 9d4037dc..346d15c1 100644 --- a/test/decodeMulti.test.ts +++ b/test/decodeMulti.test.ts @@ -1,4 +1,4 @@ -import assert from "node:assert"; +import assert from "assert"; import { encode, decodeMulti } from "@msgpack/msgpack"; describe("decodeMulti", () => { diff --git a/test/decodeMultiStream.test.ts b/test/decodeMultiStream.test.ts index 9ef379b0..cef9d6e3 100644 --- a/test/decodeMultiStream.test.ts +++ b/test/decodeMultiStream.test.ts @@ -1,4 +1,4 @@ -import assert from "node:assert"; +import assert from "assert"; import { encode, decodeMultiStream } from "@msgpack/msgpack"; describe("decodeStream", () => { diff --git a/test/edge-cases.test.ts b/test/edge-cases.test.ts index f434915a..ca4ad511 100644 --- a/test/edge-cases.test.ts +++ b/test/edge-cases.test.ts @@ -1,6 +1,6 @@ // kind of hand-written fuzzing data // any errors should not break Encoder/Decoder instance states -import assert from "node:assert"; +import assert from "assert"; import { encode, decodeAsync, decode, Encoder, Decoder, decodeMulti, decodeMultiStream } from "../src"; import { DataViewIndexOutOfBoundsError } from "../src/Decoder"; diff --git a/test/encode.test.ts b/test/encode.test.ts index 71a0799c..d2679d52 100644 --- a/test/encode.test.ts +++ b/test/encode.test.ts @@ -1,4 +1,4 @@ -import assert from "node:assert"; +import assert from "assert"; import { encode, decode } from "@msgpack/msgpack"; describe("encode", () => { diff --git a/test/msgpack-ext.test.ts b/test/msgpack-ext.test.ts index fc96f80b..73a536a1 100644 --- a/test/msgpack-ext.test.ts +++ b/test/msgpack-ext.test.ts @@ -1,4 +1,4 @@ -import assert from "node:assert"; +import assert from "assert"; import { encode, decode, ExtData } from "../src"; function seq(n: number) { diff --git a/test/msgpack-test-suite.test.ts b/test/msgpack-test-suite.test.ts index 891c62ca..6800973e 100644 --- a/test/msgpack-test-suite.test.ts +++ b/test/msgpack-test-suite.test.ts @@ -1,5 +1,5 @@ -import assert from "node:assert"; -import util from "node:util"; +import assert from "assert"; +import util from "util"; import { Exam } from "msgpack-test-js"; import { MsgTimestamp } from "msg-timestamp"; import { encode, decode, ExtensionCodec, EXT_TIMESTAMP, encodeTimeSpecToTimestamp } from "@msgpack/msgpack"; diff --git a/test/prototype-pollution.test.ts b/test/prototype-pollution.test.ts index f73f3830..bc15b633 100644 --- a/test/prototype-pollution.test.ts +++ b/test/prototype-pollution.test.ts @@ -1,4 +1,4 @@ -import { throws } from "node:assert"; +import { throws } from "assert"; import { encode, decode, DecodeError } from "@msgpack/msgpack"; describe("prototype pollution", () => { diff --git a/test/readme.test.ts b/test/readme.test.ts index ea47b112..fea8123b 100644 --- a/test/readme.test.ts +++ b/test/readme.test.ts @@ -1,4 +1,4 @@ -import { deepStrictEqual } from "node:assert"; +import { deepStrictEqual } from "assert"; import { encode, decode } from "@msgpack/msgpack"; describe("README", () => { diff --git a/test/reuse-instances.test.ts b/test/reuse-instances.test.ts index 9930d81c..29a0b786 100644 --- a/test/reuse-instances.test.ts +++ b/test/reuse-instances.test.ts @@ -1,4 +1,4 @@ -import { deepStrictEqual } from "node:assert"; +import { deepStrictEqual } from "assert"; import { Encoder, Decoder, decode } from "@msgpack/msgpack"; const createStream = async function* (...args: any) { diff --git a/test/whatwg-streams.test.ts b/test/whatwg-streams.test.ts index 86602643..7a83805a 100644 --- a/test/whatwg-streams.test.ts +++ b/test/whatwg-streams.test.ts @@ -1,4 +1,4 @@ -import { deepStrictEqual } from "node:assert"; +import { deepStrictEqual } from "assert"; import { decodeAsync, encode, decodeArrayStream } from "@msgpack/msgpack"; const isReadableStreamConstructorAvailable: boolean = (() => { From 5b0f25e39fb0303725add400e25ae3af87c3cd53 Mon Sep 17 00:00:00 2001 From: FUJI Goro Date: Fri, 8 Sep 2023 23:03:10 +0900 Subject: [PATCH 5/5] use npm@8 for test:fuzz --- .github/workflows/fuzz.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/fuzz.yml b/.github/workflows/fuzz.yml index bbafd766..1225305e 100644 --- a/.github/workflows/fuzz.yml +++ b/.github/workflows/fuzz.yml @@ -21,6 +21,7 @@ jobs: cache: npm node-version: "18" - - run: npm install -g npm + # npm@9 may fail with https://github.com/npm/cli/issues/6723 + - run: npm install -g npm@8 - run: npm ci - run: npm run test:fuzz