fix(golden-layout): exclude test files from build output#2642
fix(golden-layout): exclude test files from build output#2642mofojed merged 1 commit intodeephaven:mainfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2642 +/- ##
=======================================
Coverage 49.77% 49.77%
=======================================
Files 774 774
Lines 43846 43860 +14
Branches 11286 11291 +5
=======================================
+ Hits 21825 21832 +7
- Misses 21975 22010 +35
+ Partials 46 18 -28
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR aims to prevent packages/golden-layout test sources and test-only utilities from being included in build artifacts (notably dist/), so they don’t end up in the published package output.
Changes:
- Expanded
tsconfig.jsonexclusions to omitsrc/__tests__,src/test-utils, and*.test.*files. - Added a Babel CLI
--ignorelist to skip compiling test and test-utility sources intodist/.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
packages/golden-layout/tsconfig.json |
Excludes test directories/files from TypeScript project inputs. |
packages/golden-layout/package.json |
Updates Babel build command to ignore tests/test-utils during compilation to dist/. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| "build": "cross-env NODE_ENV=production run-p build:*", | ||
| "build:sass": "sass --embed-sources --load-path=../../node_modules --style=compressed ./src:./dist ./scss:./css", | ||
| "build:babel": "babel ./src --out-dir ./dist --extensions \".ts,.js,.tsx,.jsx\" --source-maps --root-mode upward" | ||
| "build:babel": "babel ./src --out-dir ./dist --extensions \".ts,.js,.tsx,.jsx\" --source-maps --root-mode upward --ignore \"./src/__tests__,./src/test-utils,./src/**/*.test.*\"" |
There was a problem hiding this comment.
The --ignore patterns are likely not matching the paths Babel sees (Babel’s shared babel.config.js uses globs like **/__mocks__/* and a .test.* regex, i.e. no leading ./ and directory patterns include wildcards). As written, patterns like ./src/test-utils may not exclude files like src/test-utils/testUtils.ts, which would keep test utilities in the published dist/. Consider switching to glob patterns that match subpaths (e.g. src/test-utils/** and src/__tests__/** or **/test-utils/**) and dropping the redundant .test.* ignore since it’s already handled in babel.config.js.
| "build:babel": "babel ./src --out-dir ./dist --extensions \".ts,.js,.tsx,.jsx\" --source-maps --root-mode upward --ignore \"./src/__tests__,./src/test-utils,./src/**/*.test.*\"" | |
| "build:babel": "babel ./src --out-dir ./dist --extensions \".ts,.js,.tsx,.jsx\" --source-maps --root-mode upward --ignore \"src/__tests__/**,src/test-utils/**\"" |
180519b to
257cbe0
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Noticed the test files were being included in golden-layout input. We shouldn't do that.