Skip to content

fix: inaccurate build time in watch mode#659

Merged
9aoy merged 1 commit intomainfrom
watch-build-time
Oct 29, 2025
Merged

fix: inaccurate build time in watch mode#659
9aoy merged 1 commit intomainfrom
watch-build-time

Conversation

@9aoy
Copy link
Copy Markdown
Collaborator

@9aoy 9aoy commented Oct 29, 2025

Summary

fix inaccurate build time in watch mode.

Related Links

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

Copilot AI review requested due to automatic review settings October 29, 2025 09:48
@netlify
Copy link
Copy Markdown

netlify bot commented Oct 29, 2025

Deploy Preview for rstest-dev ready!

Name Link
🔨 Latest commit 7549b0f
🔍 Latest deploy log https://app.netlify.com/projects/rstest-dev/deploys/6901e2e1cc46000008b55b4a
😎 Deploy Preview https://deploy-preview-659--rstest-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Copy Markdown
Contributor

Copilot AI left a 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 refactors how the build start time is tracked for performance metrics. Instead of capturing buildStart inside the run function, it is now passed as a parameter, allowing accurate build time measurement in watch mode by capturing the timestamp when the build compilation starts.

  • Moved buildStart from being initialized inside run to being an optional parameter
  • Added logic to capture buildStart in onBeforeDevCompile and pass it to run in watch mode
  • Reset buildStart to undefined after each test run to prevent reuse
Comments suppressed due to low confidence (5)

packages/core/src/core/runTests.ts:345

  • The runAll callback does not pass buildStart, which will cause it to default to Date.now() at the time of the call. This makes the build time calculation inaccurate since no actual build occurs during this manual run. Consider documenting this behavior or passing buildStart: testStart to ensure buildTime reflects zero or near-zero when no build occurred.
            await run({ mode: 'all' });

packages/core/src/core/runTests.ts:361

  • The runWithTestNamePattern callback does not pass buildStart, which will cause it to default to Date.now() at the time of the call. This makes the build time calculation inaccurate since no actual build occurs during this manual run. Consider passing buildStart: testStart or documenting that build time will be near-zero for these manual reruns.
            await run();

packages/core/src/core/runTests.ts:396

  • The runWithFileFilters callback does not pass buildStart, which will cause it to default to Date.now() at the time of the call. This makes the build time calculation inaccurate since no actual build occurs during this manual run. Consider passing buildStart: testStart or documenting that build time will be near-zero for these manual reruns.
            await run({ fileFilters: entries });

packages/core/src/core/runTests.ts:417

  • The runFailedTests callback does not pass buildStart, which will cause it to default to Date.now() at the time of the call. This makes the build time calculation inaccurate since no actual build occurs during this manual run. Consider passing buildStart: testStart or documenting that build time will be near-zero for these manual reruns.
            await run({ fileFilters: failedTests, mode: 'all' });

packages/core/src/core/runTests.ts:439

  • The updateSnapshot callback does not pass buildStart, which will cause it to default to Date.now() at the time of the call. This makes the build time calculation inaccurate since no actual build occurs during this manual run. Consider passing buildStart: testStart or documenting that build time will be near-zero for these manual reruns.
            await run({ fileFilters: failedTests });

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@9aoy 9aoy merged commit f83c7ef into main Oct 29, 2025
23 checks passed
@9aoy 9aoy deleted the watch-build-time branch October 29, 2025 10:42
@9aoy 9aoy mentioned this pull request Nov 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants