-
-
Notifications
You must be signed in to change notification settings - Fork 13
feat: collect test location #739
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
base: main
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for rstest-dev ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this 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 test location tracking functionality to rstest by collecting source locations via error stack traces, enabling the list command to display location information and adding a new reporter hook for test file readiness.
- Introduces
Locationtype and integrates location tracking throughout test collection pipeline - Adds
--printLocationCLI flag to list command and includes test suites in list output - Adds
onTestFileReadyreporter hook that fires after test collection but before execution
Reviewed changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/core/src/types/worker.ts | Adds onTestFileReady RPC method for worker-to-server communication |
| packages/core/src/types/testSuite.ts | Defines Location type and adds location fields to test types; introduces TestInfo and TestSuiteInfo types |
| packages/core/src/types/runner.ts | Adds onTestFileReady hook to RunnerHooks interface |
| packages/core/src/types/reporter.ts | Adds onTestFileReady hook to Reporter interface |
| packages/core/src/types/core.ts | Adds printLocation option to ListCommandOptions and changes return type to ListCommandResult[] |
| packages/core/src/runtime/worker/index.ts | Invokes onTestFileReady RPC after test collection |
| packages/core/src/runtime/runner/runtime.ts | Implements getLocation() function using stacktrace-parser and integrates location capture into test/describe APIs |
| packages/core/src/runtime/runner/runner.ts | Adds type: 'case' to TestCaseInfo construction |
| packages/core/src/runtime/runner/index.ts | Maps Test objects to TestInfo and invokes onTestFileReady hook |
| packages/core/src/pool/index.ts | Propagates onTestFileReady calls to all reporters |
| packages/core/src/core/listTests.ts | Implements location printing and includes test suites in output |
| packages/core/src/core/index.ts | Updates listTests return type |
| packages/core/src/cli/commands.ts | Adds --printLocation CLI option |
| e2e/rstest.config.ts | Changes test timeout from conditional to fixed 10s |
| e2e/reporter/rstest.customReporterConfig.ts | Implements onTestFileReady in test reporter |
| e2e/reporter/index.test.ts | Adds assertion for onTestFileReady hook invocation |
| e2e/list/json.test.ts | Updates test expectations to include suites and locations |
| e2e/list/index.test.ts | Updates test expectations and adds location printing test |
| e2e/list/fixtures/c.test.ts | Adds test fixture covering various describe/it API patterns |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
7f93633 to
9dc14b2
Compare
Summary
listcommand--printLocationonTestFileReady, this will be used in vscode extension laterThe location maybe inaccurate because rspack transpiled
describe()call to(0,rstest_core.describe)(), so the location got from error stack is the end of the comma expression. Chained method is not affected expectdescribe.forwhich is tranpiled todescribe["for"].Related Links
Checklist