Skip to content

chore: migrate core (autocomplete) tests to vitest #6063

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

Merged
merged 18 commits into from
Jun 17, 2025

Conversation

uinstinct
Copy link
Contributor

@uinstinct uinstinct commented Jun 10, 2025

Description

As part of our migration of tests inside core from jest to vitest, this PR:

  • migrates the tests in the autocomplete directory.
  • introduces vitest.global-setup and vitest.setup

related to CON-2030

Checklist

  • [] I've read the contributing guide
  • [] The relevant docs, if any, have been updated or created
  • [] The relevant tests, if any, have been updated or created

Screenshots

[ For visual changes, include screenshots. Screen recordings are particularly helpful, and appreciated! ]

Tests

[ What tests were added or updated to ensure the changes work as expected? ]

@uinstinct uinstinct requested a review from a team as a code owner June 10, 2025 07:03
@uinstinct uinstinct requested review from Patrick-Erichsen and removed request for a team June 10, 2025 07:03
Copy link

cubic-dev-ai bot commented Jun 10, 2025

Your cubic subscription is currently inactive. Please reactivate your subscription to receive AI reviews and use cubic.

Copy link

netlify bot commented Jun 10, 2025

Deploy Preview for continuedev canceled.

Name Link
🔨 Latest commit 33d3f5a
🔍 Latest deploy log https://app.netlify.com/projects/continuedev/deploys/6850fa3af9093b0008f9bad7

@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Jun 10, 2025
@@ -46,7 +46,7 @@ export async function testRootPathContext(

// Copy the folder to the test directory
const folderPath = path.join(
__dirname,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

vitest gets the actual __dirname where the file resides while for jest __dirname is equivalent process.cwd()

for example, in this case, __dirname for vitest would be /users/myuser/continue/core/autocomplete/context/root-path-context/test and for jest it would be /users/myuser/continue/core

Hence used process.cwd()

@uinstinct uinstinct changed the title [chore] migrate core (autocomplete) tests to vitest chore: migrate core (autocomplete) tests to vitest Jun 10, 2025
Copy link
Collaborator

@tomasz-stefaniak tomasz-stefaniak left a comment

Choose a reason for hiding this comment

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

Looks good, I added some comments regarding __dirname and vitest config.

@github-project-automation github-project-automation bot moved this from Todo to In Progress in Issues and PRs Jun 12, 2025
Copy link

recurseml bot commented Jun 13, 2025

⚠️ Only 5 files will be analyzed due to processing limits.

@@ -1,3 +1,4 @@
import { describe, test } from "vitest";
Copy link

Choose a reason for hiding this comment

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

Missing required 'expect' import for test assertions. While 'describe' and 'test' are imported, the test file uses assertions that require the 'expect' function from Vitest. Without importing 'expect', the test assertions will fail at runtime. The import should be modified to include 'expect': import { describe, test, expect } from "vitest";

📚 Relevant Docs


React with 👍 to tell me that this comment was useful, or 👎 if not (and I'll stop posting more comments like this in the future)

Copy link

recurseml bot commented Jun 13, 2025

😱 Found 1 issue. Time to roll up your sleeves! 😱

Comment on lines 14 to 15
"config/yaml/LocalPlatformClient.test.ts",
"autocomplete/**/*.test.ts",
Copy link
Collaborator

Choose a reason for hiding this comment

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

As we spoke on the huddle earlier today, let's only include ["**/*.vitest.ts"] and update test names accordingly instead.

Copy link
Collaborator

@tomasz-stefaniak tomasz-stefaniak left a comment

Choose a reason for hiding this comment

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

Left a comment ⬆️

Copy link
Collaborator

@tomasz-stefaniak tomasz-stefaniak left a comment

Choose a reason for hiding this comment

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

Looks great, thanks for making the changes!

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jun 17, 2025
@tomasz-stefaniak tomasz-stefaniak merged commit fd3b19b into continuedev:main Jun 17, 2025
35 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in Issues and PRs Jun 17, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Jun 17, 2025
@uinstinct uinstinct deleted the core-vitest/autocomplete branch June 18, 2025 02:45
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm This PR has been approved by a maintainer size:L This PR changes 100-499 lines, ignoring generated files.
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants