Skip to content

Premium Analytics: run JavaScript tests in CI - #50770

Merged
chihsuan merged 1 commit into
trunkfrom
chore/premium-analytics-enable-js-tests
Jul 27, 2026
Merged

chihsuan merged 1 commit into
trunkfrom
chore/premium-analytics-enable-js-tests

Conversation

@chihsuan

@chihsuan chihsuan commented Jul 23, 2026 •

Copy link
Copy Markdown
Member

Related to WOOA7S-1717

Proposed changes

Premium Analytics already has a JavaScript test suite, but the package does not expose Composer test-js / test-js-coverage scripts. The standard Jetpack JS test jobs therefore skip the package.

No change is needed in projects/packages/premium-analytics/tests/jest.config.cjs: since #50782 added the wp-build paths to tools/js-tools/jest/config.coverage.js, and config.base.js inherits collectCoverageFrom through config.node.js, the package picks them up already.

Related product discussion/links

Does this pull request change what data or activity we track or use?

No.

Testing instructions

  1. Run pnpm install --frozen-lockfile.
  2. Run pnpm jetpack test js packages/premium-analytics.
  3. Confirm all Premium Analytics JavaScript tests pass.
  4. Run pnpm jetpack test js-coverage -v packages/premium-analytics.
  5. Open the generated JS coverage report and confirm it includes the packages/, routes/, and widgets/ directories rather than being empty.
  6. Run the Composer monorepo update tool for the Premium Analytics, mu-wpcom-plugin, and wpcomsh plugin lockfiles.
  7. Confirm each reports Nothing to modify in lock file.

@chihsuan
chihsuan requested a review from a team July 23, 2026 09:26
@chihsuan
chihsuan requested a review from a team as a code owner July 23, 2026 09:26
@chihsuan chihsuan added Enhancement Changes to an existing feature — removing, adding, or changing parts of it [Status] Needs Review This PR is ready for review. labels Jul 23, 2026
@chihsuan chihsuan self-assigned this Jul 23, 2026
@github-actions

github-actions Bot commented Jul 23, 2026 •

Copy link
Copy Markdown
Contributor

Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.

  • To test on WoA, go to the Plugins menu on a WoA dev site. Click on the "Upload" button and follow the upgrade flow to be able to upload, install, and activate the Jetpack Beta plugin. Once the plugin is active, go to Jetpack > Jetpack Beta, select your plugin (WordPress.com Site Helper), and enable the chore/premium-analytics-enable-js-tests branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack-mu-wpcom-plugin chore/premium-analytics-enable-js-tests

Interested in more tips and information?

  • In your local development environment, use the jetpack rsync command to sync your changes to a WoA dev blog.
  • Read more about our development workflow here: PCYsg-eg0-p2
  • Figure out when your changes will be shipped to customers here: PCYsg-eg5-p2

@chihsuan
chihsuan force-pushed the chore/premium-analytics-enable-js-tests branch from 1ec4d6f to 9fb4708 Compare July 23, 2026 09:28
@jp-launch-control

jp-launch-control Bot commented Jul 23, 2026 •

Copy link
Copy Markdown

Code Coverage Summary

831 files are newly checked for coverage. Only the first 5 are listed here.

File Coverage
projects/packages/premium-analytics/packages/data/src/api/report-bookings-fetch/report-bookings-fetch.ts 0/1 (0.00%) 💔
projects/packages/premium-analytics/packages/data/src/api/report-conversion-rate-fetch/report-conversion-rate-fetch.ts 0/1 (0.00%) 💔
projects/packages/premium-analytics/packages/data/src/api/report-coupons-by-date-fetch/report-coupons-by-date-fetch.ts 0/1 (0.00%) 💔
projects/packages/premium-analytics/packages/data/src/api/report-coupons-fetch/report-coupons-fetch.ts 0/1 (0.00%) 💔
projects/packages/premium-analytics/packages/data/src/api/report-customers-by-date-fetch/report-customers-by-date-fetch.ts 0/1 (0.00%) 💔

Full summary · PHP report · JS report

If appropriate, add one of these labels to override the failing coverage check: Covered by non-unit tests Use to ignore the Code coverage requirement check when E2Es or other non-unit tests cover the code Coverage tests to be added later Use to ignore the Code coverage requirement check when tests will be added in a follow-up PR I don't care about code coverage for this PR Use this label to ignore the check for insufficient code coveage.

@github-actions

github-actions Bot commented Jul 23, 2026 •

Copy link
Copy Markdown
Contributor

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Review, ...).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


Follow this PR Review Process:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Make sure to test your changes on all platforms that it applies to. You're responsible for the quality of the code you ship.
  3. You can use GitHub's Reviewers functionality to request a review.
  4. When it's reviewed and merged, you will be pinged in Slack to deploy the changes to WordPress.com simple once the build is done.

If you have questions about anything, reach out in #jetpack-developers for guidance!


Mu Wpcom plugin:

  • Next scheduled release: WordPress.com Simple releases happen semi-continuously (PCYsg-Jjm-p2)

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.


Wpcomsh plugin:

  • Next scheduled release: Atomic deploys happen twice daily on weekdays (p9o2xV-2EN-p2)

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.


Premium Analytics plugin:

No scheduled milestone found for this plugin.

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.

],
"test-php": "@composer phpunit",
"test-php-coverage": "php -dpcov.directory=. ./vendor/bin/phpunit-select-config phpunit.#.xml.dist --coverage-php \"$COVERAGE_DIR/php.cov\"",
"test-js": "pnpm run test",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a test-js-coverage command too.

Suggested change
"test-js": "pnpm run test",
"test-js": "pnpm run test",
"test-js-coverage": "pnpm run test --coverage",

Then it looks like you'll also need to update projects/packages/premium-analytics/tests/jest.config.cjs to actually generate coverage, since the needed paths aren't in the default collectCoverageFrom.

Or maybe we should just add the additional wp-build paths to collectCoverageFrom in tools/js-tools/jest/config.coverage.js, since other projects will need them too.

P.S. You should be able to test the coverage locally with jetpack test js-coverage -v packages/premium-analytics.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or maybe we should just add the additional wp-build paths to collectCoverageFrom in tools/js-tools/jest/config.coverage.js, since other projects will need them too.

I went ahead and did that in #50782.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for #50782! @anomiex Added test-js-coverage. Rebased and confirmed the report now covers packages/, routes/, and widgets/.

@chihsuan
chihsuan force-pushed the chore/premium-analytics-enable-js-tests branch from 9fb4708 to 55ffd9c Compare July 27, 2026 03:11
@chihsuan
chihsuan merged commit f3a76f8 into trunk Jul 27, 2026
73 checks passed
@chihsuan
chihsuan deleted the chore/premium-analytics-enable-js-tests branch July 27, 2026 03:30
@github-actions github-actions Bot removed the [Status] Needs Review This PR is ready for review. label Jul 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Enhancement Changes to an existing feature — removing, adding, or changing parts of it [Package] Premium Analytics [Plugin] mu wpcom jetpack-mu-wpcom plugin [Plugin] Premium Analytics [Plugin] Wpcomsh

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants