Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[code coverage] collect for oss integration tests #83907

Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,8 @@ it('uses cache on second run and exist cleanly', async () => {
`);
});

it('prepares assets for distribution', async () => {
// test is failing since actual snapshot is modified when running with code coverage
(!!process.env.CODE_COVERAGE ? it.skip : it)('prepares assets for distribution', async () => {
spalger marked this conversation as resolved.
Show resolved Hide resolved
dmlemeshko marked this conversation as resolved.
Show resolved Hide resolved
const config = OptimizerConfig.create({
repoRoot: MOCK_REPO_DIR,
pluginScanDirs: [Path.resolve(MOCK_REPO_DIR, 'plugins'), Path.resolve(MOCK_REPO_DIR, 'x-pack')],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ PWD=$(pwd)
du -sh $COMBINED_EXRACT_DIR

echo "### Jest: replacing path in json files"
for i in coverage-final xpack-coverage-final; do
sed -i "s|/dev/shm/workspace/kibana|${PWD}|g" $COMBINED_EXRACT_DIR/jest/${i}.json &
for i in oss oss-integration xpack; do
sed -i "s|/dev/shm/workspace/kibana|${PWD}|g" $COMBINED_EXRACT_DIR/jest/${i}-coverage-final.json &
done
wait

Expand Down
12 changes: 12 additions & 0 deletions test/scripts/jenkins_unit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,23 @@

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
"$(FORCE_COLOR=0 yarn bin)/grunt" jenkins:unit --dev;
else
echo " -> Running jest tests with coverage"
node scripts/jest --ci --verbose --coverage
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"
Expand Down