Skip to content

Commit c81872a

Browse files
supress info log for tests (#1763)
1 parent 9983549 commit c81872a

File tree

11 files changed

+27
-26
lines changed

11 files changed

+27
-26
lines changed

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@
2828
"check": "run-s check:*",
2929
"check:workspaces": "npm run check --workspaces --if-present",
3030
"check:ws": "[ $(ls -1 ./packages|wc -l) -eq $(cat package.json | jq '.workspaces | length') ] || exit 1 # check no packages left behind",
31-
"test": "npm run test --workspaces --if-present",
32-
"test:browser": "npm run test:browser --workspaces --if-present",
33-
"test:node": "npm run test:node --workspaces --if-present",
31+
"test": "NODE_ENV=test npm run test --workspaces --if-present",
32+
"test:browser": "NODE_ENV=test npm run test:browser --workspaces --if-present",
33+
"test:node": "NODE_ENV=test npm run test:node --workspaces --if-present",
3434
"proto": "npm run proto --workspaces --if-present",
3535
"deploy": "node ci/deploy.js",
3636
"doc": "run-s doc:*",

packages/core/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@
6060
"check:tsc": "tsc -p tsconfig.dev.json",
6161
"check:lint": "eslint src *.js",
6262
"check:spelling": "cspell \"{README.md,src/**/*.ts}\"",
63-
"test": "run-s test:*",
64-
"test:node": "TS_NODE_PROJECT=./tsconfig.dev.json mocha",
65-
"test:browser": "karma start karma.conf.cjs",
63+
"test": "NODE_ENV=test run-s test:*",
64+
"test:node": "NODE_ENV=test TS_NODE_PROJECT=./tsconfig.dev.json mocha",
65+
"test:browser": "NODE_ENV=test karma start karma.conf.cjs",
6666
"watch:build": "tsc -p tsconfig.json -w",
6767
"watch:test": "mocha --watch",
6868
"prepublish": "npm run build",

packages/dns-discovery/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@
4343
"check:tsc": "tsc -p tsconfig.dev.json",
4444
"prepublish": "npm run build",
4545
"reset-hard": "git clean -dfx -e .idea && git reset --hard && npm i && npm run build",
46-
"test": "run-s test:*",
47-
"test:node": "TS_NODE_PROJECT=./tsconfig.dev.json mocha",
48-
"test:browser": "karma start karma.conf.cjs"
46+
"test": "NODE_ENV=test run-s test:*",
47+
"test:node": "NODE_ENV=test TS_NODE_PROJECT=./tsconfig.dev.json mocha",
48+
"test:browser": "NODE_ENV=test karma start karma.conf.cjs"
4949
},
5050
"engines": {
5151
"node": ">=18"

packages/enr/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@
4141
"check:lint": "eslint src --ext .ts",
4242
"check:spelling": "cspell \"{README.md,src/**/*.ts}\"",
4343
"check:tsc": "tsc -p tsconfig.dev.json",
44-
"test": "run-s test:*",
45-
"test:node": "TS_NODE_PROJECT=./tsconfig.dev.json mocha",
46-
"test:browser": "karma start karma.conf.cjs",
44+
"test": "NODE_ENV=test run-s test:*",
45+
"test:node": "NODE_ENV=test TS_NODE_PROJECT=./tsconfig.dev.json mocha",
46+
"test:browser": "NODE_ENV=test karma start karma.conf.cjs",
4747
"prepublish": "npm run build",
4848
"reset-hard": "git clean -dfx -e .idea && git reset --hard && npm i && npm run build"
4949
},

packages/message-encryption/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@
6262
"check:lint": "eslint src *.js",
6363
"check:spelling": "cspell \"{README.md,src/**/*.ts}\"",
6464
"check:tsc": "tsc -p tsconfig.dev.json",
65-
"test": "run-s test:*",
66-
"test:node": "TS_NODE_PROJECT=./tsconfig.dev.json mocha",
67-
"test:browser": "karma start karma.conf.cjs",
65+
"test": "NODE_ENV=test run-s test:*",
66+
"test:node": "NODE_ENV=test TS_NODE_PROJECT=./tsconfig.dev.json mocha",
67+
"test:browser": "NODE_ENV=test karma start karma.conf.cjs",
6868
"prepublish": "npm run build",
6969
"reset-hard": "git clean -dfx -e .idea && git reset --hard && npm i && npm run build"
7070
},

