diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c09b987c0..b70191347 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,8 +9,8 @@ jobs: fail-fast: true matrix: node-version: - - lts/* # LTS version - - "17" # latest version + - lts/* + - latest os: [ubuntu-latest, macOS-latest, windows-latest] steps: diff --git a/packages/krl-compiler/package.json b/packages/krl-compiler/package.json index 2d26a64dc..3df61bd6b 100644 --- a/packages/krl-compiler/package.json +++ b/packages/krl-compiler/package.json @@ -30,7 +30,7 @@ }, "homepage": "https://github.com/Picolab/pico-engine#readme", "devDependencies": { - "ava": "^4.0.0", + "ava": "^5.3.1", "contra": "^1.9.4", "diff-lines": "^1.1.0", "standard": "^12.0.1" diff --git a/packages/krl-generator/package.json b/packages/krl-generator/package.json index 20973e237..4c35560d7 100644 --- a/packages/krl-generator/package.json +++ b/packages/krl-generator/package.json @@ -24,7 +24,7 @@ }, "homepage": "https://github.com/Picolab/pico-engine#readme", "devDependencies": { - "ava": "^4.0.0", + "ava": "^5.3.1", "krl-parser": "^1.3.0", "standard": "^12.0.1" }, diff --git a/packages/krl-parser/package.json b/packages/krl-parser/package.json index b129fbe5e..964524950 100644 --- a/packages/krl-parser/package.json +++ b/packages/krl-parser/package.json @@ -32,8 +32,8 @@ "homepage": "https://github.com/Picolab/pico-engine#readme", "devDependencies": { "ava": "^2.4.0", - "ts-node": "^9.1.1", - "typescript": "^4.1.2" + "ts-node": "^10.9.1", + "typescript": "^5.2.2" }, "dependencies": { "excerpt-at-line-col": "^1.0.0", diff --git a/packages/krl-stdlib/package.json b/packages/krl-stdlib/package.json index 8bfed3e40..6080e1770 100644 --- a/packages/krl-stdlib/package.json +++ b/packages/krl-stdlib/package.json @@ -33,10 +33,10 @@ "@types/leveldown": "^4.0.0", "@types/levelup": "^3.1.0", "@types/lodash": "^4.14.123", - "@types/node": "^14.0.24", + "@types/node": "^20.8.10", "ava": "^1.4.1", "ts-node": "^10.4.0", - "typescript": "^4.1.2" + "typescript": "^5.2.2" }, "dependencies": { "json-log": "^3.0.1", diff --git a/packages/pico-engine-core/package.json b/packages/pico-engine-core/package.json index 9d4d8cf44..9c34ead5c 100644 --- a/packages/pico-engine-core/package.json +++ b/packages/pico-engine-core/package.json @@ -56,10 +56,10 @@ "@types/abstract-leveldown": "^5.0.1", "@types/levelup": "^4.3.3", "@types/lodash": "^4.14.123", - "@types/node": "^14.14.10", + "@types/node": "^20.8.10", "ava": "^1.4.1", "ts-node": "^10.4.0", - "typescript": "^4.1.2" + "typescript": "^5.2.2" }, "ava": { "compileEnhancements": false, diff --git a/packages/pico-engine-core/test/modules/http.ts b/packages/pico-engine-core/test/modules/http.ts index 8575261b5..69fd009e6 100644 --- a/packages/pico-engine-core/test/modules/http.ts +++ b/packages/pico-engine-core/test/modules/http.ts @@ -4,7 +4,7 @@ import * as _ from "lodash"; import makeCoreAndKrlCtx from "../helpers/makeCoreAndKrlCtx"; test("http module", async function (t) { - var server = http.createServer(function (req, res) { + var server = http.createServer({ keepAliveTimeout: 0 }, function (req, res) { var body = ""; req.on("data", function (buffer) { body += buffer.toString(); @@ -26,7 +26,7 @@ test("http module", async function (t) { body: body, }, undefined, - 2 + 2, ); res.writeHead(200, { "Content-Type": "application/json", @@ -65,7 +65,7 @@ test("http module", async function (t) { url: "/?a=1", headers: { host, - connection: "close", + connection: "keep-alive", "user-agent": "pico-engine-core-http", accept: "*/*", "accept-encoding": "gzip,deflate", @@ -77,7 +77,7 @@ test("http module", async function (t) { status_line: "OK", headers: { "content-type": "application/json", - connection: "close", + connection: "keep-alive", "da-extra-header": "wat?", }, }); @@ -105,7 +105,7 @@ test("http module", async function (t) { authorization: "Basic Ym9iOm5vcGFzcw==", "user-agent": "pico-engine-core-http", "content-length": "14", - connection: "close", + connection: "keep-alive", "content-type": "text/plain;charset=UTF-8", accept: "*/*", "accept-encoding": "gzip,deflate", @@ -117,7 +117,7 @@ test("http module", async function (t) { status_line: "OK", headers: { "content-type": "application/json", - connection: "close", + connection: "keep-alive", "da-extra-header": "wat?", }, }); @@ -138,7 +138,7 @@ test("http module", async function (t) { host, "content-type": "application/x-www-form-urlencoded", "content-length": "45", - connection: "close", + connection: "keep-alive", "user-agent": "pico-engine-core-http", accept: "*/*", "accept-encoding": "gzip,deflate", @@ -150,7 +150,7 @@ test("http module", async function (t) { status_line: "OK", headers: { "content-type": "application/json", - connection: "close", + connection: "keep-alive", "da-extra-header": "wat?", }, }); @@ -171,7 +171,7 @@ test("http module", async function (t) { host, "content-type": "application/json", "content-length": "41", - connection: "close", + connection: "keep-alive", "user-agent": "pico-engine-core-http", accept: "*/*", "accept-encoding": "gzip,deflate", @@ -183,7 +183,7 @@ test("http module", async function (t) { status_line: "OK", headers: { "content-type": "application/json", - connection: "close", + connection: "keep-alive", "da-extra-header": "wat?", }, }); @@ -199,7 +199,7 @@ test("http module", async function (t) { headers: { host, "content-length": "0", - connection: "close", + connection: "keep-alive", "user-agent": "pico-engine-core-http", accept: "*/*", "accept-encoding": "gzip,deflate", @@ -211,7 +211,7 @@ test("http module", async function (t) { status_line: "OK", headers: { "content-type": "application/json", - connection: "close", + connection: "keep-alive", "da-extra-header": "wat?", }, }); @@ -227,7 +227,7 @@ test("http module", async function (t) { status_code: 200, status_line: "OK", headers: { - connection: "close", + connection: "keep-alive", }, }); @@ -238,7 +238,7 @@ test("http module", async function (t) { err = await t.throwsAsync(khttp[method](krlCtx, { url: { one: 1 } })); t.is( err + "", - `TypeError: http:${method} was given [Map] instead of a url string` + `TypeError: http:${method} was given [Map] instead of a url string`, ); } }); @@ -259,10 +259,13 @@ test("http autosend", async function (t) { serverRespond = resolve; }); - const server = http.createServer(function (req, res) { - res.end("some response"); - serverRespond(); - }); + const server = http.createServer( + { keepAliveTimeout: 0 }, + function (req, res) { + res.end("some response"); + serverRespond(); + }, + ); server.unref(); await new Promise(function (resolve) { server.listen(0, () => resolve(undefined)); @@ -285,7 +288,7 @@ test("http autosend", async function (t) { t.deepEqual( signaledEvents, [], - "should be empty bc the server has not yet responded" + "should be empty bc the server has not yet responded", ); await serverResponse; @@ -311,7 +314,7 @@ test("http autosend", async function (t) { status_code: 200, status_line: "OK", headers: { - connection: "close", + connection: "keep-alive", "content-length": "13", }, }, @@ -324,16 +327,19 @@ test("http redirects", async function (t) { const { core, krlCtx } = await makeCoreAndKrlCtx(); const khttp = core.modules["http"]; - const server = http.createServer(function (req, res) { - if (req.url === "/redir") { - res.writeHead(302, { - Location: "/other", - }); - res.end(); - } else { - res.end("some response"); - } - }); + const server = http.createServer( + { keepAliveTimeout: 0 }, + function (req, res) { + if (req.url === "/redir") { + res.writeHead(302, { + Location: "/other", + }); + res.end(); + } else { + res.end("some response"); + } + }, + ); server.unref(); await new Promise(function (resolve) { server.listen(0, () => resolve(undefined)); @@ -351,7 +357,7 @@ test("http redirects", async function (t) { content_length: 13, content_type: null, headers: { - connection: "close", + connection: "keep-alive", "content-length": "13", }, status_code: 200, @@ -369,7 +375,7 @@ test("http redirects", async function (t) { content_length: 0, content_type: null, headers: { - connection: "close", + connection: "keep-alive", location: url + "/other", "transfer-encoding": "chunked", }, diff --git a/packages/pico-engine/package.json b/packages/pico-engine/package.json index fc7ff1961..fe9c5fdb2 100644 --- a/packages/pico-engine/package.json +++ b/packages/pico-engine/package.json @@ -72,13 +72,13 @@ "@types/leveldown": "^4.0.0", "@types/levelup": "^3.1.0", "@types/lodash": "^4.14.123", - "@types/node": "^14.14.10", + "@types/node": "^20.8.10", "ava": "^1.4.1", "onchange": "^6.0.0", "scriptsp": "^1.1.1", "temp-dir": "^2.0.0", "ts-node": "^10.4.0", - "typescript": "^4.1.2" + "typescript": "^5.2.2" }, "ava": { "compileEnhancements": false,