Skip to content

test modules#3387

Draft
dreamwasp wants to merge 8 commits into
cass-gmt-1473-betafrom
cass-module-refactor-test
Draft

test modules#3387
dreamwasp wants to merge 8 commits into
cass-gmt-1473-betafrom
cass-module-refactor-test

Conversation

@dreamwasp

Copy link
Copy Markdown
Contributor

Overview

Converts all Gamut packages to native ESM ("type": "module") by adding exports maps, removing the legacy "module" field, and migrating config files to explicit .cjs extensions. Also extracts a shared Jest base config to eliminate duplication across packages, and re-exports typography variant utilities from Text.tsx.

Module / package.json changes

  • variance, gamut-icons, gamut-illustrations, gamut-patterns, gamut-styles, gamut-tests, gamut — adds "type": "module" and a proper "exports" map (import + types + default conditions); removes legacy "module" field; moves "types" into the exports map
  • jest.config.base.cjs (root) — extracts shared Jest configuration (coverage paths, reporters, moduleNameMapper) into a reusable factory consumed by per-package configs
  • Per-package babel.config.cjs, jest.config.cjs, and SVGR/plugin configs — renamed to .cjs so Node can load them as CommonJS in an ESM package context
  • gamut-icons/jest.config.cjs — adds cjs to moduleFileExtensions so mask-plugin.cjs resolves correctly under Jest

Typography

  • Text.tsx — re-exports typographyElementVariants, typographyStyleVariants, and typographyUtilities from the variants module; enables tree-shakeable imports of these constants downstream
  • Text.stories.tsx / tables.tsx (styleguide) — updated to consume the new re-exports

Snapshots / tests

  • gamut.test.ts.snap — updated to reflect 3 new typography exports
  • Form/utils.test.tsx.snap — updated snapshot drift (label attributes, pre-existing)

PR Checklist

  • Related to designs: N/A
  • Related to JIRA ticket: GMT-1473
  • Version plan added/updated
  • I have run this code to verify it works
  • This PR includes unit tests for the code change
  • This PR includes testing instructions for the code change
  • The alpha package of this PR is passing end-to-end tests in all relevant Codecademy repositories

Testing Instructions

  1. yarn nx run-many --target=build --all — all 7 packages should build cleanly with no CJS/ESM interop errors
  2. yarn nx run-many --target=test --all — all suites green; gamut-icons mask-plugin test should pass
  3. In a consuming app, import from @codecademy/gamut and verify tree-shaking works (bundle should not include unused components)
  4. Import typographyElementVariants directly from @codecademy/gamut and confirm the export resolves without error

PR Links and Envs

Repository PR Link
Monolith N/A
Mono N/A

@nx-cloud

nx-cloud Bot commented Jun 26, 2026

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit 7b8dad9


☁️ Nx Cloud last updated this comment at 2026-06-30 17:54:18 UTC

@nx-cloud

nx-cloud Bot commented Jun 26, 2026

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit d0b58cc


☁️ Nx Cloud last updated this comment at 2026-06-26 12:31:40 UTC

@codecov

codecov Bot commented Jun 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (cass-gmt-1473-beta@1275389). Learn more about missing BASE report.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@                  Coverage Diff                  @@
##             cass-gmt-1473-beta    #3387   +/-   ##
=====================================================
  Coverage                      ?   89.95%           
=====================================================
  Files                         ?      271           
  Lines                         ?     5697           
  Branches                      ?     1920           
=====================================================
  Hits                          ?     5125           
  Misses                        ?      564           
  Partials                      ?        8           
Flag Coverage Δ
pull-request 89.95% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Adds missing exports needed by consumers migrating away from /dist deep imports:
- variance: Scale type
- gamut/Button: ButtonBaseProps
- gamut/ButtonBase: ButtonSelectors
- gamut/Form: FormValues, formFieldPaddingStyles, formFieldStyles, conditionalStyles
- gamut/Markdown: HTMLToReactNode
- gamut/Menu: ListItem
- gamut-styles/variance: propConfig namespace
@codecademydev

Copy link
Copy Markdown
Collaborator

📬 Published Alpha Packages:

Package Version npm Diff
@codecademy/gamut 72.2.2-alpha.01c84d.0 npm diff
@codecademy/gamut-icons 9.57.10-alpha.01c84d.0 npm diff
@codecademy/gamut-illustrations 0.58.16-alpha.01c84d.0 npm diff
@codecademy/gamut-kit 3.0.6-alpha.01c84d.0 npm diff
@codecademy/gamut-patterns 0.10.35-alpha.01c84d.0 npm diff
@codecademy/gamut-styles 20.0.3-alpha.01c84d.0 npm diff
@codecademy/gamut-tests 6.0.6-alpha.01c84d.0 npm diff
@codecademy/variance 0.26.2-alpha.01c84d.0 npm diff
eslint-plugin-gamut 2.4.4-alpha.01c84d.0 npm diff

@github-actions

Copy link
Copy Markdown
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants