-
Notifications
You must be signed in to change notification settings - Fork 192
CI: clean up tests #667
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
CI: clean up tests #667
Conversation
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.
Pull Request Overview
A concise description of the purpose of the PR, followed by summarized bullets of changes
- Simplify integration tests by removing custom proxy setup (cloudflared/ngrok) and using the Stripe CLI for event forwarding
- Introduce a dedicated
tsconfig.build.json
to exclude test code from production builds - Update CI workflow and
package.json
scripts to align with the new test/build flow
Reviewed Changes
Copilot reviewed 43 out of 43 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
functions/tsconfig.json | Updated compiler options (target/lib, disabled source maps, strict checks) and included __tests__ |
functions/tsconfig.build.json | Added build-specific config extending base tsconfig and excluding tests |
functions/src/index.ts | Removed proxy code, added ignores for Stripe CLI integration |
functions/package.json | Updated build/test scripts to use tsconfig.build.json and emulator commands |
functions/jest.config.js | Configured ts-jest transform, global setup/teardown scripts |
functions/tests/… | Removed old proxy helpers, skipped failing tests |
.github/workflows/test.yml | Upgraded actions, installed Stripe CLI, consolidated test steps |
Comments suppressed due to low confidence (3)
firestore-stripe-payments/functions/tests/tests/webhookevents/subscriptions.test.ts:31
- This test is skipped (
test.skip
), reducing coverage for subscription webhook handling; re-enable and fix it to ensure critical flows are tested.
// TODO: Fix this test
firestore-stripe-payments/functions/tests/tests/portalLinks/createPortalLink.test.ts:32
- The
createPortalLink
test is marked skipped; addressing its failures and re-running it will help maintain coverage for portal link functionality.
// TODO: Fix this test
firestore-stripe-payments/functions/tests/tests/checkoutsessions/subscriptionCheckoutSessions.test.ts:34
- Subscription checkout session test is skipped, creating a gap in coverage; consider resolving the underlying issue and enabling the test.
// TODO: Fix this test
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.
Pull Request Overview
This PR streamlines the test configuration and CI process by removing legacy test setups based on cloudflared/ngrok and switching to the Stripe CLI and updated test frameworks. Key changes include removing outdated test configurations, updating build and test scripts in package.json, and marking several tests to be fixed in the future.
Reviewed Changes
Copilot reviewed 46 out of 46 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
functions/src/index.ts | Added numerous "// @ts-ignore" comments to bypass type-checking for Firestore operations. |
functions/package.json | Updated build/test scripts and dependency versions to use tsconfig.build.json and latest packages. |
functions/jest.teardown.js | Removed the legacy teardown file. |
functions/jest.config.js | Adjusted Jest configuration to use Node environment and new module mappings. |
functions/tests/tsconfig.json | Removed the redundant test tsconfig file. |
functions/tests/tests/webhookevents/subscriptions.test.ts | Marked a subscription webhook test as skipped with a TODO note. |
functions/tests/tests/portalLinks/createPortalLink.test.ts | Marked the portal link test as skipped with a TODO note. |
functions/tests/tests/checkoutsessions/subscriptionCheckoutSessions.test.ts | Marked a subscription checkout session test as skipped with a TODO note. |
functions/run-script.ts & run-script-watch.ts | Removed legacy test runners that depended on ngrok and cloudflared. |
functions/jest.setup.ts | Added a try-catch block to ensure critical environment variables are set. |
functions/jest.global-setup.ts & jest.global-teardown.ts | Introduced global setup/teardown for managing the Stripe CLI listener. |
functions/helpers/* | Removed helper files for setting up proxies and webhooks. |
extension.yaml & CHANGELOG.md | Updated extension version and changelog accordingly. |
.github/workflows/test.yml | Updated CI workflow to use updated actions and install the Stripe CLI. |
Comments suppressed due to low confidence (2)
firestore-stripe-payments/functions/tests/tests/webhookevents/subscriptions.test.ts:32
- Ensure that the skipped test is addressed and re-enabled to maintain complete test coverage for subscription webhook events.
test.skip('successfully creates a new subscription', async () => {
firestore-stripe-payments/functions/tests/tests/portalLinks/createPortalLink.test.ts:33
- Address the skipped portal link test to ensure that integration coverage is maintained once the underlying issues are resolved.
describe.skip('createPortalLink', () => {
@@ -30,6 +30,7 @@ import config from './config'; | |||
import { Timestamp } from 'firebase-admin/firestore'; | |||
|
|||
const apiVersion = '2022-11-15'; | |||
// @ts-ignore |
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.
Consider addressing the underlying type issues instead of using multiple '// @ts-ignore' comments. Updating the Firestore type definitions or using proper type casting could improve long-term maintainability and type safety.
Copilot uses AI. Check for mistakes.
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.
Out of scope for this PR. I just want to get the CI running, once that happens I will fix the type issues
firestore-stripe-payments/functions/__tests__/tests/portalLinks/createPortalLink.test.ts
Show resolved
Hide resolved
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
This PR removes the complicated test setup with cloudflared/ngrok etc, and just uses the Stripe CLI to tunnel for our integration tests.
We also switch to a dedicated tsconfig.build.json so that we're not bundling test stuff
Update: