mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
Clarify rules for which files are run as Jest integration tests (#33869)
* Add RESERVED_DIR_JEST_INTEGRATION_TESTS to src/dev/constants to aid discoverability of which directory names are reserved. * Add negation rules so the Jest integration tests script ignores test files inside of __jest__/integration_tests dirs.
This commit is contained in:
parent
b21f048df9
commit
8d64071d7f
4 changed files with 15 additions and 5 deletions
|
@ -20,3 +20,7 @@
|
|||
import { dirname } from 'path';
|
||||
|
||||
export const REPO_ROOT = dirname(require.resolve('../../package.json'));
|
||||
|
||||
// FIles in directories of this name will be treated as Jest integration tests with instances of
|
||||
// Elasticsearch and the Kibana server.
|
||||
export const RESERVED_DIR_JEST_INTEGRATION_TESTS = 'integration_tests';
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { RESERVED_DIR_JEST_INTEGRATION_TESTS } from '../constants';
|
||||
|
||||
export default {
|
||||
rootDir: '../../..',
|
||||
roots: [
|
||||
|
@ -76,7 +78,7 @@ export default {
|
|||
testPathIgnorePatterns: [
|
||||
'<rootDir>/packages/kbn-ui-framework/(dist|doc_site|generator-kui)/',
|
||||
'<rootDir>/packages/kbn-pm/dist/',
|
||||
'integration_tests/'
|
||||
`${RESERVED_DIR_JEST_INTEGRATION_TESTS}/`,
|
||||
],
|
||||
transform: {
|
||||
'^.+\\.(js|tsx?)$': '<rootDir>/src/dev/jest/babel_transform.js',
|
||||
|
|
|
@ -4,16 +4,18 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { RESERVED_DIR_JEST_INTEGRATION_TESTS } from '../../../src/dev/constants';
|
||||
import config from './config';
|
||||
|
||||
export default {
|
||||
...config,
|
||||
testMatch: [
|
||||
'**/integration_tests/**/*.test.js',
|
||||
'**/integration_tests/**/*.test.ts',
|
||||
`**/${RESERVED_DIR_JEST_INTEGRATION_TESTS}/**/*.test.{js,ts,tsx}`,
|
||||
// Tests within `__jest__` directories should be treated as regular unit tests.
|
||||
`!**/__jest__/${RESERVED_DIR_JEST_INTEGRATION_TESTS}/**/*.test.{js,ts,tsx}`,
|
||||
],
|
||||
testPathIgnorePatterns: config.testPathIgnorePatterns.filter(
|
||||
(pattern) => !pattern.includes('integration_tests')
|
||||
(pattern) => !pattern.includes(RESERVED_DIR_JEST_INTEGRATION_TESTS)
|
||||
),
|
||||
reporters: [
|
||||
'default',
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { RESERVED_DIR_JEST_INTEGRATION_TESTS } from '../../../src/dev/constants';
|
||||
|
||||
export default {
|
||||
rootDir: '../../',
|
||||
roots: [
|
||||
|
@ -47,7 +49,7 @@ export default {
|
|||
testPathIgnorePatterns: [
|
||||
'<rootDir>/packages/kbn-ui-framework/(dist|doc_site|generator-kui)/',
|
||||
'<rootDir>/packages/kbn-pm/dist/',
|
||||
'integration_tests/'
|
||||
`${RESERVED_DIR_JEST_INTEGRATION_TESTS}/`,
|
||||
],
|
||||
transform: {
|
||||
'^.+\\.(js|tsx?)$': '<rootDir>/../src/dev/jest/babel_transform.js',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue