Skip to content

Migrate to Vitest#203

Merged
jacobp100 merged 1 commit intostyled-components:masterfrom
wojtekmaj:vitest
Mar 20, 2026
Merged

Migrate to Vitest#203
jacobp100 merged 1 commit intostyled-components:masterfrom
wojtekmaj:vitest

Conversation

@wojtekmaj
Copy link
Contributor

You can see a test run (taking advantage of WIP #202) working on my fork:

https://github.com/wojtekmaj/css-to-react-native/actions/runs/23322301252

Copilot AI review requested due to automatic review settings March 19, 2026 23:44
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR migrates the project’s test runner from Jest to Vitest, updating the test setup and dependencies accordingly.

Changes:

  • Replace Jest scripts/config with Vitest (package.json) and add a vitest.config.js.
  • Update test files to import Vitest APIs (expect, it, vi) instead of relying on Jest globals.
  • Refresh lockfile to remove Jest-related deps and add Vitest/Vite-related deps.

Reviewed changes

Copilot reviewed 23 out of 24 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
package.json Switch test scripts to Vitest and replace Jest dev dependency with Vitest.
vitest.config.js Add Vitest configuration (test inclusion + disable watch by default).
src/__tests__/*.js Update tests to use Vitest imports/APIs (e.g., vi.spyOn).
.eslintrc.js Remove Jest-specific ESLint override for test files.
yarn.lock Update dependency graph to reflect Jest removal and Vitest/Vite addition.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 8 to +10
"build": "rollup ./src/index.js -o index.js --f cjs && babel index.js -o index.js",
"test": "jest",
"test:watch": "jest --watch",
"test": "vitest",
"test:watch": "vitest --watch",
Copy link

Copilot AI Mar 19, 2026

Choose a reason for hiding this comment

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

yarn run test now runs vitest, but the repo’s CI config in .travis.yml runs Node 6/8/10/12. Vitest (and its Vite dependency) will not run on those Node versions, so CI will fail unless you also bump the CI Node matrix / declare an engines.node range (or pin Vitest to a version compatible with the supported Node versions).

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm assuming a change to GitHub Actions in another PR will get merged, solving this.

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you pull in latest and we'll see if it runs?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Absolutely! Done.

Copy link
Contributor

@jacobp100 jacobp100 left a comment

Choose a reason for hiding this comment

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

Nice! Thanks!

@jacobp100 jacobp100 merged commit 5bf10b1 into styled-components:master Mar 20, 2026
3 checks passed
@wojtekmaj wojtekmaj deleted the vitest branch March 20, 2026 09:40
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.

3 participants