Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

@claneo
Copy link
Contributor

@claneo claneo commented Nov 27, 2025

Changes Summary

  1. core
    1. Support pass logger to default reporter
    2. Add two new reporter hooks: onTestSuiteStart and onTestSuiteResult
    3. Support match test case with testNamePattern exactly (This is still a temporary solution that cannot handle cases where the name contains >. I plan to support matching by arrays instead of strings in the future.)
    4. Stop stringify actual and expected value in error object
  2. vscode extension
    1. New features, see below
    2. Simplified updateFromContents, now ancestors stack is poped when exit astnode
    3. Enqueued all test items before run them

New Features

  1. Realtime test result
  2. Pipe default reporter to test results panel
  3. Place error message at right location
  4. Display error stack if exist
  5. Display expected and actual value if it is a mismatch error
  6. Support update snapshot if it is a snapshot mismatch error
20251127-095853.mp4

Problems

  1. Sourcemap does not work if debugger attached, causes error stack is wrong
  2. Is it ok to import core source code from vscode extension directly?

Related Links

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

@netlify
Copy link

netlify bot commented Nov 27, 2025

Deploy Preview for rstest-dev ready!

Name Link
🔨 Latest commit 7cfaa6e
🔍 Latest deploy log https://app.netlify.com/projects/rstest-dev/deploys/69302f56e7675f000840af9d
😎 Deploy Preview https://deploy-preview-720--rstest-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@claneo claneo force-pushed the vscode-progress branch 3 times, most recently from eb7033a to fc55505 Compare November 28, 2025 14:44
@claneo claneo marked this pull request as ready for review November 28, 2025 14:49
Copilot AI review requested due to automatic review settings November 28, 2025 14:49
Copilot finished reviewing on behalf of claneo November 28, 2025 14:53
Copy link
Contributor

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 implements real-time test run progress reporting for the VSCode extension, enabling features like live test results, error location highlighting, and snapshot updating. The changes span both the core testing framework (adding new reporter hooks onTestSuiteStart and onTestSuiteResult) and the VSCode extension (implementing a comprehensive test run reporter with error formatting and stack trace parsing).

Key changes include:

  • Added suite-level reporter hooks to track test suite execution lifecycle
  • Implemented exact test name pattern matching with configurable delimiter
  • Refactored VSCode extension to report progress in real-time via new TestRunReporter class
  • Enhanced error reporting with actual/expected value formatting using pretty-format
  • Added support for updating snapshots directly from VSCode test results

Reviewed changes

Copilot reviewed 43 out of 44 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
packages/core/src/types/reporter.ts Added onTestSuiteStart and onTestSuiteResult hooks, logger option for default reporter
packages/core/src/types/testSuite.ts Extracted TestSuiteInfo type, added expected/actual fields to FormattedError
packages/core/src/types/config.ts Added exact flag for test name pattern matching
packages/core/src/runtime/runner/runner.ts Implemented suite result tracking and hook invocations
packages/core/src/runtime/runner/task.ts Added exact matching logic for test name patterns
packages/core/src/utils/error.ts Made getSourcemap parameter optional
packages/vscode/src/testRunReporter.ts New class implementing real-time test progress reporting with error formatting
packages/vscode/src/worker/reporter.ts Refactored to use new progress-based reporter architecture
packages/vscode/src/worker/index.ts Updated to pass reporter and logger instances to rstest
packages/vscode/src/master.ts Added onTestProgress method to handle worker progress events
packages/vscode/src/testTree.ts Simplified test tree parsing with exit callbacks, removed old result handling
packages/vscode/src/extension.ts Added snapshot update command and improved test run workflow
packages/vscode/package.json Added pretty-format dependency and snapshot update command configuration
packages/vscode/tests/suite/progress.test.ts New integration test for progress reporting functionality
e2e/reporter/rstest.customReporterConfig.ts Added suite hooks to test reporter
pnpm-lock.yaml Updated dependencies (@rslib/core, @rsbuild/core, @rspack versions)
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

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

