mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
[jest/ci] disable console methods (#146910)
Removes all the noise from poorly written React tests and includes a warning to explain the situation to folks Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
877d775a76
commit
c107f8a73a
3 changed files with 23 additions and 1 deletions
|
@ -26,6 +26,13 @@ echo "--- downloading jest test run order"
|
|||
download_artifact jest_run_order.json .
|
||||
configs=$(jq -r 'getpath([env.TEST_TYPE]) | .groups[env.JOB | tonumber].names | .[]' jest_run_order.json)
|
||||
|
||||
echo "+++ ⚠️ WARNING ⚠️"
|
||||
echo "
|
||||
console.log(), console.warn(), and console.error() output in jest tests causes a massive amount
|
||||
of noise on CI without any percevable benefit, so they have been disabled. If you want to log
|
||||
output in your test temporarily, you can modify 'packages/kbn-test/src/jest/setup/disable_console_logs.js'
|
||||
"
|
||||
|
||||
while read -r config; do
|
||||
echo "--- $ node scripts/jest --config $config"
|
||||
|
||||
|
|
|
@ -91,7 +91,10 @@ module.exports = {
|
|||
'<rootDir>/node_modules/@kbn/test/target_node/src/jest/setup/mocks.moment_timezone.js',
|
||||
'<rootDir>/node_modules/@kbn/test/target_node/src/jest/setup/mocks.eui.js',
|
||||
'<rootDir>/node_modules/@kbn/test/target_node/src/jest/setup/react_testing_library.js',
|
||||
],
|
||||
process.env.CI
|
||||
? '<rootDir>/node_modules/@kbn/test/target_node/src/jest/setup/disable_console_logs.js'
|
||||
: [],
|
||||
].flat(),
|
||||
|
||||
snapshotFormat: {
|
||||
escapeString: true,
|
||||
|
|
12
packages/kbn-test/src/jest/setup/disable_console_logs.js
Normal file
12
packages/kbn-test/src/jest/setup/disable_console_logs.js
Normal file
|
@ -0,0 +1,12 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
||||
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
||||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
// on CI these logs just muddy up the console and produce a ton of unnecessary noise
|
||||
console.log = () => {};
|
||||
console.error = () => {};
|
||||
console.warn = () => {};
|
Loading…
Add table
Add a link
Reference in a new issue