diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index eec1232..c17d008 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,7 +16,7 @@ jobs: - name: Set up Node.js uses: actions/setup-node@v2 with: - node-version: '20.19.0' + node-version: "22.5.1" - name: Install dependencies run: npm install @@ -34,7 +34,7 @@ jobs: - name: Set up Node.js uses: actions/setup-node@v2 with: - node-version: '20.19.0' + node-version: "22.5.1" - name: Install dependencies run: npm install @@ -52,7 +52,7 @@ jobs: - name: Set up Node.js uses: actions/setup-node@v2 with: - node-version: '20.19.0' + node-version: "22.5.1" - name: Cache node_modules uses: actions/cache@v3 diff --git a/.nvmrc b/.nvmrc index 12cc0c9..2bd5a0a 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -v20.19 +22 diff --git a/package.json b/package.json index f0b11ed..cfc1679 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "cli": "npx tsx src/index.ts", "test:system": "npm run mocha 'test/**/*.test.ts'", "test": "npm run lint && npm run test:system", - "mocha": "mocha --config=test/.mocharc.json --node-env=test --exit" + "mocha": "NODE_OPTIONS='--experimental-require-module' mocha --config=test/.mocharc.json --node-env=test --exit" }, "author": "Ocean Protocol ", "license": "Apache-2.0", diff --git a/test/.mocharc.json b/test/.mocharc.json index 2e6df29..644e6e7 100644 --- a/test/.mocharc.json +++ b/test/.mocharc.json @@ -1,8 +1,7 @@ { - "require": ["ts-node/register"], "loader": "ts-node/esm", "full-trace": true, "bail": true, "exit": true, "timeout": "20000" -} +} \ No newline at end of file diff --git a/test/http.test.ts b/test/http.test.ts index b128a43..3ae8b44 100644 --- a/test/http.test.ts +++ b/test/http.test.ts @@ -1,4 +1,3 @@ -import 'ts-node/register'; import fetch from 'cross-fetch'; import { expect, assert } from 'chai'; @@ -16,7 +15,7 @@ describe('Ocean Node Root Endpoint', () => { // You can also check the values of the properties expect(responseBody.software).to.equal('Ocean-Node'); - + // Check if version is "0.0.1" or greater const [major, minor, patch] = responseBody.version.split('.').map(Number); expect(major).to.be.at.least(0); @@ -41,7 +40,7 @@ describe('Direct Command Endpoint', () => { body: JSON.stringify({ command: 'status' }) }); const responseBody = await response.json(); - + expect(response.status).to.equal(200); expect(responseBody).to.have.property('id'); expect(responseBody).to.have.property('publicKey'); @@ -56,7 +55,7 @@ describe('Direct Command Endpoint', () => { expect(responseBody).to.have.property('platform'); expect(responseBody).to.have.property('codeHash'); expect(responseBody).to.have.property('allowedAdmins'); - + // Check the values of some of the properties expect(responseBody.http).to.be.true; expect(responseBody.p2p).to.be.true; @@ -85,7 +84,7 @@ describe('Direct Command Endpoint', () => { } }); const responseBody = await response.text(); - + expect(response.status).to.equal(400); assert(responseBody === "Missing signature") });