reports: Fix broken test suite and add CI test job - #225
Open
j0ntz wants to merge 2 commits into
Open
Conversation
util.test.ts imported createQuarterBuckets, movingAveDataSort, and sevenDayDataMerge from '../lib/util', which does not exist (lib/ is gitignored build output). The functions live in src/demo/clientUtil.ts, so the import resolved to undefined and crashed the whole suite at load. Point the import at '../src/demo/clientUtil', matching the repo convention of importing source directly under sucrase/register. The analytics fixtures (outputOne..Four in testData.json) still expected the stale keys 'appId' and 'pluginId', but getAnalytics and the asAnalyticsResult cleaner both use 'app' and 'partnerId'. Rename the fixture keys so they match the type contract and the function output.
The repo had no CI job that runs the tests, so PRs showed green while npm test failed. Add a GitHub Actions workflow that runs the mocha suite on every pull request. The suite loads src/demo/clientUtil.ts, which imports clientConfig.json (gitignored local dev config). The workflow generates it with defaults via the existing configure.ts (the same step scripts/prepare.sh runs) before running the tests, so the job is self-contained without needing the committed config.
j0ntz
force-pushed
the
jon/fix-reports-test-ci
branch
from
July 14, 2026 21:35
9d38751 to
89b314b
Compare
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CHANGELOG
Does this branch warrant an entry to the CHANGELOG?
Dependencies
none
Description
The mocha suite was broken on
masterand CI never caught it because no CI job ran the tests, so PRs stayed green whilenpm testfailed. This blockspr-land's mandatory local verification (it runsnpm test) on every edge-reports-server landing.Fix the broken suite
test/util.test.tsimportedcreateQuarterBuckets,movingAveDataSort, andsevenDayDataMergefrom../lib/util, which does not exist (lib/is gitignored build output). The functions live insrc/demo/clientUtil.ts, so the import resolved toundefinedand crashed the entire suite at load. Repointed the import at../src/demo/clientUtil, matching the repo convention of importing source directly undersucrase/register(e.g.test/analytics.test.tsimports../src/apiAnalytics).outputOne..Fourintest/testData.json) still expected the stale keypluginId, butgetAnalyticsand theasAnalyticsResultcleaner both usepartnerId. Renamed the fixture keys so they match the type contract and the function output.Add a CI test job
.github/workflows/test.ymlruns the mocha suite on everypull_request, so a failing suite now blocks the PR.src/demo/clientUtil.ts, which imports the gitignoredclientConfig.json. The workflow generates it with defaults via the existingsrc/bin/configure.ts(the same stepscripts/prepare.shruns) before running the tests, so the job is self-contained without needing the committed config.Result:
npm testpasses (31 passing, 1 pending — the pre-existingdescribe.skippedcreateQuarterBucketsblock).Asana: https://app.asana.com/0/1215088146871429/1216467990623863
Note
Low Risk
Changes are limited to tests, fixtures, CI workflow, and changelog with no production runtime behavior changes.
Overview
Restores a green
npm testrun and adds GitHub Actions coverage so broken suites can’t slip through on green PRs.Test fixes:
test/util.test.tsnow imports util helpers fromsrc/demo/clientUtilinstead of the non-existentlib/utilbuild path. Analytics golden data intest/testData.jsonrenames expectedpluginIdfields topartnerIdso fixtures matchgetAnalyticsoutput.CI: New
.github/workflows/test.ymlruns on every pull request—checkout, Node 18,npm install --ignore-scripts, generateclientConfig.jsonviasrc/bin/configure.ts, thennpm test.CHANGELOG documents the CI job and test repair.
Reviewed by Cursor Bugbot for commit 89b314b. Bugbot is set up for automated code reviews on this repo. Configure here.