Skip to content

Commit

Permalink
WIP: Test combining Jest unit tests
Browse files Browse the repository at this point in the history
Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
  • Loading branch information
Tyler Smalley committed Dec 18, 2020
1 parent 53da425 commit 7adf829
Show file tree
Hide file tree
Showing 11 changed files with 16 additions and 88 deletions.
1 change: 1 addition & 0 deletions jest.config.integration.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,5 @@ module.exports = {
],
],
setupFilesAfterEnv: ['<rootDir>/packages/kbn-test/target/jest/setup/after_env.integration.js'],
coverageDirectory: '<rootDir>/target/jest-coverage/jest_integration',
};
10 changes: 9 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,13 @@

module.exports = {
rootDir: '.',
projects: [...require('./jest.config.oss').projects, ...require('./x-pack/jest.config').projects],
projects: [
'<rootDir>/packages/*/jest.config.js',
'<rootDir>/src/*/jest.config.js',
'<rootDir>/src/legacy/*/jest.config.js',
'<rootDir>/src/plugins/*/jest.config.js',
'<rootDir>/test/*/jest.config.js',
...require('./x-pack/jest.config').projects,
],
reporters: ['default', '<rootDir>/packages/kbn-test/target/jest/junit_reporter'],
};
30 changes: 0 additions & 30 deletions jest.config.oss.js

This file was deleted.

2 changes: 1 addition & 1 deletion packages/kbn-test/jest-preset.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ module.exports = {
coveragePathIgnorePatterns: ['/node_modules/', '.*\\.d\\.ts'],

// A list of reporter names that Jest uses when writing coverage reports
coverageReporters: !!process.env.CODE_COVERAGE ? ['json'] : ['html', 'text'],
coverageReporters: ['html', 'text'],

// An array of file extensions your modules use
moduleFileExtensions: ['js', 'mjs', 'json', 'ts', 'tsx', 'node'],
Expand Down
21 changes: 3 additions & 18 deletions test/scripts/jenkins_unit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@

source test/scripts/jenkins_test_setup.sh

rename_coverage_file() {
test -f target/kibana-coverage/jest/coverage-final.json \
&& mv target/kibana-coverage/jest/coverage-final.json \
target/kibana-coverage/jest/$1-coverage-final.json
}

if [[ -z "$CODE_COVERAGE" ]] ; then
# Lint
./test/scripts/lint/eslint.sh
Expand All @@ -34,18 +28,9 @@ if [[ -z "$CODE_COVERAGE" ]] ; then
./test/scripts/checks/test_projects.sh
./test/scripts/checks/test_hardening.sh
else
echo " -> Running jest tests with coverage"
node scripts/jest --ci --verbose --coverage --config jest.config.oss.js
rename_coverage_file "oss"
echo ""
echo ""
echo " -> Running jest integration tests with coverage"
node --max-old-space-size=8192 scripts/jest_integration --ci --verbose --coverage || true;
rename_coverage_file "oss-integration"
echo ""
echo ""
./test/scripts/test/jest_unit.sh
./test/scripts/test/jest_integration.sh

echo " -> Running mocha tests with coverage"
./test/scripts/checks/mocha_coverage.sh
echo ""
echo ""
fi
23 changes: 0 additions & 23 deletions test/scripts/jenkins_xpack.sh

This file was deleted.

2 changes: 1 addition & 1 deletion test/scripts/test/jest_integration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
source src/dev/ci_setup/setup_env.sh

checks-reporter-with-killswitch "Jest Integration Tests" \
node scripts/jest_integration --ci --verbose
node --expose-gc scripts/jest_integration --logHeapUsage --ci --verbose --coverage --coverageReporters json
2 changes: 1 addition & 1 deletion test/scripts/test/jest_unit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
source src/dev/ci_setup/setup_env.sh

checks-reporter-with-killswitch "Jest Unit Tests" \
node scripts/jest --config jest.config.oss.js --ci --verbose --maxWorkers=5
node scripts/jest --ci --verbose --maxWorkers=10 --coverage --coverageReporters json
6 changes: 0 additions & 6 deletions test/scripts/test/xpack_jest_unit.sh

This file was deleted.

6 changes: 0 additions & 6 deletions test/scripts/test/xpack_karma.sh

This file was deleted.

1 change: 0 additions & 1 deletion vars/tasks.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ def test() {

kibanaPipeline.scriptTask('Jest Unit Tests', 'test/scripts/test/jest_unit.sh'),
kibanaPipeline.scriptTask('API Integration Tests', 'test/scripts/test/api_integration.sh'),
kibanaPipeline.scriptTask('X-Pack Jest Unit Tests', 'test/scripts/test/xpack_jest_unit.sh'),
])
}

Expand Down

0 comments on commit 7adf829

Please sign in to comment.