-
-
Notifications
You must be signed in to change notification settings - Fork 12
fix: can not rerun all tests when has command filter #502
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 fixes an issue where rerunning all tests doesn't work properly when command filters are applied in watch mode. The solution introduces a virtual entry mechanism to trigger recompilation and removes the isFirstRun
logic that was preventing proper test reruns.
- Removes
isFirstRun
tracking and related conditional logic - Implements a virtual entry system using
VirtualModulesPlugin
to trigger recompilation - Updates test mode determination to use
isFirstCompile
and aforceRerunOnce
flag
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
packages/core/src/core/runTests.ts | Removes isFirstRun logic and implements forceRerunOnce flag for triggering test reruns |
packages/core/src/core/rsbuild.ts | Removes isFirstRun tracking from Rsbuild stats |
packages/core/src/core/plugins/entry.ts | Adds virtual entry plugin with triggerRerun functionality using VirtualModulesPlugin |
examples/node/test/index1.test.ts | Adds new test file for testing the fix |
e2e/watch/shortcuts.test.ts | Updates test expectations and adds new test case for command filter scenario |
e2e/watch/index.test.ts | Updates test expectation from "Fully run test files for first run" to "Run all tests" |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
if (isWatch) { | ||
// FIXME: inspect config will retrigger initConfig |
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.
The FIXME comment indicates a known issue but lacks detail about the problem and potential solutions. Consider expanding this comment to explain what 'inspect config will retrigger initConfig' means and its implications.
// FIXME: inspect config will retrigger initConfig | |
// FIXME: When the configuration is inspected (e.g., by tools or plugins that read or modify the config), | |
// it will cause initConfig to be retriggered. This can lead to multiple initializations, | |
// which may result in redundant plugin setup, unexpected side effects, or performance issues. | |
// Ideally, we should detect and prevent repeated initialization, or refactor the config | |
// inspection logic to avoid retriggering initConfig. See related discussion in issue tracker | |
// or consider implementing a guard to ensure initConfig runs only once per session. |
Copilot uses AI. Check for mistakes.
virtualEntryPath, | ||
`export const virtualEntry = ${Date.now()}`, | ||
), | ||
); |
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.
Using Date.now()
as a timestamp in code generation could be problematic for deterministic builds or testing. Consider using a counter or hash-based approach instead.
); | |
[virtualEntryPath]: `export const virtualEntry = ${virtualEntryVersion}`, | |
}); | |
registerRerunTrigger(() => { | |
virtualEntryVersion += 1; | |
virtualModulesPlugin.writeModule( | |
virtualEntryPath, | |
`export const virtualEntry = ${virtualEntryVersion}`, | |
); | |
}); |
Copilot uses AI. Check for mistakes.
virtualEntryPath, | ||
`export const virtualEntry = ${Date.now()}`, | ||
), | ||
); |
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.
Same issue as above - using Date.now()
for virtual module content could cause non-deterministic behavior. Consider using a counter or hash-based approach.
); | |
[virtualEntryPath]: `export const virtualEntry = ${virtualEntryVersion}`, | |
}); | |
registerRerunTrigger(() => { | |
virtualEntryVersion += 1; | |
virtualModulesPlugin.writeModule( | |
virtualEntryPath, | |
`export const virtualEntry = ${virtualEntryVersion}`, | |
); | |
}); |
Copilot uses AI. Check for mistakes.
CI problem should be fixed by web-infra-dev/rspack#11460 |
Summary
use
virtual entry
+virtualModulesPlugin.writeModule
to trigger recompile.Related Links
Checklist