Skip to content

Commit

Permalink
improve
Browse files Browse the repository at this point in the history
  • Loading branch information
Dosant committed Mar 6, 2020
1 parent eb4bf0b commit a355dd5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
9 changes: 0 additions & 9 deletions src/dev/jest/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,6 @@ export default {
'<rootDir>/src/dev/jest/setup/babel_polyfill.js',
'<rootDir>/src/dev/jest/setup/polyfills.js',
'<rootDir>/src/dev/jest/setup/enzyme.js',

/*
FIXME: some unit tests in src/ are either running jsdom manipulations after `afterEach` code,
by default react-testing-library cleans up DOM after each test to keep unit tests in isolation,
we need to fix those tests in `src/` which are manipulating DOM after tests has finished and failing
if RTL attempts to clean up jsdom
https://github.com/elastic/kibana/issues/59469
*/
'@testing-library/react/dont-cleanup-after-each',
],
setupFilesAfterEnv: [
'<rootDir>/src/dev/jest/setup/mocks.js',
Expand Down
10 changes: 9 additions & 1 deletion src/dev/jest/setup/react_testing_library.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,15 @@
*/

import '@testing-library/jest-dom/extend-expect';
import { configure } from '@testing-library/react';
/**
* Have to import "/pure" here to not register afterEach() hook clean up
* in the very beginning. There are couple tests which fail with clean up hook.
* On CI they run before first test which imports '@testing-library/react'
* and registers afterEach hook so the whole suite is passing.
* This have to be fixed as we depend on test order execution
* https://github.com/elastic/kibana/issues/59469
*/
import { configure } from '@testing-library/react/pure';

// instead of default 'data-testid', use kibana's 'data-test-subj'
configure({ testIdAttribute: 'data-test-subj' });

0 comments on commit a355dd5

Please sign in to comment.