From 0a5c022b6c4972e95141940993936970899a9dc8 Mon Sep 17 00:00:00 2001 From: Brian Seeders Date: Wed, 22 Sep 2021 00:29:46 -0400 Subject: [PATCH] chore(NA): introduce preset for jest-integration tests on @kbn/test (#105144) (#112769) * chore(NA): introduce preset for jest-integration tests on @kbn/test * chore(NA): fix lockfile * chore(NA): fix ci * fix tests (#14) Co-authored-by: Mikhail Shustov Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Tiago Costa Co-authored-by: Mikhail Shustov Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- jest.config.integration.js | 18 +----------- packages/kbn-test/BUILD.bazel | 1 + .../kbn-test/jest_integration/jest-preset.js | 28 +++++++++++++++++++ src/dev/precommit_hook/casing_check_config.js | 1 + 4 files changed, 31 insertions(+), 17 deletions(-) create mode 100644 packages/kbn-test/jest_integration/jest-preset.js diff --git a/jest.config.integration.js b/jest.config.integration.js index 8ff142714eebf..e2b2afaa715ee 100644 --- a/jest.config.integration.js +++ b/jest.config.integration.js @@ -6,24 +6,8 @@ * Side Public License, v 1. */ -const preset = require('@kbn/test/jest-preset'); - module.exports = { - preset: '@kbn/test', + preset: '@kbn/test/jest_integration', rootDir: '.', roots: ['/src', '/packages'], - testMatch: ['**/integration_tests**/*.test.{js,mjs,ts,tsx}'], - testPathIgnorePatterns: preset.testPathIgnorePatterns.filter( - (pattern) => !pattern.includes('integration_tests') - ), - setupFilesAfterEnv: [ - '/node_modules/@kbn/test/target_node/jest/setup/after_env.integration.js', - ], - reporters: [ - 'default', - ['@kbn/test/target_node/jest/junit_reporter', { reportName: 'Jest Integration Tests' }], - ], - coverageReporters: !!process.env.CI - ? [['json', { file: 'jest-integration.json' }]] - : ['html', 'text'], }; diff --git a/packages/kbn-test/BUILD.bazel b/packages/kbn-test/BUILD.bazel index 2bb5c17af10d0..c4f3d0d1604e5 100644 --- a/packages/kbn-test/BUILD.bazel +++ b/packages/kbn-test/BUILD.bazel @@ -29,6 +29,7 @@ filegroup( NPM_MODULE_EXTRA_FILES = [ "jest/package.json", "jest-preset.js", + "jest_integration/jest-preset.js", "jest.config.js", "README.md", "package.json", diff --git a/packages/kbn-test/jest_integration/jest-preset.js b/packages/kbn-test/jest_integration/jest-preset.js new file mode 100644 index 0000000000000..7504dec9e7a20 --- /dev/null +++ b/packages/kbn-test/jest_integration/jest-preset.js @@ -0,0 +1,28 @@ +/* + * 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. + */ + +const preset = require('../jest-preset'); + +module.exports = { + ...preset, + testMatch: ['**/integration_tests**/*.test.{js,mjs,ts,tsx}'], + testPathIgnorePatterns: preset.testPathIgnorePatterns.filter( + (pattern) => !pattern.includes('integration_tests') + ), + setupFilesAfterEnv: [ + '/node_modules/@kbn/test/target_node/jest/setup/after_env.integration.js', + '/node_modules/@kbn/test/target_node/jest/setup/mocks.js', + ], + reporters: [ + 'default', + ['@kbn/test/target_node/jest/junit_reporter', { reportName: 'Jest Integration Tests' }], + ], + coverageReporters: !!process.env.CI + ? [['json', { file: 'jest-integration.json' }]] + : ['html', 'text'], +}; diff --git a/src/dev/precommit_hook/casing_check_config.js b/src/dev/precommit_hook/casing_check_config.js index ca375fbb1ba1b..a2f63da9fbbac 100644 --- a/src/dev/precommit_hook/casing_check_config.js +++ b/src/dev/precommit_hook/casing_check_config.js @@ -39,6 +39,7 @@ export const IGNORE_FILE_GLOBS = [ 'vars/*', '.ci/pipeline-library/**/*', 'packages/kbn-test/jest-preset.js', + 'packages/kbn-test/jest_integration/jest-preset.js', 'test/package/Vagrantfile', '**/test/**/fixtures/**/*',