kibana/packages
Lukas Olson 2a689fa787
Create @kbn/discover-utils package (#162004)
## Summary

Creates a shared package for Discover utils/services/hooks,
`@kbn/discover-utils`. Moves a couple of utils there
(`buildDataTableRecord`/`getDocId`). This will be the future home for
many services/utils that are shared between the Discover app and its
packaged components (like unified field list, unified histogram, etc.)

### Checklist

- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-07-18 13:34:09 -07:00
..
analytics [FullStory] Limit number of pageVars (#159725) 2023-06-15 16:38:34 +02:00
content-management [TableListView] Fix regression when resetting search (#162034) 2023-07-18 04:47:01 -07:00
core [Serverless] Add navigation functional tests (#161856) 2023-07-18 17:31:19 +02:00
deeplinks [Serverless] Update observability side navigation (#160866) 2023-07-03 12:39:48 +01:00
default-nav [ML] Integrating into serverless kibana (#159433) 2023-07-01 08:08:21 +01:00
home Upgrade EUI to 83.0.0 (#160813) 2023-07-06 12:46:55 -07:00
kbn-ace Transpile packages on demand, validate all TS projects (#146212) 2022-12-22 19:00:29 -06:00
kbn-alerts-as-data-utils Add error.grouping_name to group alerts in Error Count rule (#161810) 2023-07-14 18:34:21 +02:00
kbn-alerts-ui-shared [RAM] Move maintenance window callout to @kbn/alerts-ui-shared package (#160678) 2023-07-06 12:34:55 -07:00
kbn-ambient-common-types Transpile packages on demand, validate all TS projects (#146212) 2022-12-22 19:00:29 -06:00
kbn-ambient-ftr-types [codeowners] add appex-qa for ftr-related packages (#155230) 2023-05-24 08:53:09 +02:00
kbn-ambient-storybook-types Transpile packages on demand, validate all TS projects (#146212) 2022-12-22 19:00:29 -06:00
kbn-ambient-ui-types Transpile packages on demand, validate all TS projects (#146212) 2022-12-22 19:00:29 -06:00
kbn-analytics Transpile packages on demand, validate all TS projects (#146212) 2022-12-22 19:00:29 -06:00
kbn-apm-config-loader Config loader: remove unecessary properties (#154902) 2023-04-13 11:16:51 -05:00
kbn-apm-synthtrace fix: run apm-synthtrace on systems with multiple spaces (#160756) 2023-07-06 11:20:03 +02:00
kbn-apm-synthtrace-client [synthtrace] Add support for Infra, Asset and Monitoring data (#160479) 2023-06-29 06:26:15 -07:00
kbn-apm-utils Transpile packages on demand, validate all TS projects (#146212) 2022-12-22 19:00:29 -06:00
kbn-axe-config Updating axe-core to latest (#144940) 2023-03-29 00:06:25 +05:30
kbn-babel-preset [Synthetics/Uptime] Better code separation (#160245) 2023-06-26 17:47:04 +02:00
kbn-babel-register [kbn/babel-register] improve cache performance (#150261) 2023-02-06 19:50:42 -07:00
kbn-babel-transform [packages] migrate all plugins to packages (#148130) 2023-02-08 21:06:50 -06:00
kbn-bazel-runner chore(NA): remove a small change to trigger risk-free backport (#160810) 2023-06-28 21:08:33 +01:00
kbn-cases-components Upgrade EUI to v79.0.1 (#156925) 2023-05-15 16:09:31 -05:00
kbn-cell-actions [SecuritySolutions] Remove filter actions from Cases alerts table and fix show_top_n action (#161150) 2023-07-05 09:03:18 +02:00
kbn-chart-icons [Lens] fix inconsistent annotation icon styles (#159542) 2023-06-21 09:18:48 +02:00
kbn-check-mappings-update-cli [Security Solution] [Timeline] Add filter.meta.relation to timeline filters saved object mapping (#161722) 2023-07-12 15:09:13 -07:00
kbn-ci-stats-core Transpile packages on demand, validate all TS projects (#146212) 2022-12-22 19:00:29 -06:00
kbn-ci-stats-performance-metrics Transpile packages on demand, validate all TS projects (#146212) 2022-12-22 19:00:29 -06:00
kbn-ci-stats-reporter Transpile packages on demand, validate all TS projects (#146212) 2022-12-22 19:00:29 -06:00
kbn-ci-stats-shipper-cli [ci-stats] move shipper to a package, validate limits in on-merge job (#149474) 2023-01-25 08:20:40 -07:00
kbn-cli-dev-mode Enables preventing access to internal APIs (#156935) 2023-05-10 04:25:15 -07:00
kbn-coloring [Lens] Visualization UI package refactoring (#156185) 2023-05-04 14:12:10 +02:00
kbn-config [config] stop merging arrays from multiple configs (#161884) 2023-07-14 03:57:58 -07:00
kbn-config-mocks Add build_date to kbn:api/status (#157905) 2023-05-25 10:21:47 -07:00
kbn-config-schema Make config-schema extensible for handling of unknown fields (#156214) 2023-05-05 10:37:44 -04:00
kbn-content-management-utils [data views] Content management api implementation (#155803) 2023-05-24 13:29:59 -05:00
kbn-crypto Transpile packages on demand, validate all TS projects (#146212) 2022-12-22 19:00:29 -06:00
kbn-crypto-browser Transpile packages on demand, validate all TS projects (#146212) 2022-12-22 19:00:29 -06:00
kbn-cypress-config [Security Solution] ~200 ways to decrease flakiness in Cypress (#157387) 2023-05-30 17:40:18 +02:00
kbn-data-service [UnifiedFieldList] Convert from a plugin into a package (#158718) 2023-06-23 14:28:12 +02:00
kbn-datemath [packages] migrate all plugins to packages (#148130) 2023-02-08 21:06:50 -06:00
kbn-dev-cli-errors Transpile packages on demand, validate all TS projects (#146212) 2022-12-22 19:00:29 -06:00
kbn-dev-cli-runner Transpile packages on demand, validate all TS projects (#146212) 2022-12-22 19:00:29 -06:00
kbn-dev-proc-runner [Security Solution] ~200 ways to decrease flakiness in Cypress (#157387) 2023-05-30 17:40:18 +02:00
kbn-dev-utils [packages] migrate all plugins to packages (#148130) 2023-02-08 21:06:50 -06:00
kbn-discover-utils Create @kbn/discover-utils package (#162004) 2023-07-18 13:34:09 -07:00
kbn-doc-links [Enterprise Search] Add Google Drive connector tile to content UI (#161359) 2023-07-07 10:51:11 +02:00
kbn-docs-utils [spacetime] Improve scripts/build_api_docs stats output speed. (#157129) 2023-06-01 14:10:59 +02:00
kbn-dom-drag-drop [Lens] fix drag and drop small styling details (#161121) 2023-07-11 09:56:16 -04:00
kbn-ebt-tools Transpile packages on demand, validate all TS projects (#146212) 2022-12-22 19:00:29 -06:00
kbn-ecs Generate kbn/ecs with ECS 8.6.1 (#151642) 2023-02-21 15:02:38 +01:00
kbn-es [Serverless] Allow authentication via the Elasticsearch JWT realm with the shared_secret client authentication type. (#161564) 2023-07-11 15:06:34 +02:00
kbn-es-archiver Attempt to fix flaky tests after split migration (#159397) 2023-07-07 17:05:42 +02:00
kbn-es-errors Transpile packages on demand, validate all TS projects (#146212) 2022-12-22 19:00:29 -06:00
kbn-es-query [KQL] Add support for toKqlExpression (#161601) 2023-07-14 13:44:50 -07:00
kbn-es-types [APM] Use (rolled up) service metrics for service inventory (#149938) 2023-02-04 04:00:25 -07:00
kbn-eslint-config ESLint Telemetry Rule (#153108) 2023-03-20 13:31:02 +00:00
kbn-eslint-plugin-disable Transpile packages on demand, validate all TS projects (#146212) 2022-12-22 19:00:29 -06:00
kbn-eslint-plugin-eslint Transpile packages on demand, validate all TS projects (#146212) 2022-12-22 19:00:29 -06:00
kbn-eslint-plugin-imports [packages] migrate all plugins to packages (#148130) 2023-02-08 21:06:50 -06:00
kbn-eslint-plugin-telemetry Upgrade typescript-eslint to 5.54.0 (#152358) 2023-03-23 10:52:41 -05:00
kbn-expandable-flyout [Security Solution] Clean up expandable flyout props (#160628) 2023-07-07 10:16:21 -07:00
kbn-expect [codeowners] add appex-qa for ftr-related packages (#155230) 2023-05-24 08:53:09 +02:00
kbn-failed-test-reporter-cli [codeowners] add appex-qa for ftr-related packages (#155230) 2023-05-24 08:53:09 +02:00
kbn-field-types Update codeowners to move AppServices packages to DataDiscovery (#149065) 2023-01-18 13:34:28 -07:00
kbn-find-used-node-modules [packages] migrate all plugins to packages (#148130) 2023-02-08 21:06:50 -06:00
kbn-flot-charts Fix useless regex escapes (#150043) 2023-02-07 09:58:47 -07:00
kbn-ftr-common-functional-services [ftr] fix test users for serverless (#161280) 2023-07-10 10:09:07 +02:00
kbn-ftr-screenshot-filename [codeowners] add appex-qa for ftr-related packages (#155230) 2023-05-24 08:53:09 +02:00
kbn-generate Remove kibana-design from the ultimate rule for scss files. (#157493) 2023-05-12 10:01:47 -05:00
kbn-generate-console-definitions [Console] Filter autocomplete endpoints by availability (#161781) 2023-07-14 10:29:27 +01:00
kbn-generate-csv [Lens] Quote csv values when contain separator char (#155905) 2023-04-28 15:04:30 +02:00
kbn-generate-csv-types [Reporting] Generate CSV Package (#151801) 2023-04-13 10:27:35 -07:00
kbn-get-repo-files [packages] migrate all plugins to packages (#148130) 2023-02-08 21:06:50 -06:00
kbn-guided-onboarding [Enterprise Search] Add vector search and ESRE tiles to guides (#160029) 2023-06-20 22:12:30 +02:00
kbn-handlebars [@kbn/handlebars] Refactor types (#150520) 2023-02-14 13:37:41 +01:00
kbn-hapi-mocks Transpile packages on demand, validate all TS projects (#146212) 2022-12-22 19:00:29 -06:00
kbn-health-gateway-server Change the health gateway to use the status API (#160125) 2023-06-26 02:34:00 -07:00
kbn-i18n Downgrade Node.js to version 16 (#149531) 2023-01-26 11:53:52 +00:00
kbn-i18n-react Transpile packages on demand, validate all TS projects (#146212) 2022-12-22 19:00:29 -06:00
kbn-import-locator [packages] migrate all plugins to packages (#148130) 2023-02-08 21:06:50 -06:00
kbn-import-resolver [packages] migrate all plugins to packages (#148130) 2023-02-08 21:06:50 -06:00
kbn-interpreter Fix eslint rule for restricting certain lodash imports (#151023) 2023-02-16 08:35:09 -07:00
kbn-io-ts-utils Validate array types for strictKeysRt (#161526) 2023-07-13 18:37:34 +02:00
kbn-jest-serializers Transpile packages on demand, validate all TS projects (#146212) 2022-12-22 19:00:29 -06:00
kbn-journeys [ML] Transforms: Add performance journey for transform wizard source index loading. (#160837) 2023-06-30 13:03:22 +02:00
kbn-json-ast [packages] migrate all plugins to packages (#148130) 2023-02-08 21:06:50 -06:00
kbn-kibana-manifest-schema implement "plugin" package type (#149370) 2023-01-30 10:47:53 -07:00
kbn-language-documentation-popover Transpile packages on demand, validate all TS projects (#146212) 2022-12-22 19:00:29 -06:00
kbn-lint-packages-cli [packages] migrate all plugins to packages (#148130) 2023-02-08 21:06:50 -06:00
kbn-lint-ts-projects-cli [packages] migrate all plugins to packages (#148130) 2023-02-08 21:06:50 -06:00
kbn-logging Replace ecs package with ecs-typescript generated code (#148804) 2023-01-26 07:10:32 +01:00
kbn-logging-mocks Transpile packages on demand, validate all TS projects (#146212) 2022-12-22 19:00:29 -06:00
kbn-managed-vscode-config Transpile packages on demand, validate all TS projects (#146212) 2022-12-22 19:00:29 -06:00
kbn-managed-vscode-config-cli Transpile packages on demand, validate all TS projects (#146212) 2022-12-22 19:00:29 -06:00
kbn-management [Deployment Management] Add cards navigation in management landing page for serverless (#160096) 2023-06-30 11:27:56 +02:00
kbn-mapbox-gl [maps] fix Map orphans sources on layer deletion (#159067) 2023-06-06 14:34:40 -06:00
kbn-monaco Downgrade Node.js to version 16 (#149531) 2023-01-26 11:53:52 +00:00
kbn-object-versioning [CM] Onboard maps to cross-type search (#155148) 2023-04-21 07:41:08 -07:00
kbn-optimizer [ColorScheme] Update from avatar menu (#161214) 2023-07-12 15:46:41 +01:00
kbn-optimizer-webpack-helpers Transpile packages on demand, validate all TS projects (#146212) 2022-12-22 19:00:29 -06:00
kbn-osquery-io-ts-types [Osquery] Substitute Event Data in place of {{parameter}} in Osquery run from Alerts (#146598) 2023-01-05 15:49:40 +01:00
kbn-peggy Transpile packages on demand, validate all TS projects (#146212) 2022-12-22 19:00:29 -06:00
kbn-peggy-loader Transpile packages on demand, validate all TS projects (#146212) 2022-12-22 19:00:29 -06:00
kbn-performance-testing-dataset-extractor [performance] use journey own ftr config to run scalability test (#152596) 2023-03-07 13:20:21 +01:00
kbn-picomatcher Implement package linter (#148496) 2023-01-09 16:49:29 -07:00
kbn-plugin-generator Migrate from deprecated EUI components (#161548) 2023-07-13 03:22:02 -07:00
kbn-plugin-helpers fix(NA): build external plugins with correct bazel artifacts output mode (#159630) 2023-06-15 00:43:05 +01:00
kbn-react-field [Discover] Drag & drop for adding columns to the table (#153538) 2023-04-19 19:17:54 +02:00
kbn-repo-file-maps [packages] migrate all plugins to packages (#148130) 2023-02-08 21:06:50 -06:00
kbn-repo-info Add build_date to kbn:api/status (#157905) 2023-05-25 10:21:47 -07:00
kbn-repo-linter Implement package linter (#148496) 2023-01-09 16:49:29 -07:00
kbn-repo-packages Hide error outputs from checking for git root (#157851) 2023-05-22 09:45:45 +02:00
kbn-repo-path [packages] prevent and remove basename collisions for js/ts code (#148835) 2023-01-12 12:29:30 -07:00
kbn-repo-source-classifier [packages] migrate all plugins to packages (#148130) 2023-02-08 21:06:50 -06:00
kbn-repo-source-classifier-cli [packages] migrate all plugins to packages (#148130) 2023-02-08 21:06:50 -06:00
kbn-reporting/common [Reporting] Generate CSV Package (#151801) 2023-04-13 10:27:35 -07:00
kbn-rison [Security Solution] Global query string functionality improvements (#147218) 2023-01-05 18:02:12 +01:00
kbn-rrule [RAM] Remove third party RRule library, replace with own timezone-compliant lib (#152873) 2023-07-02 17:03:45 -04:00
kbn-rule-data-utils [Security Solution][Detection Alerts] Alert tagging (#157786) 2023-06-20 22:04:52 -04:00
kbn-safer-lodash-set Fix eslint rule for restricting certain lodash imports (#151023) 2023-02-16 08:35:09 -07:00
kbn-saved-objects-settings [Content Management] Remove dep from content_management -> saved_object_finder (#155013) 2023-04-17 16:25:58 +02:00
kbn-securitysolution-autocomplete [Security Solution] Clean up CODEOWNERS and other files for the Detection Engine team (#159729) 2023-06-14 10:39:50 -07:00
kbn-securitysolution-ecs [Security Solution][Detection Alerts] Alert tagging (#157786) 2023-06-20 22:04:52 -04:00
kbn-securitysolution-es-utils [Security Solution] Clean up CODEOWNERS and other files for the Detection Engine team (#159729) 2023-06-14 10:39:50 -07:00
kbn-securitysolution-exception-list-components Upgrade EUI to v84.0.0 (#161716) 2023-07-14 11:16:49 -07:00
kbn-securitysolution-grouping Upgrade EUI to v84.0.0 (#161716) 2023-07-14 11:16:49 -07:00
kbn-securitysolution-hook-utils [Security Solution] Clean up CODEOWNERS and other files for the Detection Engine team (#159729) 2023-06-14 10:39:50 -07:00
kbn-securitysolution-io-ts-alerting-types [Security Solution] Clean up CODEOWNERS and other files for the Detection Engine team (#159729) 2023-06-14 10:39:50 -07:00
kbn-securitysolution-io-ts-list-types [Security Solution] Clean up CODEOWNERS and other files for the Detection Engine team (#159729) 2023-06-14 10:39:50 -07:00
kbn-securitysolution-io-ts-types [SecuritySolution][EntityAnalytics] Risk Scoring Preview API (#155966) 2023-06-15 14:16:28 -05:00
kbn-securitysolution-io-ts-utils [Security Solution] Clean up CODEOWNERS and other files for the Detection Engine team (#159729) 2023-06-14 10:39:50 -07:00
kbn-securitysolution-list-api [Security Solution] Clean up CODEOWNERS and other files for the Detection Engine team (#159729) 2023-06-14 10:39:50 -07:00
kbn-securitysolution-list-constants [Security Solution] Clean up CODEOWNERS and other files for the Detection Engine team (#159729) 2023-06-14 10:39:50 -07:00
kbn-securitysolution-list-hooks [Security Solution] Clean up CODEOWNERS and other files for the Detection Engine team (#159729) 2023-06-14 10:39:50 -07:00
kbn-securitysolution-list-utils [Security Solution] Clean up CODEOWNERS and other files for the Detection Engine team (#159729) 2023-06-14 10:39:50 -07:00
kbn-securitysolution-rules [Security Solution] Clean up CODEOWNERS and other files for the Detection Engine team (#159729) 2023-06-14 10:39:50 -07:00
kbn-securitysolution-t-grid [Security Solution] Clean up CODEOWNERS and other files for the Detection Engine team (#159729) 2023-06-14 10:39:50 -07:00
kbn-securitysolution-utils [Security Solution] Clean up CODEOWNERS and other files for the Detection Engine team (#159729) 2023-06-14 10:39:50 -07:00
kbn-server-http-tools Enables preventing access to internal APIs (#156935) 2023-05-10 04:25:15 -07:00
kbn-server-route-repository [http] Only allow 2023-10-31 when registering public versions (#159553) 2023-06-15 11:50:54 -04:00
kbn-set-map [packages] migrate all plugins to packages (#148130) 2023-02-08 21:06:50 -06:00
kbn-shared-svg Transpile packages on demand, validate all TS projects (#146212) 2022-12-22 19:00:29 -06:00
kbn-shared-ux-utility [codeowners] rename global experience to @elastic/appex-sharedux 2023-01-18 10:02:49 -07:00
kbn-some-dev-log Transpile packages on demand, validate all TS projects (#146212) 2022-12-22 19:00:29 -06:00
kbn-sort-package-json [sort-package-json] always ensure 2-space indent is used 2023-01-10 10:39:48 -07:00
kbn-spec-to-console [Console] Update autocomplete definitions (#153098) 2023-03-22 14:50:38 +00:00
kbn-std [uiSettings] always use the latest config document to create the new one (#159649) 2023-06-19 00:09:27 -07:00
kbn-stdio-dev-helpers Transpile packages on demand, validate all TS projects (#146212) 2022-12-22 19:00:29 -06:00
kbn-storybook Order Emotion styles before Sass styles (#161592) 2023-07-13 07:41:17 -07:00
kbn-telemetry-tools [Serverless Telemetry] Add serverless label to inform of the project type (#159549) 2023-06-14 18:05:04 +02:00
kbn-test [Serverless] Add internal uiSettings routes and expose public routes in self-managed only (#160499) 2023-07-14 15:53:17 +01:00
kbn-test-jest-helpers [Lens] Add custom formatter within the Lens editor (#158468) 2023-06-13 13:08:07 +02:00
kbn-test-subj-selector [codeowners] add appex-qa for ftr-related packages (#155230) 2023-05-24 08:53:09 +02:00
kbn-text-based-editor [Textbased] Moves the error message in the beginning of the footer (#161929) 2023-07-14 12:18:38 +03:00
kbn-timelion-grammar Transpile packages on demand, validate all TS projects (#146212) 2022-12-22 19:00:29 -06:00
kbn-tinymath [packages] migrate all plugins to packages (#148130) 2023-02-08 21:06:50 -06:00
kbn-tooling-log Transpile packages on demand, validate all TS projects (#146212) 2022-12-22 19:00:29 -06:00
kbn-ts-projects [Synthetics/Uptime] Separate e2e tests by app (#152197) 2023-06-07 17:33:56 +02:00
kbn-ts-type-check-cli [packages] migrate all plugins to packages (#148130) 2023-02-08 21:06:50 -06:00
kbn-typed-react-router-config [shared-ux-router] Add Router and Routes components (#159834) 2023-06-23 10:02:06 -05:00
kbn-ui-actions-browser [UnifiedFieldList] Convert from a plugin into a package (#158718) 2023-06-23 14:28:12 +02:00
kbn-ui-framework Transpile packages on demand, validate all TS projects (#146212) 2022-12-22 19:00:29 -06:00
kbn-ui-shared-deps-npm Add io-ts in kb-ui-shared-bundle (#159792) 2023-06-15 15:17:18 +02:00
kbn-ui-shared-deps-src Add io-ts in kb-ui-shared-bundle (#159792) 2023-06-15 15:17:18 +02:00
kbn-ui-theme Transpile packages on demand, validate all TS projects (#146212) 2022-12-22 19:00:29 -06:00
kbn-unified-field-list [Lens] Refactor drag and drop (#161257) 2023-07-11 13:05:03 +02:00
kbn-url-state [Security Solution] Store expandable flyout state in the url (#154703) 2023-04-21 15:45:37 -05:00
kbn-user-profile-components [Cases] Fix bug where the Cases users API will thrown an error when imageUrl is set to null (#158815) 2023-06-02 01:09:16 -07:00
kbn-utility-types [Versioned HTTP] Add response runtime and type-level validation (#153011) 2023-03-13 10:54:42 -03:00
kbn-utility-types-jest [packages] migrate all plugins to packages (#148130) 2023-02-08 21:06:50 -06:00
kbn-utils Revert "Custom path for data directory configuration is ignored (#157… (#158325) 2023-05-23 14:22:35 -07:00
kbn-validate-next-docs-cli [validate-next-docs] declare how github urls are determined 2023-02-10 10:54:20 -06:00
kbn-web-worker-stub Transpile packages on demand, validate all TS projects (#146212) 2022-12-22 19:00:29 -06:00
kbn-whereis-pkg-cli [packages] migrate all plugins to packages (#148130) 2023-02-08 21:06:50 -06:00
kbn-yarn-lock-validator [packages] migrate all plugins to packages (#148130) 2023-02-08 21:06:50 -06:00
serverless [serverless] Create the Serverless Plugin (#155582) 2023-04-26 11:48:23 -07:00
shared-ux [Serverless] Add navigation functional tests (#161856) 2023-07-18 17:31:19 +02:00
README.md create @kbn/ui-actions-browser package (#149202) 2023-01-19 18:28:07 +01:00

Kibana-related packages

This folder contains packages that are intended for use in Kibana and Kibana plugins.

tl;dr:

  • Don't publish to npm registry
  • Always use the @kbn namespace
  • Always set "private": true in package.json

Using these packages

We no longer publish these packages to the npm registry. Now, instead of specifying a version when including these packages, we rely on yarn workspaces, which sets up a symlink to the package.

For example if you want to use the @kbn/i18n package in Kibana itself, you can specify the dependency like this:

"@kbn/i18n": "1.0.0"

However, if you want to use this from a Kibana plugin, you need to use a link: dependency and account for the relative location of the Kibana repo, so it would instead be:

"@kbn/i18n": "link:../../kibana/packages/kbn-i18n"

then run yarn kbn bootstrap from the plugin directory.

Creating a new package

Run the following command from the root of the Kibana repo:

node scripts/generate package @kbn/<PACKAGE_NAME> --web --owner @elastic/<TEAM_NAME>

Unit tests for a package

Currently there is only one tool being used in order to test packages which is Jest. Below we will explain how it should be done.

Jest

A package should follow the pattern of having .test.js files as siblings of the source code files, and these run by Jest.

A package using the .test.js naming convention will have those tests automatically picked up by Jest and run by the unit test runner, currently mapped to the Kibana test script in the root package.json.

  • yarn test runs all unit tests.
  • yarn jest runs all Jest tests in Kibana.

In order for the plugin or package to use Jest, a jest.config.js file must be present in it's root. However, there are safeguards for this in CI should a test file be added without a corresponding config file.


Each package can also specify its own test script in the package's package.json, for cases where you'd prefer to run the tests from the local package directory.