mirror of
https://github.com/elastic/kibana.git
synced 2025-06-28 03:01:21 -04:00
Updates to Jest configuration (#125727)
This commit is contained in:
parent
c4c4eeeb28
commit
e9d82d104b
8 changed files with 8 additions and 58 deletions
|
@ -65,6 +65,7 @@ steps:
|
||||||
|
|
||||||
- command: .buildkite/scripts/steps/test/jest_integration.sh
|
- command: .buildkite/scripts/steps/test/jest_integration.sh
|
||||||
label: 'Jest Integration Tests'
|
label: 'Jest Integration Tests'
|
||||||
|
parallelism: 2
|
||||||
agents:
|
agents:
|
||||||
queue: n2-4
|
queue: n2-4
|
||||||
timeout_in_minutes: 120
|
timeout_in_minutes: 120
|
||||||
|
|
|
@ -10,11 +10,11 @@ is_test_execution_step
|
||||||
|
|
||||||
echo '--- Jest code coverage'
|
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
|
tar -czf kibana-jest-thread-coverage.tar.gz target/kibana-coverage/jest
|
||||||
|
|
||||||
echo "--- Merging code coverage for a thread"
|
echo "--- Merging code coverage for a thread"
|
||||||
yarn nyc report --nycrc-path src/dev/code_coverage/nyc_config/nyc.jest.config.js --reporter json
|
yarn nyc report --nycrc-path src/dev/code_coverage/nyc_config/nyc.jest.config.js --reporter json
|
||||||
rm -rf target/kibana-coverage/jest/*
|
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"
|
||||||
|
|
|
@ -10,4 +10,4 @@ is_test_execution_step
|
||||||
|
|
||||||
echo '--- Jest'
|
echo '--- Jest'
|
||||||
checks-reporter-with-killswitch "Jest Unit Tests $((BUILDKITE_PARALLEL_JOB+1))" \
|
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
|
||||||
|
|
|
@ -25,6 +25,6 @@ while read -r config; do
|
||||||
|
|
||||||
((i=i+1))
|
((i=i+1))
|
||||||
# uses heredoc to avoid the while loop being in a sub-shell thus unable to overwrite exitCode
|
# 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
|
exit $exitCode
|
||||||
|
|
|
@ -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 [];
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
};
|
|
|
@ -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',
|
|
||||||
],
|
|
||||||
};
|
|
|
@ -10,7 +10,7 @@ import { writeFileSync } from 'fs';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import Mustache from 'mustache';
|
import Mustache from 'mustache';
|
||||||
|
|
||||||
import { run } from '@kbn/dev-utils';
|
import { run, createFailError } from '@kbn/dev-utils';
|
||||||
import { REPO_ROOT } from '@kbn/utils';
|
import { REPO_ROOT } from '@kbn/utils';
|
||||||
|
|
||||||
import { JestConfigs, CONFIG_NAMES } from './configs';
|
import { JestConfigs, CONFIG_NAMES } from './configs';
|
||||||
|
@ -72,7 +72,7 @@ export async function runCheckJestConfigsCli() {
|
||||||
log.info('created %s', file);
|
log.info('created %s', file);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
log.info(
|
throw createFailError(
|
||||||
`Run 'node scripts/check_jest_configs --fix' to create the missing config files`
|
`Run 'node scripts/check_jest_configs --fix' to create the missing config files`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,4 +9,4 @@
|
||||||
require('../src/setup_node_env/ensure_node_preserve_symlinks');
|
require('../src/setup_node_env/ensure_node_preserve_symlinks');
|
||||||
process.argv.push('--runInBand');
|
process.argv.push('--runInBand');
|
||||||
|
|
||||||
require('@kbn/test').runJest('jest.config.integration.js');
|
require('@kbn/test').runJest('jest.integration.config.js');
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue