supress info log for tests (#1763)

This commit is contained in:
Danish Arora 2024-01-02 16:30:18 +05:30 committed by GitHub
parent 9983549e8b
commit c81872ae0e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 27 additions and 26 deletions

View File

@ -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:*",

View File

@ -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",

View File

@ -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"

View File

@ -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"
},

View File

@ -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"
},

View File

@ -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",

View File

@ -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",

View File

@ -185,7 +185,8 @@ export async function defaultLibp2p(
options?: Partial<CreateLibp2pOptions>,
userAgent?: string
): Promise<Libp2p> {
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",

View File

@ -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": {

View File

@ -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;

View File

@ -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"