-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
TS Incremental build exclude test files #95610
Conversation
@@ -26,6 +26,10 @@ function testMatchers(matchers: IMinimatch[], path: string) { | |||
return matchers.some((matcher) => matcher.match(path)); | |||
} | |||
|
|||
const parentProjectFactory = memoize(function (parentConfigPath: string) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all the plugin config extend tsconfig.project.json
, no need to recreate it 123 times.
|
||
constructor( | ||
public tsConfigPath: string, | ||
options: { name?: string; disableTypeCheck?: boolean } = {} | ||
) { | ||
this.config = parseTsConfig(tsConfigPath); | ||
|
||
const { files, include, exclude = [] } = this.config as { | ||
const { files, include, exclude = [], extends: extendsPath } = this.config as { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extends
in a reserved word
// @ts-expect-error | ||
import { EuiFieldNumber, EuiFormRow, EuiFormRowDisplayKeys } from '@elastic/eui'; | ||
import { EuiFieldNumber, EuiFormRow } from '@elastic/eui'; | ||
import type { EuiFormRowDisplayKeys } from '@elastic/eui/src/components/form/form_row/form_row'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EuiFormRowDisplayKeys
used to be inferred as any
, fixed
@@ -6,7 +6,7 @@ | |||
*/ | |||
|
|||
import React from 'react'; | |||
import { renderWithRouter, shallowWithRouter } from '../../lib'; | |||
import { renderWithRouter, shallowWithRouter } from '../../lib/helper/enzyme_helpers'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm surprised the exclusion of test utils didn't affect the dist size.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Security Solution changes LGTM! Thanks! 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Asset management LGTM
@elasticmachine merge upstream |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
@elasticmachine merge upstream |
@elasticmachine merge upstream |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Presentation team changes lgtm
@elasticmachine merge upstream |
💚 Build SucceededMetrics [docs]Module Count
Async chunks
Page load bundle
History
To update your PR or re-run it, just comment with: |
* add base config for all the TS projects * all the project use new tsconfig.project.json * compile test files in the high-level tsconfig.json * fix TS error in maps plugin * fix TS error in infra plugin * exclude mote test and test until folders * uptime. do not import test code within prod code * expressions. do not import test code within prod code * data: export mocks from high level folder * task_manager: comply with es client typings * infra: remove unused enzyme_helpers * check_ts_project requires "include" key * ts_check should handle parent configs * all ts configs should extend base one * exclude test folders from plugins * update patterns to fix ts_check errors * Apply suggestions from code review Co-authored-by: Constance <[email protected]> * uptime: MountWithReduxProvider to test helpers Co-authored-by: Constance <[email protected]> Co-authored-by: Kibana Machine <[email protected]>
* TS Incremental build exclude test files (#95610) * add base config for all the TS projects * all the project use new tsconfig.project.json * compile test files in the high-level tsconfig.json * fix TS error in maps plugin * fix TS error in infra plugin * exclude mote test and test until folders * uptime. do not import test code within prod code * expressions. do not import test code within prod code * data: export mocks from high level folder * task_manager: comply with es client typings * infra: remove unused enzyme_helpers * check_ts_project requires "include" key * ts_check should handle parent configs * all ts configs should extend base one * exclude test folders from plugins * update patterns to fix ts_check errors * Apply suggestions from code review Co-authored-by: Constance <[email protected]> * uptime: MountWithReduxProvider to test helpers Co-authored-by: Constance <[email protected]> Co-authored-by: Kibana Machine <[email protected]> * fix code plugin tsconfig Co-authored-by: Constance <[email protected]> Co-authored-by: Kibana Machine <[email protected]>
This reverts commit b6e582c.
…stic#96223) This reverts commit b6e582c.
…stic#96223) This reverts commit b6e582c.
…-nav * 'master' of github.com:elastic/kibana: (106 commits) [Lens] don't use eui variables for zindex (elastic#96117) Remove /src/legacy (elastic#95510) skip flaky suite (elastic#95899) [Dashboard] Fix Lens and TSVB chart tooltip positioning relative to global headers (elastic#94247) fixes a skipped management x-pack test (elastic#96178) [App Search] API logs: Add log detail flyout (elastic#96162) [tech-debt] Remove defunct opacity parameters from EUI shadow functions (elastic#96191) Add Input Controls project configuration (elastic#96238) [file upload] document file upload privileges and provide actionable UI when failures occur (elastic#95883) Revert "TS Incremental build exclude test files (elastic#95610)" (elastic#96223) [App Search] Added Sample Response section to Result Settings (elastic#95971) [Maps] Safe-erase text-field (elastic#94873) [RAC][Alert Triage][TGrid] Update the Alerts Table (TGrid) API to implement `renderCellValue` (elastic#96098) [Maps] Enable all zoom levels for all users (elastic#96093) Use plugin version in its publicPath (elastic#95945) [Enterprise Search] Expose core.chrome.setIsVisible for use in Workplace Search (elastic#95984) [Workplace Search] Add sub nav and fix rendering bugs in Personal dashboard (elastic#96100) [OBS]home page is showing incorrect value of APM throughput (tpm) (elastic#95991) [Observability] Exploratory View initial skeleton (elastic#94426) [KQL] Fixed styles of KQL textarea for the K8 theme (elastic#96190) ... # Conflicts: # x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/restore_snapshot.helpers.ts
Summary
part of #90281
Cold run before: 7m 25sec
Cold run after: 5m 20sec
This PR adds a centralized
tsconfig.projects.json
for all the plugins and excludes all the test files from being compiled when building TS project references. Because of this, bootstrap does less work: test and test utils aren't imported outside of your plugin code, so no need to calculate their public interfaces. Mocks are the only exception to this rule. We can add them back to the incremental builds as soon as we unify the naming schema formock
files.As a by-product of this work, we created a list of patterns for test file names. Establishing a repo-wide convention for test file names will allow us to have control over them (remove test files from the distributable version, for example) and understand whether changes in files might trigger downstream plugin rebuild (will be used by Bazel build toolchain).
Known problems:
script/type_check --project tsconfig.json
to initiate type check for plugin tests.scripts/check_ts_projects
slowed down on my laptop from 20sec. to 3min.5sec due to a huge number ofinclude
andexclude
patterns added in this PR. We're going to address the problem when we establish a convention for test-related files in order to reduce the number of pattern names.