diff --git a/package.json b/package.json index e42f8e55..6476b741 100644 --- a/package.json +++ b/package.json @@ -27,9 +27,7 @@ "build": "vite build --config ./config/vite.config.js", "test": "npm run test-backend && npm run test-e2e", "test-with-build": "npm run build && npm test", - "test-backend": "node test/backend-test-entry.js", - "test-backend:14": "cross-env TEST_BACKEND=1 NODE_OPTIONS=\"--experimental-abortcontroller --no-warnings\" node--test test/backend-test", - "test-backend:18": "cross-env TEST_BACKEND=1 node --test test/backend-test", + "test-backend": "cross-env TEST_BACKEND=1 node --test test/backend-test", "test-e2e": "playwright test --config ./config/playwright.config.js", "test-e2e-ui": "playwright test --config ./config/playwright.config.js --ui --ui-port=51063", "playwright-codegen": "playwright codegen localhost:3000 --save-storage=./private/e2e-auth.json", diff --git a/server/notification-providers/nostr.js b/server/notification-providers/nostr.js index 453b86d0..87847382 100644 --- a/server/notification-providers/nostr.js +++ b/server/notification-providers/nostr.js @@ -1,4 +1,3 @@ -const { log } = require("../../src/util"); const NotificationProvider = require("./notification-provider"); const { relayInit, @@ -12,16 +11,7 @@ const { // polyfills for node versions const semver = require("semver"); const nodeVersion = process.version; -if (semver.lt(nodeVersion, "16.0.0")) { - log.warn("monitor", "Node <= 16 is unsupported for nostr, sorry :("); -} else if (semver.lt(nodeVersion, "18.0.0")) { - // polyfills for node 16 - global.crypto = require("crypto"); - global.WebSocket = require("isomorphic-ws"); - if (typeof crypto !== "undefined" && !crypto.subtle && crypto.webcrypto) { - crypto.subtle = crypto.webcrypto.subtle; - } -} else if (semver.lt(nodeVersion, "20.0.0")) { +if (semver.lt(nodeVersion, "20.0.0")) { // polyfills for node 18 global.crypto = require("crypto"); global.WebSocket = require("isomorphic-ws"); diff --git a/server/server.js b/server/server.js index d0af4038..f14cb2dd 100644 --- a/server/server.js +++ b/server/server.js @@ -19,7 +19,7 @@ const nodeVersion = process.versions.node; // Get the required Node.js version from package.json const requiredNodeVersions = require("../package.json").engines.node; -const bannedNodeVersions = " < 14 || 20.0.* || 20.1.* || 20.2.* || 20.3.* "; +const bannedNodeVersions = " < 18 || 20.0.* || 20.1.* || 20.2.* || 20.3.* "; console.log(`Your Node.js version: ${nodeVersion}`); const semver = require("semver"); diff --git a/test/backend-test-entry.js b/test/backend-test-entry.js deleted file mode 100644 index 7cc8d734..00000000 --- a/test/backend-test-entry.js +++ /dev/null @@ -1,20 +0,0 @@ -// Check Node.js version -const semver = require("semver"); -const childProcess = require("child_process"); - -const nodeVersion = process.versions.node; -console.log("Node.js version: " + nodeVersion); - - - -// Node.js version >= 18 -if (semver.satisfies(nodeVersion, ">= 18")) { - console.log("Use the native test runner: `node --test`"); - childProcess.execSync("npm run test-backend:18", { stdio: "inherit" }); -} else { - // 14 - 16 here - console.log("Use `test` package: `node--test`") - childProcess.execSync("npm run test-backend:14", { stdio: "inherit" }); -} - - diff --git a/test/backend-test/README.md b/test/backend-test/README.md index 5686fae7..775ffb7a 100644 --- a/test/backend-test/README.md +++ b/test/backend-test/README.md @@ -7,15 +7,7 @@ Create a test file in this directory with the name `*.js`. ## Template ```js -const semver = require("semver"); -let test; -const nodeVersion = process.versions.node; -if (semver.satisfies(nodeVersion, ">= 18")) { - test = require("node:test"); -} else { - test = require("test"); -} - +const test = require("node:test"); const assert = require("node:assert"); test("Test name", async (t) => { @@ -25,14 +17,6 @@ test("Test name", async (t) => { ## Run -Node.js >=18 - -```bash -npm run test-backend:18 -``` - -Node.js < 18 - ```bash -npm run test-backend:14 +npm run test-backend ``` diff --git a/test/backend-test/test-uptime-calculator.js b/test/backend-test/test-uptime-calculator.js index 0c7a38d2..4f2f05ef 100644 --- a/test/backend-test/test-uptime-calculator.js +++ b/test/backend-test/test-uptime-calculator.js @@ -1,13 +1,4 @@ -const semver = require("semver"); -let test; -const nodeVersion = process.versions.node; -// Node.js version >= 18 -if (semver.satisfies(nodeVersion, ">= 18")) { - test = require("node:test"); -} else { - test = require("test"); -} - +const test = require("node:test"); const assert = require("node:assert"); const { UptimeCalculator } = require("../../server/uptime-calculator"); const dayjs = require("dayjs");