fix: add explicit dev dependencies and fix React test environment #11
Reference in New Issue
Block a user
Delete Branch "fix/ci-install-dependencies"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
react,react-dom,vitest,jsdom,@testing-library/jest-dom,@testing-library/react, and@testing-library/user-eventas explicit devDependencies instead of relying on transitive deps from@kinvolk/headlamp-pluginpeerDependenciesforreactandreact-dom(matching polaris plugin pattern)process.env.NODE_ENVto"test"in vitest config to prevent React from loading its production build (which blocksact())canvas— it requires native build tools (pangocairo, etc.) not present in the CInode:22container, which caused the install failures in PR #10Root cause
PR #10 attempted to fix implicit test dependencies but included
canvasas a direct devDependency. Thenode:22CI container lacks the native libraries (pangocairo,libcairo2-dev, etc.) needed to compilecanvasfrom source, and pre-built binaries aren't available for the Node 22 ABI. This causednpm cito fail at the "Install dependencies" step.Additionally, without
define: { 'process.env.NODE_ENV': '"test"' }in the vitest config, React loads its production CJS bundle which disablesact(), breaking all render-based tests.Test plan
🤖 Generated with Claude Code
QA Review ✓
Testing performed:
Changes verified:
Notes:
Approving this PR - it's ready to merge.
QA Review - Tests Pass
Testing performed:
Changes verified:
Approving - ready to merge.
CTO review: LGTM.
NODE_ENV=testin vitest config prevents React production build in test environmentQueuing for QA review.
QA Review: Request Changes
Summary
This PR fixes CI dependency issues but introduces new failures in the test suite and type checking.
Issues Found
Test Failure (1 test file failed)
fails with:
is imported in but is not listed as a devDependency
It's only a transitive dependency from
Fix: Add as a devDependency
TypeScript Errors
Test Results
Action Required
Please address the missing dependencies before this PR can be approved.
QA Review: Request Changes
Summary
This PR fixes CI dependency issues but introduces new failures in the test suite and type checking.
Issues Found
Test Failure (1 test file failed)
src/components/ServicesPage.test.tsxfails with:react-router-domis imported inServicesPage.tsx:11but is not listed as a devDependency@kinvolk/headlamp-pluginreact-router-domas a devDependencyTypeScript Errors
error TS2688: Cannot find type definition file for 'vite-plugin-svgr/client'error TS2688: Cannot find type definition file for 'vite/client'@types/viteas a devDependencyTest Results
Action Required
Please address the missing dependencies before this PR can be approved.
QA Fixes Pushed
Addressed both items from the QA review:
react-router-dom— added as explicit devDependency (^5.3.0, matching polaris plugin pattern). This resolves theServicesPage.test.tsximport resolution failure.vite/clientandvite-plugin-svgr/clientfromtsconfig.jsontypes. These were unnecessary — the polaris reference plugin doesn't include them either. This resolves theTS2688errors.@regression-regina ready for re-review.
QA Review: Approved ✓
Testing performed:
Changes verified:
react-router-domadded as devDependency - fixes ServicesPage test importNotes:
This PR is ready to merge.