Skip to content

Commit 5355eb2

Browse files
committed
Fix agency logging opt-in when running tests
Signed-off-by: Patrik Stas <[email protected]>
1 parent 037fcd6 commit 5355eb2

20 files changed

+67
-9
lines changed

vcxagency-node/package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,12 @@
2121
"test:perf:generatedata": "node ./test/perf/storage/generate-dataset.js",
2222
"test:perf": "jest --runInBand ./test/perf/storage/pgstorage.perf.spec.js",
2323
"test:unit": "SILENT_WINSTON=true jest --runInBand ./test/unit",
24-
"test:unit:storage": "SILENT_WINSTON=true jest --runInBand ./test/unit/storage/",
25-
"test:unit:messaging": "SILENT_WINSTON=true jest --runInBand ./test/unit/messaging/aries-msgs.spec.js",
24+
"test:unit:configuration": "SILENT_WINSTON=true jest --runInBand ./test/unit/configuration",
2625
"test:unit:entities": "SILENT_WINSTON=true jest --runInBand ./test/unit/entities",
27-
"test:unit:configuration": "SILENT_WINSTON=true jest --runInBand ./test/unit/configuration"
26+
"test:unit:messaging": "SILENT_WINSTON=true jest --runInBand ./test/unit/messaging",
27+
"test:unit:notifications": "SILENT_WINSTON=true jest --runInBand ./test/unit/notifications",
28+
"test:unit:state": "SILENT_WINSTON=true jest --runInBand ./test/unit/state",
29+
"test:unit:storage": "SILENT_WINSTON=true jest --runInBand ./test/unit/storage/"
2830
},
2931
"devDependencies": {
3032
"@types/jest": "^25.2.2",

vcxagency-node/src/logging/logger-builder.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ function addChildLogger (mainLoggerName, fullPath) {
5656

5757
const mainLoggerName = 'main'
5858

59+
console.warn(`"BUILDING APP LOGGER...global.LOG_LEVEL=${global.LOG_LEVEL} process.env.SILENT_WINSTON === 'true'`)
5960
const formatter = global.LOG_JSON_TO_CONSOLE ? jsonFormatter : prettyFormatter
6061
const logLevel = global.LOG_LEVEL
6162
createConsoleLogger(mainLoggerName, formatter, logLevel, process.env.SILENT_WINSTON === 'true')

vcxagency-node/test/unit/entities/agent-connection/agent-connection.spec.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
*/
1616

1717
'use strict'
18+
global.LOG_LEVEL = process.env.LOG_LEVEL || 'info'
19+
global.LOG_JSON_TO_CONSOLE = process.env.LOG_JSON_TO_CONSOLE === 'true'
20+
global.SILENT_WINSTON = process.env.SILENT_WINSTON === 'false'
1821

1922
/* eslint-env jest */
2023
const { indyCreateWallet } = require('easy-indysdk')

vcxagency-node/test/unit/entities/agent/agent-internal.spec.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
*/
1616

1717
'use strict'
18+
global.LOG_LEVEL = process.env.LOG_LEVEL || 'info'
19+
global.LOG_JSON_TO_CONSOLE = process.env.LOG_JSON_TO_CONSOLE === 'true'
20+
global.SILENT_WINSTON = process.env.SILENT_WINSTON === 'false'
1821

1922
/* eslint-env jest */
2023
const { indyCreateWallet } = require('easy-indysdk')

vcxagency-node/test/unit/entities/agent/agent.spec.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
*/
1616

1717
'use strict'
18+
global.LOG_LEVEL = process.env.LOG_LEVEL || 'info'
19+
global.LOG_JSON_TO_CONSOLE = process.env.LOG_JSON_TO_CONSOLE === 'true'
20+
global.SILENT_WINSTON = process.env.SILENT_WINSTON === 'false'
1821

1922
/* eslint-env jest */
2023
const { indyCreateWallet } = require('easy-indysdk')

vcxagency-node/test/unit/entities/common.spec.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
*/
1616

1717
'use strict'
18+
global.LOG_LEVEL = process.env.LOG_LEVEL || 'info'
19+
global.LOG_JSON_TO_CONSOLE = process.env.LOG_JSON_TO_CONSOLE === 'true'
20+
global.SILENT_WINSTON = process.env.SILENT_WINSTON === 'false'
1821

1922
/* eslint-env jest */
2023
const { indyCreateWallet } = require('easy-indysdk')

vcxagency-node/test/unit/messaging/aconn-msgs.spec.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717
'use strict'
1818

1919
/* eslint-env jest */
20+
global.LOG_LEVEL = process.env.LOG_LEVEL || 'info'
21+
global.LOG_JSON_TO_CONSOLE = process.env.LOG_JSON_TO_CONSOLE === 'true'
22+
global.SILENT_WINSTON = process.env.SILENT_WINSTON === 'false'
23+
2024
const {
2125
vcxFlowGetMsgsFromAgentConn,
2226
vcxFlowCreateAgentConnection,
@@ -73,7 +77,7 @@ function regenerateUuids () {
7377
beforeAll(async () => {
7478
try {
7579
jest.setTimeout(1000 * 120)
76-
if (process.env.ENABLE_VCX_LOGS) {
80+
if (process.env.ENABLE_VCX_LOGS === 'true') {
7781
setupVcxLogging()
7882
}
7983
const suiteId = `${uuid.v4()}`.replace(/-/gi, '').substring(0, 6)
@@ -82,7 +86,6 @@ beforeAll(async () => {
8286

8387
const appConfig = getBaseAppConfig(agencyWalletName, agencyDid, agencySeed, agencyWalletKey, undefined, tmpDbWallet.info.database, tmpDbData.info.database)
8488
app = await buildApplication(appConfig)
85-
8689
serviceIndyWallets = app.serviceIndyWallets
8790
entityForwardAgent = app.entityForwardAgent
8891
serviceStorage = app.serviceStorage

vcxagency-node/test/unit/messaging/agent-msgs.spec.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
'use strict'
1818

1919
/* eslint-env jest */
20+
global.LOG_LEVEL = process.env.LOG_LEVEL || 'info'
21+
global.LOG_JSON_TO_CONSOLE = process.env.LOG_JSON_TO_CONSOLE === 'true'
22+
global.SILENT_WINSTON = process.env.SILENT_WINSTON === 'false'
2023

2124
const {
2225
indyCreateWallet,
@@ -89,7 +92,7 @@ function regenerateUuids () {
8992
beforeAll(async () => {
9093
try {
9194
jest.setTimeout(1000 * 120)
92-
if (process.env.ENABLE_VCX_LOGS) {
95+
if (process.env.ENABLE_VCX_LOGS === 'true') {
9396
setupVcxLogging()
9497
}
9598
const suiteId = `${uuid.v4()}`.replace(/-/gi, '').substring(0, 6)

vcxagency-node/test/unit/messaging/aries-msgs.spec.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717
'use strict'
1818

1919
/* eslint-env jest */
20+
global.LOG_LEVEL = process.env.LOG_LEVEL || 'info'
21+
global.LOG_JSON_TO_CONSOLE = process.env.LOG_JSON_TO_CONSOLE === 'true'
22+
global.SILENT_WINSTON = process.env.SILENT_WINSTON === 'false'
23+
2024
const {
2125
vcxFlowSendAriesMessage,
2226
vcxFlowGetMsgsFromAgentConn,
@@ -80,7 +84,7 @@ let tmpDbWallet
8084
beforeAll(async () => {
8185
try {
8286
jest.setTimeout(1000 * 120)
83-
if (process.env.ENABLE_VCX_LOGS) {
87+
if (process.env.ENABLE_VCX_LOGS === 'true') {
8488
setupVcxLogging()
8589
}
8690
const suiteId = `${uuid.v4()}`.replace(/-/gi, '').substring(0, 6)

vcxagency-node/test/unit/messaging/common.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
*/
1616

1717
'use strict'
18+
global.LOG_LEVEL = process.env.LOG_LEVEL || 'info'
19+
global.LOG_JSON_TO_CONSOLE = process.env.LOG_JSON_TO_CONSOLE === 'true'
20+
global.SILENT_WINSTON = process.env.SILENT_WINSTON === 'false'
1821

1922
const { anonCrypt, indyOpenWallet, indyCreateWallet } = require('easy-indysdk')
2023
const uuid = require('uuid')
@@ -69,7 +72,7 @@ function getBaseAppConfig (agencyWalletName, agencyDid, agencySeed, agencyWallet
6972
AGENCY_WALLET_KEY_SECRET: agencyWalletKey,
7073

7174
LOG_ENABLE_INDYSDK: false,
72-
LOG_LEVEL: 'trace',
75+
LOG_LEVEL: 'debug',
7376

7477
REDIS_URL: redisUrl,
7578
AGENCY_TYPE: redisUrl ? 'client' : 'enterprise',

0 commit comments

Comments
 (0)