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 <[email protected]>
Co-authored-by: Kibana Machine <[email protected]>
  • Loading branch information
3 people authored Jul 14, 2021
1 parent 02cd508 commit 977039c
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 @@ -28,6 +28,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 @@ -40,6 +40,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 977039c

Please sign in to comment.