Skip to content

Commit

Permalink
chore(NA): introduce preset for jest-integration tests on @kbn/test (e…
Browse files Browse the repository at this point in the history
…lastic#105144)

* 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 <restrry@gmail.com>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
  • Loading branch information
3 people authored and brianseeders committed Sep 22, 2021
1 parent fbb661e commit a0e9e85
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 17 deletions.
18 changes: 1 addition & 17 deletions jest.config.integration.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: ['<rootDir>/src', '<rootDir>/packages'],
testMatch: ['**/integration_tests**/*.test.{js,mjs,ts,tsx}'],
testPathIgnorePatterns: preset.testPathIgnorePatterns.filter(
(pattern) => !pattern.includes('integration_tests')
),
setupFilesAfterEnv: [
'<rootDir>/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'],
};
1 change: 1 addition & 0 deletions packages/kbn-test/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
28 changes: 28 additions & 0 deletions packages/kbn-test/jest_integration/jest-preset.js
Original file line number Diff line number Diff line change
@@ -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: [
'<rootDir>/node_modules/@kbn/test/target_node/jest/setup/after_env.integration.js',
'<rootDir>/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'],
};
1 change: 1 addition & 0 deletions src/dev/precommit_hook/casing_check_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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/**/*',

Expand Down

0 comments on commit a0e9e85

Please sign in to comment.