mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-19 20:06:00 +00:00
test log messages
This commit is contained in:
3
integration-tests/jest.config.js
Normal file
3
integration-tests/jest.config.js
Normal file
@@ -0,0 +1,3 @@
|
||||
module.exports = {
|
||||
setupFilesAfterEnv: ['<rootDir>/setupTests.js'],
|
||||
};
|
||||
@@ -11,12 +11,9 @@
|
||||
"scripts": {
|
||||
"wait:local": "cross-env DEVMODE=1 LOCALTEST=1 node wait.js",
|
||||
"wait:ci": "cross-env DEVMODE=1 CITEST=1 node wait.js",
|
||||
|
||||
"test:local": "cross-env DEVMODE=1 LOCALTEST=1 jest",
|
||||
"test:local:path": "cross-env DEVMODE=1 LOCALTEST=1 jest --runTestsByPath __tests__/data-duplicator.spec.js",
|
||||
|
||||
"test:ci": "cross-env DEVMODE=1 CITEST=1 jest --runInBand --json --outputFile=result.json --testLocationInResults",
|
||||
|
||||
"run:local": "docker-compose down && docker-compose up -d && yarn wait:local && yarn test:local"
|
||||
},
|
||||
"jest": {
|
||||
@@ -24,7 +21,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"cross-env": "^7.0.3",
|
||||
"jest": "^27.0.1"
|
||||
},
|
||||
"dependencies": {}
|
||||
"jest": "^27.0.1",
|
||||
"pino-pretty": "^11.2.2"
|
||||
}
|
||||
}
|
||||
|
||||
22
integration-tests/setupTests.js
Normal file
22
integration-tests/setupTests.js
Normal file
@@ -0,0 +1,22 @@
|
||||
const { prettyFactory } = require('pino-pretty');
|
||||
|
||||
const pretty = prettyFactory({
|
||||
colorize: true,
|
||||
translateTime: 'SYS:standard',
|
||||
ignore: 'pid,hostname',
|
||||
});
|
||||
|
||||
global.console = {
|
||||
...console,
|
||||
log: (...messages) => {
|
||||
try {
|
||||
const parsedMessage = JSON.parse(messages[0]);
|
||||
process.stdout.write(pretty(parsedMessage) + '\n');
|
||||
} catch (error) {
|
||||
process.stdout.write(messages.join(' ') + '\n');
|
||||
}
|
||||
},
|
||||
debug: (...messages) => {
|
||||
process.stdout.write(messages.join(' ') + '\n');
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user