mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-10-01 01:25:45 -04:00
Removed now unnecessary version checking (#4815)
This commit is contained in:
parent
4b68a86524
commit
0ddf35e7b5
@ -27,9 +27,7 @@
|
|||||||
"build": "vite build --config ./config/vite.config.js",
|
"build": "vite build --config ./config/vite.config.js",
|
||||||
"test": "npm run test-backend && npm run test-e2e",
|
"test": "npm run test-backend && npm run test-e2e",
|
||||||
"test-with-build": "npm run build && npm test",
|
"test-with-build": "npm run build && npm test",
|
||||||
"test-backend": "node test/backend-test-entry.js",
|
"test-backend": "cross-env TEST_BACKEND=1 node --test test/backend-test",
|
||||||
"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-e2e": "playwright test --config ./config/playwright.config.js",
|
"test-e2e": "playwright test --config ./config/playwright.config.js",
|
||||||
"test-e2e-ui": "playwright test --config ./config/playwright.config.js --ui --ui-port=51063",
|
"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",
|
"playwright-codegen": "playwright codegen localhost:3000 --save-storage=./private/e2e-auth.json",
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
const { log } = require("../../src/util");
|
|
||||||
const NotificationProvider = require("./notification-provider");
|
const NotificationProvider = require("./notification-provider");
|
||||||
const {
|
const {
|
||||||
relayInit,
|
relayInit,
|
||||||
@ -12,16 +11,7 @@ const {
|
|||||||
// polyfills for node versions
|
// polyfills for node versions
|
||||||
const semver = require("semver");
|
const semver = require("semver");
|
||||||
const nodeVersion = process.version;
|
const nodeVersion = process.version;
|
||||||
if (semver.lt(nodeVersion, "16.0.0")) {
|
if (semver.lt(nodeVersion, "20.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")) {
|
|
||||||
// polyfills for node 18
|
// polyfills for node 18
|
||||||
global.crypto = require("crypto");
|
global.crypto = require("crypto");
|
||||||
global.WebSocket = require("isomorphic-ws");
|
global.WebSocket = require("isomorphic-ws");
|
||||||
|
@ -19,7 +19,7 @@ const nodeVersion = process.versions.node;
|
|||||||
|
|
||||||
// Get the required Node.js version from package.json
|
// Get the required Node.js version from package.json
|
||||||
const requiredNodeVersions = require("../package.json").engines.node;
|
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}`);
|
console.log(`Your Node.js version: ${nodeVersion}`);
|
||||||
|
|
||||||
const semver = require("semver");
|
const semver = require("semver");
|
||||||
|
@ -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" });
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -7,15 +7,7 @@ Create a test file in this directory with the name `*.js`.
|
|||||||
## Template
|
## Template
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const semver = require("semver");
|
const test = require("node:test");
|
||||||
let test;
|
|
||||||
const nodeVersion = process.versions.node;
|
|
||||||
if (semver.satisfies(nodeVersion, ">= 18")) {
|
|
||||||
test = require("node:test");
|
|
||||||
} else {
|
|
||||||
test = require("test");
|
|
||||||
}
|
|
||||||
|
|
||||||
const assert = require("node:assert");
|
const assert = require("node:assert");
|
||||||
|
|
||||||
test("Test name", async (t) => {
|
test("Test name", async (t) => {
|
||||||
@ -25,14 +17,6 @@ test("Test name", async (t) => {
|
|||||||
|
|
||||||
## Run
|
## Run
|
||||||
|
|
||||||
Node.js >=18
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npm run test-backend:18
|
npm run test-backend
|
||||||
```
|
|
||||||
|
|
||||||
Node.js < 18
|
|
||||||
|
|
||||||
```bash
|
|
||||||
npm run test-backend:14
|
|
||||||
```
|
```
|
||||||
|
@ -1,13 +1,4 @@
|
|||||||
const semver = require("semver");
|
const test = require("node:test");
|
||||||
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 assert = require("node:assert");
|
const assert = require("node:assert");
|
||||||
const { UptimeCalculator } = require("../../server/uptime-calculator");
|
const { UptimeCalculator } = require("../../server/uptime-calculator");
|
||||||
const dayjs = require("dayjs");
|
const dayjs = require("dayjs");
|
||||||
|
Loading…
Reference in New Issue
Block a user