-
Notifications
You must be signed in to change notification settings - Fork 35
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
fix: disable dump in preload #253
Conversation
WalkthroughThe changes in this pull request focus on enhancing the Changes
Possibly related PRs
Suggested reviewers
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
LGTM
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.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (1)
standalone/standalone/test/index.test.ts (1)
321-321
: Consider improving test clarity and type safety.
The test case name "should work" is too generic. Consider renaming it to better describe what's being tested, e.g., "should call dump exactly once during lifecycle".
The type assertion
as any
could be avoided by using a more type-safe approach.Consider this refactor:
- assert.equal((ModuleDescriptorDumper.dump as any).called, 1); + const dumpSpy = ModuleDescriptorDumper.dump as sinon.SinonSpy; + assert.equal(dumpSpy.callCount, 1, 'ModuleDescriptorDumper.dump should be called exactly once during lifecycle');
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (2)
- standalone/standalone/src/Runner.ts (1 hunks)
- standalone/standalone/test/index.test.ts (2 hunks)
🧰 Additional context used
🔇 Additional comments (2)
standalone/standalone/test/index.test.ts (2)
302-304
: LGTM!The spy setup is correctly placed in the
beforeEach
hook to ensure a clean state for each test, with proper cleanup usingmm.restore()
.
Line range hint
302-321
: Verify dump behavior when disabled.The PR title suggests fixing dump behavior in preload, but the tests don't explicitly verify the case when dump is disabled.
Consider adding a test case to verify that dump is not called when disabled:
it('should not call dump when disabled', async () => { await preLoad(fixturePath, { dump: false }); await main(fixturePath); const dumpSpy = ModuleDescriptorDumper.dump as sinon.SinonSpy; assert.equal(dumpSpy.callCount, 0, 'ModuleDescriptorDumper.dump should not be called when disabled'); });
v3.50.1 |
Checklist
npm test
passesAffected core subsystem(s)
Description of change
Summary by CodeRabbit
New Features
Bug Fixes
Tests