fix(core): declare the dist-only test target in six remaining jest configs - #11486
fix(core): declare the dist-only test target in six remaining jest configs#11486igorlukanin wants to merge 1 commit into
Conversation
|
Claude finished @igorlukanin's task in 2m 1s —— View job Review: approve — config-only, claims verified. 0 blocking, 0 medium, 3 low (nits).Full review — checklist, verification of the PR's claims, and the three nits
What I verified independently
AssessmentThe change is correct and minimal, and the reasoning for not hoisting into The test plan is unusually rigorous for a config change ( Nits (all non-blocking)
One editorial note on the description, not the code: the sentence "following the same shape and comment already used by the packages fixed earlier in this sweep" then lists the same six packages this PR changes. Presumably it should name the earlier PR's packages ( Nothing here blocks merge; the remaining checkbox (CI) is the only gate. |
| // Suites run from the compiled output — the sources under test/ have no | ||
| // transform and cannot execute. | ||
| testMatch: [ | ||
| '<rootDir>/dist/test/**/*.{test,spec}.{ts,js}' | ||
| ], |
There was a problem hiding this comment.
Nit (non-blocking): ts in the extension alternation is dead weight for a dist/ glob — the compiled output is .js only (and .d.ts can't match *.{test,spec}.{ts,js}, as the PR description notes). It does match the convention already used by cubejs-server/cubejs-testing/cubejs-testing-drivers, so keeping it for consistency is defensible; just flagging that the ts branch can never fire here.
Also worth noting the new configs use dist/test/**/* while the pre-existing dist-pointing configs use single-level dist/test/*. The **/ form is strictly more permissive and there are no subdirectories today, so no behaviour difference — but the sweep now leaves two shapes in the tree. Picking one (probably **/) and normalising the older four in a follow-up would make the convention greppable.
Codecov Report✅ All modified and coverable lines are covered by tests.
Additional details and impacted files@@ Coverage Diff @@
## master #11486 +/- ##
===========================================
- Coverage 79.46% 59.10% -20.36%
===========================================
Files 480 223 -257
Lines 98810 17891 -80919
Branches 3636 3636
===========================================
- Hits 78515 10575 -67940
+ Misses 19774 6795 -12979
Partials 521 521
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Summary
jest.base.config.jsdeclares nopresetand notransform, so the TypeScript under a package'stest/cannot execute — those packages are meant to run their suites from compiled output indist/test/. Six packages extended it without declaring atestMatch, so jest's default pattern collected the compiled output and the untransformable sources, and a barejestin the package directory died withSyntaxError: Cannot use import statement outside a module. The path argument in each package's npm script (jest --verbose dist/test,jest dist/test/*.js, …) was the only thing keeping the suites runnable.testMatch, following the same shape and comment already used by the packages fixed earlier in this sweep:cubejs-bigquery-driver,cubejs-druid-driver,cubejs-duckdb-driver,cubejs-mysql-driver,cubejs-databricks-jdbc-driver,cubejs-backend-maven.jest.base.config.js, deliberately: several packages keep integration suites next to their unit ones and split the two with the path argument in their scripts, so a hoisted pattern would enroll suites needing live warehouse credentials in packages that pass no such argument.Config-only; no source or test files change.
Why this is behaviour-preserving
Every existing script already passes a
dist/testpath argument, so its selection is unchanged. The only invocation whose behaviour changes is a barejesttyped by hand in a package directory — which fails today and works after.Nothing in CI invokes these six packages' own test scripts: the per-package suites run through
yarn lerna run … unit, and none of the six declares a script namedunit(four have onlyintegration:*; the others areunit-testsandunit:disabled-for-ci). The driver matrix exercisestesting-drivers, not these scripts.Test plan
jest --listTestsdiffed per (package, script) pair, before vs. after: 8 lines removed, 0 added — the removals are exactly the untransformabletest/*.tsentries that a barejestused to collect in each of the six.jestincubejs-druid-driver:2 failed, 2 skipped, 2 of 4 total(SyntaxError: Cannot use import statement outside a module,Missing semicolon) →2 skipped, 0 of 2 total, no failures.cubejs-druid-driver's in-process unit suite (dist/test/druid-query.test.js) runs green through the new config: 2 passed.testMatch;eslintclean.MySqlDriverPool.disabled.tsandmysql.db.runner.tsdon't match*.{test,spec}.*but were never collected before either (the first is dormant, the second a helper imported by the suite)..d.tsand.js.mapfiles can't match the pattern. No package among the six has subdirectories underdist/test, and none setsroots,testRegex, ortestPathIgnorePatternsthat would interact with the added key.Two of the six suites can't execute on a dev machine for reasons predating this change:
cubejs-databricks-jdbc-driverneeds the optionaljavanative module, andcubejs-backend-maven's suite downloads a Maven distribution from a URL that now 404s (hence its script name,unit:disabled-for-ci). Both fail identically with and without this change.