Skip to content
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

Refactor jest configuration #2796

Merged
merged 4 commits into from
Feb 12, 2024
Merged

Refactor jest configuration #2796

merged 4 commits into from
Feb 12, 2024

Conversation

carbonrobot
Copy link
Contributor

@carbonrobot carbonrobot commented Feb 9, 2024

Refactor the jest configuration to avoid cyclic dependencies in packages and support Windows platforms for running jest.

Changes

There are a couple major changes here that cause a lot of files to be changed.

  1. Upgrades jest to the latest version and uses the built in TS runner for jest testing. This gives better support for IDE tooling that runs jest tests in real time as you code and the jest --watch function.

  2. Adds jest config shells to every package. This avoids problems with paths so all configs are now relative to the package itself. This also fixes jest so that it now runs in all operation systems. 🪟

  3. The sync-pkgs-wireit-helpers.js was updated to run the jest command directly without invoking nps scripts. There is also a fix that ensures all deps are included in the wireit dependency array and removes the self-referencing dependency.

Running pnpm sync then updates all package.json files with the new changes.

  1. Fixes all test imports so they are relative to the file (./chart.ts) instead of virtual (victory-charts) and removes all circular devDependencies from all packages package.json files

Misc Changes

  • Removes the test/node/victory.test.js as that functionality is tested in packages/victory as a snapshot.
  • Removes victory-native from the tsconfig sync script, it has a custom config now

Testing Steps

$ pnpm i
$ pnpm clean:cache
$ pnpm clean:build
$ pnpm build
$ pnpm jest

Copy link

changeset-bot bot commented Feb 9, 2024

⚠️ No Changeset found

Latest commit: 46d65e6

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

vercel bot commented Feb 9, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
victory ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 12, 2024 2:41pm

@ryan-roemer
Copy link
Member

I've pulled the branch and I'm running locally.

Copy link
Member

@Burnett2k Burnett2k left a comment

Choose a reason for hiding this comment

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

I was able to pull down the branch on my M1 Mac, run the commands listed in the description, and receive successes on all of them. All the jest tests passed as well.

Copy link
Contributor

@KenanYusuf KenanYusuf left a comment

Choose a reason for hiding this comment

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

I am getting the following error and test failures for the victory-selection-container and victory-errorbar packages:

    src/selection-helpers.test.tsx:7:28 - error TS2339: Property 'scaleLinear' does not exist on type 'typeof import(".../victory/packages/victory-selection-container/node_modules/victory-vendor/d3-scale")'.

    7 const scale = { x: d3Scale.scaleLinear(), y: d3Scale.scaleLinear() };

When I add victory-vendor as a dependency for both of those packages, it fixes the error and test failures.

@carbonrobot carbonrobot merged commit 7bb575a into main Feb 12, 2024
9 checks passed
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.

4 participants