Skip to content

feat(vscode): support function names as test titles - #78

Merged
fi3ework merged 5 commits into
mainfrom
port-rstest-function-names
Sep 29, 2026
Merged

fi3ework merged 5 commits into
mainfrom
port-rstest-function-names

Conversation

@fi3ework

@fi3ework fi3ework commented Sep 29, 2026 •

Copy link
Copy Markdown
Member

Summary

Brings web-infra-dev/rstest#1908 (e1607861) to the Test Explorer: describe / test / it / suite can take a function or class as the title, which runs as name || '<anonymous>'.

This is a functional port. The first commit copies upstream's parser change as is; the second replaces its separate scope-analysis pass with a smaller resolver that runs inside the existing discovery walk and matches runtime names more often.

  • The Test Explorer item id and the run's testNamePattern come from the AST title, so it must equal the runtime name. Upstream falls back to unnamed test whenever it cannot prove a name, which never matches at run time.
  • Bindings are recorded in walk order with a scope stack, so shadowing and positional var redeclarations resolve as upstream specifies. Assignments update bindings, anonymous function and class expressions take the declared or assigned name, and named imports use the imported name.
  • An identifier this file never binds (a default import, a global, a declaration further down) uses the identifier text, and mod.Foo / obj.m use the property name. A name bound to an unknown value (parameter, destructuring, call result) stays unnamed test.
  • parserTest.ts shrinks from 433 lines (verbatim port) to 286. The divergence is recorded as adaptation 12 in packages/vscode/AGENTS.md; the tracked Rstest state advances to e1607861.

Discovery works with any core. Running function-titled tests needs the core half of #1908, which is not in a published @rstest/core release yet (latest is 0.12.2). Dependencies and the supported core range are unchanged.

Related Links

Checklist

  • Tests updated (or not required). Upstream's parser tests are ported and pass unchanged; the second commit only adds tests. A new parity test runs 20 snippets with stub describe / test and asserts the AST titles equal the real runtime names. The remaining gaps need evaluation (fn.bind(), a redefined name, a function passed as a parameter).
  • Documentation updated (or not required).

Port the VS Code extension changes from web-infra-dev/rstest#1908 (e1607861ac055c6f9b687f0fea3a7829f46ec14b).

Preserve local parser test paths and track post-0.12.2 main without changing dependencies.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-09-29T13:42:23.088507Z 5923900 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b9002c9971

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/vscode/src/stacks/test/parserTest.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 78240b05f7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/vscode/src/stacks/test/parserTest.ts Outdated
Comment thread packages/vscode/src/stacks/test/parserTest.ts
Comment thread packages/vscode/src/stacks/test/parserTest.ts

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a5c430ae6e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/vscode/src/stacks/test/parserTest.ts
Comment thread packages/vscode/src/stacks/test/parserTest.ts
Comment thread packages/vscode/src/stacks/test/parserTest.ts

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b843c9d150

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/vscode/src/stacks/test/parserTest.ts
Comment thread packages/vscode/src/stacks/test/parserTest.ts Outdated
Comment thread packages/vscode/src/stacks/test/parserTest.ts
Comment thread packages/vscode/src/stacks/test/parserTest.ts Outdated
Comment thread packages/vscode/src/stacks/test/parserTest.ts
@fi3ework
fi3ework merged commit 6b9bf56 into main Sep 29, 2026
5 of 6 checks passed
@fi3ework
fi3ework deleted the port-rstest-function-names branch September 29, 2026 14:04
@fi3ework fi3ework mentioned this pull request Sep 29, 2026
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.

1 participant