"strict": true,
"skipLibCheck": true
"skipLibCheck": true,
"types": ["../core/src/env.d.ts"]
Copy link

Copilot AI Nov 28, 2025

Choose a reason for hiding this comment

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

The types compiler option expects an array of package names or paths to type definition files, not a path to a .d.ts file. This should likely be removed and handled differently, or you should use typeRoots instead. The current configuration will likely not work as intended.

Positive FeedbackNegative Feedback
Copilot uses AI. Check for mistakes.
packages/vscode/src/master.ts Outdated Show resolved Hide resolved
packages/vscode/tests/suite/progress.test.ts Outdated Show resolved Hide resolved
packages/vscode/tests/suite/progress.test.ts Outdated Show resolved Hide resolved
packages/core/src/types/config.ts Outdated Show resolved Hide resolved
packages/vscode/src/testRunReporter.ts Outdated Show resolved Hide resolved
Comment on lines +11 to +12
import { ROOT_SUITE_NAME } from '../../core/src/utils/constants';
import { parseErrorStacktrace } from '../../core/src/utils/error';
Copy link

Copilot AI Nov 28, 2025

Choose a reason for hiding this comment

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

This import uses a relative path '../../core/src/utils/constants' to access core package source directly. While the PR description mentions this as a known concern ("Is it ok to import core source code from vscode extension directly?"), this creates tight coupling and build order dependencies. Consider either:

  1. Exporting these constants from @rstest/core package's main entry point
  2. Duplicating the constant in the vscode extension
  3. Creating a shared constants package

The same applies to the import on line 12 (parseErrorStacktrace).

Positive FeedbackNegative Feedback
Copilot uses AI. Check for mistakes.
Comment on lines +206 to +215
async onTestProgress<T extends keyof TestRunReporter>(
runId: string,
event: T,
param: Parameters<NonNullable<TestRunReporter[T]>>[0],
) {
const reporter = this.testRunReporters.get(runId);
// @ts-expect-error
Copy link

Copilot AI Nov 28, 2025

Choose a reason for hiding this comment

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

The @ts-expect-error comment suppresses type checking without explanation. Consider adding a comment explaining why this is necessary, or better yet, fixing the type issue. The problem likely stems from TypeScript's inability to ensure param matches the expected parameter type for the specific event method.

Suggested change
async onTestProgress<T extends keyof TestRunReporter>(
runId: string,
event: T,
param: Parameters<NonNullable<TestRunReporter[T]>>[0],
) {
const reporter = this.testRunReporters.get(runId);
// @ts-expect-error
// Map each method name to its first parameter type
type TestRunReporterEventParams = {
[K in keyof TestRunReporter]: TestRunReporter[K] extends (arg: infer P, ...args: any[]) => any ? P : never;
};
async onTestProgress<T extends keyof TestRunReporter>(
runId: string,
event: T,
param: TestRunReporterEventParams[T],
) {
const reporter = this.testRunReporters.get(runId);

Positive FeedbackNegative Feedback
Copilot uses AI. Check for mistakes.
export default defineConfig({
setupFiles: ['../scripts/rstest.setup.ts'],
testTimeout: process.env.CI ? 10_000 : 5_000,
testTimeout: 10_000,
Copy link

Copilot AI Nov 28, 2025

Choose a reason for hiding this comment

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

The change removes the conditional timeout based on CI environment (process.env.CI ? 10_000 : 5_000) and sets a fixed 10-second timeout. This may slow down local development since tests will now wait up to 10 seconds even in non-CI environments. Consider keeping the conditional logic to maintain faster feedback in local development.

Suggested change
testTimeout: 10_000,
testTimeout: process.env.CI ? 10_000 : 5_000,

Positive FeedbackNegative Feedback
Copilot uses AI. Check for mistakes.
packages/core/src/types/config.ts Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.