diff --git a/package.json b/package.json index 31e48fdf0b..6f8af36092 100644 --- a/package.json +++ b/package.json @@ -28,9 +28,9 @@ "check": "run-s check:*", "check:workspaces": "npm run check --workspaces --if-present", "check:ws": "[ $(ls -1 ./packages|wc -l) -eq $(cat package.json | jq '.workspaces | length') ] || exit 1 # check no packages left behind", - "test": "npm run test --workspaces --if-present", - "test:browser": "npm run test:browser --workspaces --if-present", - "test:node": "npm run test:node --workspaces --if-present", + "test": "NODE_ENV=test npm run test --workspaces --if-present", + "test:browser": "NODE_ENV=test npm run test:browser --workspaces --if-present", + "test:node": "NODE_ENV=test npm run test:node --workspaces --if-present", "proto": "npm run proto --workspaces --if-present", "deploy": "node ci/deploy.js", "doc": "run-s doc:*", diff --git a/packages/core/package.json b/packages/core/package.json index a3584e53c2..3ad4bbbaf2 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -60,9 +60,9 @@ "check:tsc": "tsc -p tsconfig.dev.json", "check:lint": "eslint src *.js", "check:spelling": "cspell \"{README.md,src/**/*.ts}\"", - "test": "run-s test:*", - "test:node": "TS_NODE_PROJECT=./tsconfig.dev.json mocha", - "test:browser": "karma start karma.conf.cjs", + "test": "NODE_ENV=test run-s test:*", + "test:node": "NODE_ENV=test TS_NODE_PROJECT=./tsconfig.dev.json mocha", + "test:browser": "NODE_ENV=test karma start karma.conf.cjs", "watch:build": "tsc -p tsconfig.json -w", "watch:test": "mocha --watch", "prepublish": "npm run build", diff --git a/packages/dns-discovery/package.json b/packages/dns-discovery/package.json index 1bbb4653d1..415e5e0447 100644 --- a/packages/dns-discovery/package.json +++ b/packages/dns-discovery/package.json @@ -43,9 +43,9 @@ "check:tsc": "tsc -p tsconfig.dev.json", "prepublish": "npm run build", "reset-hard": "git clean -dfx -e .idea && git reset --hard && npm i && npm run build", - "test": "run-s test:*", - "test:node": "TS_NODE_PROJECT=./tsconfig.dev.json mocha", - "test:browser": "karma start karma.conf.cjs" + "test": "NODE_ENV=test run-s test:*", + "test:node": "NODE_ENV=test TS_NODE_PROJECT=./tsconfig.dev.json mocha", + "test:browser": "NODE_ENV=test karma start karma.conf.cjs" }, "engines": { "node": ">=18" diff --git a/packages/enr/package.json b/packages/enr/package.json index ca3fe58ddd..a2eb199f77 100644 --- a/packages/enr/package.json +++ b/packages/enr/package.json @@ -41,9 +41,9 @@ "check:lint": "eslint src --ext .ts", "check:spelling": "cspell \"{README.md,src/**/*.ts}\"", "check:tsc": "tsc -p tsconfig.dev.json", - "test": "run-s test:*", - "test:node": "TS_NODE_PROJECT=./tsconfig.dev.json mocha", - "test:browser": "karma start karma.conf.cjs", + "test": "NODE_ENV=test run-s test:*", + "test:node": "NODE_ENV=test TS_NODE_PROJECT=./tsconfig.dev.json mocha", + "test:browser": "NODE_ENV=test karma start karma.conf.cjs", "prepublish": "npm run build", "reset-hard": "git clean -dfx -e .idea && git reset --hard && npm i && npm run build" }, diff --git a/packages/message-encryption/package.json b/packages/message-encryption/package.json index 11b16199ef..30ff2854b4 100644 --- a/packages/message-encryption/package.json +++ b/packages/message-encryption/package.json @@ -62,9 +62,9 @@ "check:lint": "eslint src *.js", "check:spelling": "cspell \"{README.md,src/**/*.ts}\"", "check:tsc": "tsc -p tsconfig.dev.json", - "test": "run-s test:*", - "test:node": "TS_NODE_PROJECT=./tsconfig.dev.json mocha", - "test:browser": "karma start karma.conf.cjs", + "test": "NODE_ENV=test run-s test:*", + "test:node": "NODE_ENV=test TS_NODE_PROJECT=./tsconfig.dev.json mocha", + "test:browser": "NODE_ENV=test karma start karma.conf.cjs", "prepublish": "npm run build", "reset-hard": "git clean -dfx -e .idea && git reset --hard && npm i && npm run build" }, diff --git a/packages/message-hash/package.json b/packages/message-hash/package.json index 9935cd7d19..615579212a 100644 --- a/packages/message-hash/package.json +++ b/packages/message-hash/package.json @@ -38,9 +38,9 @@ "check:tsc": "tsc -p tsconfig.dev.json", "check:lint": "eslint src *.js", "check:spelling": "cspell \"{README.md,src/**/*.ts}\"", - "test": "run-s test:*", - "test:node": "TS_NODE_PROJECT=./tsconfig.dev.json mocha", - "test:browser": "karma start karma.conf.cjs", + "test": "NODE_ENV=test run-s test:*", + "test:node": "NODE_ENV=test TS_NODE_PROJECT=./tsconfig.dev.json mocha", + "test:browser": "NODE_ENV=test karma start karma.conf.cjs", "watch:build": "tsc -p tsconfig.json -w", "watch:test": "mocha --watch", "prepublish": "npm run build", diff --git a/packages/relay/package.json b/packages/relay/package.json index b759bd07ca..e63c757678 100644 --- a/packages/relay/package.json +++ b/packages/relay/package.json @@ -38,7 +38,7 @@ "check:tsc": "tsc -p tsconfig.dev.json", "check:lint": "eslint src *.js", "check:spelling": "cspell \"{README.md,src/**/*.ts}\"", - "test": "run-s test:*", + "test": "NODE_ENV=test run-s test:*", "test:node": "TS_NODE_PROJECT=./tsconfig.dev.json mocha", "watch:build": "tsc -p tsconfig.json -w", "watch:test": "mocha --watch", diff --git a/packages/sdk/src/create.ts b/packages/sdk/src/create.ts index cb96f5947c..01d254f0ca 100644 --- a/packages/sdk/src/create.ts +++ b/packages/sdk/src/create.ts @@ -185,7 +185,8 @@ export async function defaultLibp2p( options?: Partial, userAgent?: string ): Promise { - if (!options?.hideWebSocketInfo) { + // Log the info log unless we are running tests or the user has disabled it + if (!options?.hideWebSocketInfo || process.env.NODE_ENV !== "test") { /* eslint-disable no-console */ console.info( "%cIgnore WebSocket connection failures", diff --git a/packages/tests/package.json b/packages/tests/package.json index 3dc489e704..bd802264ca 100644 --- a/packages/tests/package.json +++ b/packages/tests/package.json @@ -41,9 +41,9 @@ "check:lint": "eslint src tests", "check:spelling": "cspell \"{README.md,{tests,src}/**/*.ts}\"", "check:tsc": "tsc -p tsconfig.dev.json", - "test": "run-s test:*", - "test:node": "node ./src/run-tests.js \"tests/**/!(*.optional).spec.ts\"", - "test:optional": "node ./src/run-tests.js \"tests/**/@(*.optional).spec.ts\"", + "test": "NODE_ENV=test run-s test:*", + "test:node": "NODE_ENV=test node ./src/run-tests.js \"tests/**/!(*.optional).spec.ts\"", + "test:optional": "NODE_ENV=test node ./src/run-tests.js \"tests/**/@(*.optional).spec.ts\"", "reset-hard": "git clean -dfx -e .idea && git reset --hard && npm i && npm run build" }, "engines": { diff --git a/packages/tests/tests/create.optional.spec.ts b/packages/tests/tests/create.optional.spec.ts index dfa2309006..a09a01d16b 100644 --- a/packages/tests/tests/create.optional.spec.ts +++ b/packages/tests/tests/create.optional.spec.ts @@ -4,7 +4,7 @@ import sinon, { SinonSpy } from "sinon"; import { tearDownNodes } from "../src/index.js"; -describe("Craete node", () => { +describe("Create node", () => { let waku: LightNode; let consoleInfoSpy: SinonSpy; diff --git a/packages/utils/package.json b/packages/utils/package.json index 3af685e546..f820960ca4 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -60,8 +60,8 @@ "check:tsc": "tsc -p tsconfig.dev.json", "prepublish": "npm run build", "reset-hard": "git clean -dfx -e .idea && git reset --hard && npm i && npm run build", - "test": "run-s test:*", - "test:node": "TS_NODE_PROJECT=./tsconfig.dev.json mocha" + "test": "NODE_ENV=test run-s test:*", + "test:node": "NODE_ENV=test TS_NODE_PROJECT=./tsconfig.dev.json mocha" }, "engines": { "node": ">=18"