[coverage] re-enable jest (#85946)

* [coverage] re-enable jest

* fix coverage script for x-pack

* use presets in entry configs

* set max workers

* run tests from x-pack folde

* remove duplicate 'reporters' prop

* remove reporters for x-pack config

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Dmitry 2020-12-16 20:20:55 +01:00 committed by GitHub
parent 7933f0458c
commit 2fcce0bcbc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 27 additions and 30 deletions

View file

@ -18,6 +18,7 @@
*/
module.exports = {
preset: '@kbn/test',
rootDir: '.',
projects: [
'<rootDir>/packages/*/jest.config.js',
@ -26,5 +27,4 @@ module.exports = {
'<rootDir>/src/plugins/*/jest.config.js',
'<rootDir>/test/*/jest.config.js',
],
reporters: ['default', '<rootDir>/packages/kbn-test/target/jest/junit_reporter'],
};

View file

@ -6,7 +6,7 @@ EXTRACT_DIR=/tmp/extracted_coverage
mkdir -p $EXTRACT_DIR
echo "### Extracting downloaded artifacts"
for x in kibana-intake kibana-oss-tests kibana-xpack-tests; do #x-pack-intake skipping due to failures
for x in kibana-intake x-pack-intake kibana-oss-tests kibana-xpack-tests; do
tar -xzf $DOWNLOAD_DIR/coverage/${x}/kibana-coverage.tar.gz -C $EXTRACT_DIR || echo "### Error 'tarring': ${x}"
done

View file

@ -32,7 +32,7 @@ TEAM_ASSIGN_PATH=$5
# Build team assignments dat file
node scripts/generate_team_assignments.js --verbose --src .github/CODEOWNERS --dest $TEAM_ASSIGN_PATH
for x in functional; do #jest skip due to failures
for x in jest functional; do
echo "### Ingesting coverage for ${x}"
COVERAGE_SUMMARY_FILE=target/kibana-coverage/${x}-combined/coverage-summary.json

View file

@ -4,6 +4,6 @@ COVERAGE_TEMP_DIR=/tmp/extracted_coverage/target/kibana-coverage/
export COVERAGE_TEMP_DIR
echo "### Merge coverage reports"
for x in functional; do # jest skip due to failures
for x in jest functional; do
yarn nyc report --nycrc-path src/dev/code_coverage/nyc_config/nyc.${x}.config.js
done

View file

@ -34,16 +34,16 @@ 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 ""
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 ""
echo " -> Running mocha tests with coverage"
./test/scripts/checks/mocha_coverage.sh
echo ""

View file

@ -7,12 +7,13 @@ if [[ -z "$CODE_COVERAGE" ]] ; then
./test/scripts/test/xpack_jest_unit.sh
else
echo " -> Running jest tests with coverage"
echo " -> Build runtime for canvas"
# build runtime for canvas
echo "NODE_ENV=$NODE_ENV"
node ./x-pack/plugins/canvas/scripts/shareable_runtime
node --max-old-space-size=6144 scripts/jest x-pack --ci --verbose --coverage
echo " -> Running jest tests with coverage"
cd x-pack
node --max-old-space-size=6144 scripts/jest --ci --verbose --maxWorkers=5 --coverage --config jest.config.js
# rename file in order to be unique one
test -f ../target/kibana-coverage/jest/coverage-final.json \
&& mv ../target/kibana-coverage/jest/coverage-final.json \

View file

@ -59,7 +59,7 @@ def uploadBaseWebsiteFiles(prefix) {
def uploadCoverageHtmls(prefix) {
[
'target/kibana-coverage/functional-combined',
// 'target/kibana-coverage/jest-combined', skipped due to failures
'target/kibana-coverage/jest-combined',
'target/kibana-coverage/mocha-combined',
].each { uploadWithVault(prefix, it) }
}
@ -200,14 +200,13 @@ def ingest(jobName, buildNumber, buildUrl, timestamp, previousSha, teamAssignmen
def runTests() {
parallel([
'kibana-intake-agent': workers.intake('kibana-intake', './test/scripts/jenkins_unit.sh'),
// skipping due to failures
// 'x-pack-intake-agent': {
// withEnv([
// 'NODE_ENV=test' // Needed for jest tests only
// ]) {
// workers.intake('x-pack-intake', './test/scripts/jenkins_xpack.sh')()
// }
// },
'x-pack-intake-agent': {
withEnv([
'NODE_ENV=test' // Needed for jest tests only
]) {
workers.intake('x-pack-intake', './test/scripts/jenkins_xpack.sh')()
}
},
'kibana-oss-agent' : workers.functional(
'kibana-oss-tests',
{ kibanaPipeline.buildOss() },

View file

@ -5,10 +5,7 @@
*/
module.exports = {
preset: '@kbn/test',
rootDir: '..',
projects: ['<rootDir>/x-pack/plugins/*/jest.config.js'],
reporters: [
'default',
['<rootDir>/packages/kbn-test/target/jest/junit_reporter', { reportName: 'X-Pack Jest Tests' }],
],
};