packages/message-hash/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@
3838
"check:tsc": "tsc -p tsconfig.dev.json",
3939
"check:lint": "eslint src *.js",
4040
"check:spelling": "cspell \"{README.md,src/**/*.ts}\"",
41-
"test": "run-s test:*",
42-
"test:node": "TS_NODE_PROJECT=./tsconfig.dev.json mocha",
43-
"test:browser": "karma start karma.conf.cjs",
41+
"test": "NODE_ENV=test run-s test:*",
42+
"test:node": "NODE_ENV=test TS_NODE_PROJECT=./tsconfig.dev.json mocha",
43+
"test:browser": "NODE_ENV=test karma start karma.conf.cjs",
4444
"watch:build": "tsc -p tsconfig.json -w",
4545
"watch:test": "mocha --watch",
4646
"prepublish": "npm run build",

packages/relay/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"check:tsc": "tsc -p tsconfig.dev.json",
3939
"check:lint": "eslint src *.js",
4040
"check:spelling": "cspell \"{README.md,src/**/*.ts}\"",
41-
"test": "run-s test:*",
41+
"test": "NODE_ENV=test run-s test:*",
4242
"test:node": "TS_NODE_PROJECT=./tsconfig.dev.json mocha",
4343
"watch:build": "tsc -p tsconfig.json -w",
4444
"watch:test": "mocha --watch",

packages/sdk/src/create.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,8 @@ export async function defaultLibp2p(
185185
options?: Partial<CreateLibp2pOptions>,
186186
userAgent?: string
187187
): Promise<Libp2p> {
188-
if (!options?.hideWebSocketInfo) {
188+
// Log the info log unless we are running tests or the user has disabled it
189+
if (!options?.hideWebSocketInfo || process.env.NODE_ENV !== "test") {
189190
/* eslint-disable no-console */
190191
console.info(
191192
"%cIgnore WebSocket connection failures",

packages/tests/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@
4141
"check:lint": "eslint src tests",
4242
"check:spelling": "cspell \"{README.md,{tests,src}/**/*.ts}\"",
4343
"check:tsc": "tsc -p tsconfig.dev.json",
44-
"test": "run-s test:*",
45-
"test:node": "node ./src/run-tests.js \"tests/**/!(*.optional).spec.ts\"",
46-
"test:optional": "node ./src/run-tests.js \"tests/**/@(*.optional).spec.ts\"",
44+
"test": "NODE_ENV=test run-s test:*",
45+
"test:node": "NODE_ENV=test node ./src/run-tests.js \"tests/**/!(*.optional).spec.ts\"",
46+
"test:optional": "NODE_ENV=test node ./src/run-tests.js \"tests/**/@(*.optional).spec.ts\"",
4747
"reset-hard": "git clean -dfx -e .idea && git reset --hard && npm i && npm run build"
4848
},
4949
"engines": {

packages/tests/tests/create.optional.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import sinon, { SinonSpy } from "sinon";
44

55
import { tearDownNodes } from "../src/index.js";
66

7-
describe("Craete node", () => {
7+
describe("Create node", () => {
88
let waku: LightNode;
99
let consoleInfoSpy: SinonSpy;
1010

packages/utils/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@
6060
"check:tsc": "tsc -p tsconfig.dev.json",
6161
"prepublish": "npm run build",
6262
"reset-hard": "git clean -dfx -e .idea && git reset --hard && npm i && npm run build",
63-
"test": "run-s test:*",
64-
"test:node": "TS_NODE_PROJECT=./tsconfig.dev.json mocha"
63+
"test": "NODE_ENV=test run-s test:*",
64+
"test:node": "NODE_ENV=test TS_NODE_PROJECT=./tsconfig.dev.json mocha"
6565
},
6666
"engines": {
6767
"node": ">=18"

0 commit comments

Comments
 (0)