Updates to Jest configuration (#125727)

This commit is contained in:
Tyler Smalley 2022-02-15 18:06:13 -08:00 committed by GitHub
parent c4c4eeeb28
commit e9d82d104b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 8 additions and 58 deletions

View file

@ -65,6 +65,7 @@ steps:
- command: .buildkite/scripts/steps/test/jest_integration.sh
label: 'Jest Integration Tests'
parallelism: 2
agents:
queue: n2-4
timeout_in_minutes: 120

View file

@ -10,11 +10,11 @@ is_test_execution_step
echo '--- Jest code coverage'
.buildkite/scripts/steps/code_coverage/jest_parallel.sh
.buildkite/scripts/steps/code_coverage/jest_parallel.sh jest.config.js
tar -czf kibana-jest-thread-coverage.tar.gz target/kibana-coverage/jest
echo "--- Merging code coverage for a thread"
yarn nyc report --nycrc-path src/dev/code_coverage/nyc_config/nyc.jest.config.js --reporter json
rm -rf target/kibana-coverage/jest/*
mv target/kibana-coverage/jest-combined/coverage-final.json "target/kibana-coverage/jest/jest-merged-coverage-$(date +%s%3N).json"
mv target/kibana-coverage/jest-combined/coverage-final.json "target/kibana-coverage/jest/jest-merged-coverage-$(date +%s%3N).json"

View file

@ -10,4 +10,4 @@ is_test_execution_step
echo '--- Jest'
checks-reporter-with-killswitch "Jest Unit Tests $((BUILDKITE_PARALLEL_JOB+1))" \
.buildkite/scripts/steps/test/jest_parallel.sh
.buildkite/scripts/steps/test/jest_parallel.sh jest.config.js

View file

@ -25,6 +25,6 @@ while read -r config; do
((i=i+1))
# uses heredoc to avoid the while loop being in a sub-shell thus unable to overwrite exitCode
done <<< "$(find src x-pack packages -name ${1:-jest.config.js} -not -path "*/__fixtures__/*" | sort)"
done <<< "$(find src x-pack packages -name "$1" -not -path "*/__fixtures__/*" | sort)"
exit $exitCode

View file

@ -1,27 +0,0 @@
/*
* 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 Fs = require('fs');
const Path = require('path');
module.exports = {
preset: '@kbn/test/jest_integration',
rootDir: '.',
roots: [
'<rootDir>/src',
'<rootDir>/packages',
...Fs.readdirSync(Path.resolve(__dirname, 'x-pack')).flatMap((name) => {
// create roots for all x-pack/* dirs except for test
if (name !== 'test' && Fs.statSync(Path.resolve(__dirname, 'x-pack', name)).isDirectory()) {
return [`<rootDir>/x-pack/${name}`];
}
return [];
}),
],
};

View file

@ -1,24 +0,0 @@
/*
* 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.
*/
module.exports = {
preset: '@kbn/test',
rootDir: '.',
projects: [
'<rootDir>/packages/*/jest.config.js',
'<rootDir>/src/*/jest.config.js',
'<rootDir>/src/plugins/*/jest.config.js',
'<rootDir>/src/plugins/chart_expressions/*/jest.config.js',
'<rootDir>/src/plugins/vis_types/*/jest.config.js',
'<rootDir>/test/*/jest.config.js',
'<rootDir>/x-pack/plugins/*/jest.config.js',
'<rootDir>/x-pack/plugins/security_solution/*/jest.config.js',
'<rootDir>/x-pack/plugins/security_solution/public/*/jest.config.js',
'<rootDir>/x-pack/plugins/security_solution/server/*/jest.config.js',
],
};

View file

@ -10,7 +10,7 @@ import { writeFileSync } from 'fs';
import path from 'path';
import Mustache from 'mustache';
import { run } from '@kbn/dev-utils';
import { run, createFailError } from '@kbn/dev-utils';
import { REPO_ROOT } from '@kbn/utils';
import { JestConfigs, CONFIG_NAMES } from './configs';
@ -72,7 +72,7 @@ export async function runCheckJestConfigsCli() {
log.info('created %s', file);
});
} else {
log.info(
throw createFailError(
`Run 'node scripts/check_jest_configs --fix' to create the missing config files`
);
}

View file

@ -9,4 +9,4 @@
require('../src/setup_node_env/ensure_node_preserve_symlinks');
process.argv.push('--runInBand');
require('@kbn/test').runJest('jest.config.integration.js');
require('@kbn/test').runJest('jest.integration.config.js');