Skip to content

Conversation

@gagik
Copy link
Contributor

@gagik gagik commented Nov 27, 2025

This accomplishes my long term dream of being able to debug and run mongosh tests right from inside VSCode.
It does so through a multi-root workspace which you can open by navigating to mongosh.code-workspace and clicking open.

After installing the recommended https://marketplace.visualstudio.com/items?itemName=hbenl.vscode-mocha-test-adapter you should be able to run tests in UI and debugging!

Some have their quirks i.e. async-rewriter2 needs experimental vm mode etc. but overall I have been using this for a few days and feel much more productive!
Screenshot 2025-11-27 at 3 15 24 PM

@gagik gagik requested a review from a team as a code owner November 27, 2025 14:19
Copilot AI review requested due to automatic review settings November 27, 2025 14:19
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 adds VSCode multi-root workspace configuration to enable running and debugging mongosh tests directly within VSCode using the Mocha Test Explorer extension. The changes refactor test configurations from inline package.json scripts to separate .mocharc.json files for better organization and IDE integration.

  • Extracted Mocha test configurations from package.json scripts into dedicated .mocharc.json files across all packages
  • Created a multi-root workspace file (mongosh.code-workspace) that includes all packages as separate folders
  • Added a dummy test file to support the Mocha Test Explorer functionality

Reviewed changes

Copilot reviewed 53 out of 54 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
mongosh.code-workspace Multi-root workspace configuration listing all packages and Mocha Test Explorer settings
testing/dummy.spec.ts Placeholder test file for Mocha Test Explorer compatibility
packages/*/package.json Simplified test scripts to use mocha command
packages/*/.mocharc.json New configuration files containing previously inline Mocha options
.mocharc.json Root-level Mocha configuration pointing to dummy test
package.json Added chai-as-promised dependency
packages/browser-repl/src/iframe-runtime/iframe-runtime.spec.ts Added type assertions for improved type safety

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

Copy link
Collaborator

@addaleax addaleax 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! I think Copilot's comments are correct, plus one suggestion re: maintaining the workspace config file

let runtime;
let serviceProvider;
let runtime: IframeRuntime;
let serviceProvider: ServiceProvider;
Copy link
Collaborator

Choose a reason for hiding this comment

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

💙

{
"name": "📦 @mongosh/browser-repl",
"path": "packages/browser-repl"
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should ./scripts/sort-workspaces also update this file?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

great idea

@gagik gagik added the no-title-validation Skips validation of PR titles (conventional commit adherence + JIRA ticket inclusion) label Nov 27, 2025
@gagik gagik changed the title chore: add mongosh.code-workspace for Mocha Test Explorer chore: add ability to run tests in VSCode UI with Mocha Test Explorer Nov 27, 2025
Copy link
Contributor

@lerouxb lerouxb left a comment

Choose a reason for hiding this comment

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

gimme gimme gimme

@gagik gagik force-pushed the gagik/add-mongosh-workspace branch from dd0e0e7 to 8edcbd8 Compare November 27, 2025 16:20
@gagik gagik merged commit 80d3e53 into main Nov 28, 2025
155 checks passed
@gagik gagik deleted the gagik/add-mongosh-workspace branch November 28, 2025 12:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-title-validation Skips validation of PR titles (conventional commit adherence + JIRA ticket inclusion)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants