Skip to content

feat: show tests with .only and .skip modifiers in Test Explorer#36

Closed
Copilot wants to merge 4 commits intomasterfrom
copilot/show-it-only-and-it-skip-tests
Closed

feat: show tests with .only and .skip modifiers in Test Explorer#36
Copilot wants to merge 4 commits intomasterfrom
copilot/show-it-only-and-it-skip-tests

Conversation

Copy link
Contributor

Copilot AI commented Jan 21, 2026

Implementation Complete ✅

Successfully implemented support for displaying and properly handling .only and .skip test modifiers in the VS Code Test Explorer.

Changes Made

  • Update ParsedTest interface to include optional modifier field ('only' | 'skip' | undefined)
  • Modify testParser to detect MemberExpression calls (it.only, it.skip, test.only, test.skip, etc.)
  • Add comprehensive tests for parsing .only and .skip modifiers (11 new tests)
  • Update testController to display tests with modifiers using tags/descriptions
  • Prevent execution of tests with .skip modifier
  • Optimize recursive skipping logic
  • Verify changes work correctly with test examples
  • Run full test suite to ensure no regressions (145 tests passing)
  • Code review completed and addressed
  • Security scan completed - no vulnerabilities

Fix for .skip Tests

Tests with .skip modifier are now properly skipped during execution:

  • Test runner checks for .skip modifier before execution
  • Skipped tests are marked as skipped without running
  • Descendant tests in skipped containers are also marked as skipped (optimized)
  • Prevents confusing output where tests are both executed and reported as skipped

Visual Indicators

Tests with modifiers now appear with clear visual indicators:

  • Tests marked with .only show as "test name (only)" with an "only" tag
  • Tests marked with .skip show as "test name (skip)" with a "skip" tag and are not executed

Testing

  • ✅ 145 tests passing (11 new + 134 existing)
  • ✅ TypeScript compilation succeeds
  • ✅ ESLint passes with no warnings
  • ✅ Code review: addressed all feedback
  • ✅ Security scan: no vulnerabilities
Original prompt

This section details on the original issue you should resolve

<issue_title>it.only and it.skip tests disappear from test list</issue_title>
<issue_description>Tests marked with it.only or it.skip are not shown in the extension's test list and cannot be run via the extension.

Current behaviour

Tests with .only or .skip modifiers are completely hidden from the test explorer.

Problem

This can cause confusion when a developer accidentally leaves an it.only in their code - they won't notice the test is missing from the list.

Suggested behaviour

Show it.only and it.skip tests in the list but visually indicate their status (e.g., greyed out, with an icon, or a different styling) so it's clear these tests have modifiers applied.

This makes it obvious when tests have been isolated or skipped, even though the extension already allows users to isolate tests to run.


Feedback from Kevin Paxton</issue_description>

<agent_instructions>ensure commits are in semantic release format</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: mtharrison <916064+mtharrison@users.noreply.github.com>
Copilot AI changed the title [WIP] Update test explorer to show it.only and it.skip tests feat: show tests with .only and .skip modifiers in Test Explorer Jan 21, 2026
Copilot AI requested a review from mtharrison January 21, 2026 17:38
@mtharrison
Copy link
Owner

@copilot with this change it.skip still runs, it should not run and should have a separate indicator than the green tick to indicate it is skipped. Ensure text indices are not broken because of this.

If runing:

describe('MyModule', () => {
  it('normal test', () => {
    expect(true).to.be.true();
  }); // Appears as: "normal test"
  // eslint-disable-next-line no-only-tests/no-only-tests
  it.only('focused test', () => {
    expect({ a: 1 }).to.include({ b: 1 });
  }); // Appears as: "focused test (only)" [tagged]
  it.skip('skipped test', () => {
    expect(false).to.be.true();
  }); // Appears as: "skipped test (skip)" [tagged]
});

We get surprising output:

  -x-

Failed tests:

  2) MyModule focused test:

      Expected { a: 1 } to include { b: 1 }

      at /Users/matt/Developer/wave/workbooks/test/constants.ts:15:25


1 of 1 tests failed (2 skipped)
Test duration: 4 ms
Assertions count: 1 (verbosity: 1.00)

2 tests marked skipped but only one is skipped

Tests with .skip modifier are now properly skipped during execution instead of being run. When a test has a .skip modifier, the test runner now:
- Marks the test as skipped without executing it
- Recursively skips all descendant tests if it's a container (describe/experiment)

This prevents the confusing behavior where lab would report tests as skipped even though the extension tried to run them.

Co-authored-by: mtharrison <916064+mtharrison@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 21, 2026

@copilot with this change it.skip still runs, it should not run and should have a separate indicator than the green tick to indicate it is skipped. Ensure text indices are not broken because of this.
...

Fixed in commit c928cf6. Tests with .skip modifier are now properly skipped without execution. The extension now:

  1. Checks for .skip modifier before running tests
  2. Marks skipped tests immediately without invoking lab
  3. Recursively skips all children if it's a container (describe.skip/experiment.skip)

This eliminates the confusing output where lab reported "2 skipped" when only 1 test had .skip. Skipped tests now show the skip indicator in Test Explorer and are never executed.

Only recurse into child nodes that have children of their own, avoiding unnecessary function calls on leaf nodes.

Co-authored-by: mtharrison <916064+mtharrison@users.noreply.github.com>
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.

it.only and it.skip tests disappear from test list

2 participants