From 0babaff1e2ae08cb06daf2f9055f67dda9e00ddc Mon Sep 17 00:00:00 2001 From: giurgiur99 Date: Thu, 18 Dec 2025 10:21:29 +0200 Subject: [PATCH 1/4] try bundler --- .github/workflows/ci.yml | 6 +++--- .nvmrc | 2 +- tsconfig.json | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) 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/tsconfig.json b/tsconfig.json index 1f67dae..1bf2cd5 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { "resolveJsonModule": true, - "moduleResolution": "node", + "moduleResolution": "bundler", "esModuleInterop": true, "allowSyntheticDefaultImports": true, "lib": ["ESNext", "dom"], From 80aa5413b5abea8e7ca879d3c643deec586454b8 Mon Sep 17 00:00:00 2001 From: giurgiur99 Date: Thu, 18 Dec 2025 10:27:56 +0200 Subject: [PATCH 2/4] remove ts-node register --- test/.mocharc.json | 3 +-- test/http.test.ts | 9 ++++----- 2 files changed, 5 insertions(+), 7 deletions(-) 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") }); From 943ae40983b0b6fe889744036f8d5dd9d30ebccb Mon Sep 17 00:00:00 2001 From: giurgiur99 Date: Thu, 18 Dec 2025 10:30:48 +0200 Subject: [PATCH 3/4] Revert "remove ts-node register" This reverts commit 80aa5413b5abea8e7ca879d3c643deec586454b8. --- test/.mocharc.json | 3 ++- test/http.test.ts | 9 +++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/test/.mocharc.json b/test/.mocharc.json index 644e6e7..2e6df29 100644 --- a/test/.mocharc.json +++ b/test/.mocharc.json @@ -1,7 +1,8 @@ { + "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 3ae8b44..b128a43 100644 --- a/test/http.test.ts +++ b/test/http.test.ts @@ -1,3 +1,4 @@ +import 'ts-node/register'; import fetch from 'cross-fetch'; import { expect, assert } from 'chai'; @@ -15,7 +16,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); @@ -40,7 +41,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'); @@ -55,7 +56,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; @@ -84,7 +85,7 @@ describe('Direct Command Endpoint', () => { } }); const responseBody = await response.text(); - + expect(response.status).to.equal(400); assert(responseBody === "Missing signature") }); From f99b19acddd5f778838da973131762741281dc01 Mon Sep 17 00:00:00 2001 From: giurgiur99 Date: Thu, 18 Dec 2025 10:34:25 +0200 Subject: [PATCH 4/4] use experimental require --- package.json | 2 +- test/.mocharc.json | 3 +-- test/http.test.ts | 9 ++++----- tsconfig.json | 2 +- 4 files changed, 7 insertions(+), 9 deletions(-) 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") }); diff --git a/tsconfig.json b/tsconfig.json index 1bf2cd5..1f67dae 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { "resolveJsonModule": true, - "moduleResolution": "bundler", + "moduleResolution": "node", "esModuleInterop": true, "allowSyntheticDefaultImports": true, "lib": ["ESNext", "dom"],