Skip to content

Commit

Permalink
[APM] Prevent console.error causing unit tests to fail locally (elast…
Browse files Browse the repository at this point in the history
…ic#161959)

elastic#161636 fixed a couple of unit
tests that were failing locally but passing on CI. This PR should
prevent this from happening again.

**Why they failed locally and not on CI??**
Locally `console.error` is treated as a test failure:

https://github.com/elastic/kibana/blob/7ea0dd6b116a93024d68ea2d93fa4ce90e9bf189/x-pack/plugins/apm/jest_setup.js#L12-L15

Whereas on CI `console.*` is disabled:

https://github.com/elastic/kibana/blob/a78c7b02b3b825826f39289e91e545ee6f4a67d9/packages/kbn-test/src/jest/setup/disable_console_logs.js#L9-L12

This means that if a test logs `console.error` it would fail locally but
not on CI. This PR changes that so console.error will not cause unit
tests to fail anywhere.
  • Loading branch information
sorenlouv authored Jul 18, 2023
1 parent fae89ff commit c842479
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 19 deletions.
5 changes: 1 addition & 4 deletions x-pack/plugins/apm/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@ module.exports = {
preset: '@kbn/test',
rootDir: path.resolve(__dirname, '../../..'),
roots: ['<rootDir>/x-pack/plugins/apm'],
setupFiles: [
'<rootDir>/x-pack/plugins/apm/jest_setup.js',
'<rootDir>/x-pack/plugins/apm/.storybook/jest_setup.js',
],
setupFiles: ['<rootDir>/x-pack/plugins/apm/.storybook/jest_setup.js'],
coverageDirectory: '<rootDir>/target/kibana-coverage/jest/x-pack/plugins/apm',
coverageReporters: ['text', 'html'],
collectCoverageFrom: [
Expand Down
15 changes: 0 additions & 15 deletions x-pack/plugins/apm/jest_setup.js

This file was deleted.

0 comments on commit c842479

Please sign in to comment.