Skip to content
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

feat: Add DEC mode 2026 support (Synchronized Output) to Jest #15008

Merged
merged 5 commits into from
Apr 17, 2024

Conversation

haze
Copy link
Contributor

@haze haze commented Apr 4, 2024

Summary

This PR introduces support for DEC private mode 2026, also known as Synchronized Output, to DefaultReporter. The Synchronized Output mode is a terminal feature that helps mitigate screen tearing effects that can occur when the terminal is rendering output while the application is still writing to the screen.

Two new methods have been added to the DefaultReporter:

  • __beginSynchronizedUpdate: This method sends the control sequence to enable Synchronized Output mode to the terminal.
  • __endSynchronizedUpdate: This method sends the control sequence to disable Synchronized Output mode to the terminal.

These methods are called before and after the reporter updates the status, respectively. By doing this, we ensure that the terminal renders a consistent state of the screen for each status update, even if we're writing to the screen frequently.

Read more: https://gist.github.com/christianparpart/d8a62cc1ab659194337d73e399004036

Why / Test plan

Here's Jest output before (notice the flickering):

jest.output.bad.mp4

Here's Jest output after:

jest.output.good.mp4

haze added 2 commits April 4, 2024 19:42
This commit introduces support for DEC private mode 2026, also known as Synchronized Output, to DefaultReporter. The Synchronized Output mode is a terminal feature that helps mitigate screen tearing effects that can occur when the terminal is rendering output while the application is still writing to the screen.

Two new methods have been added to the DefaultReporter:

- `__beginSynchronizedUpdate`: This method sends the control sequence to enable Synchronized Output mode to the terminal.
- `__endSynchronizedUpdate`: This method sends the control sequence to disable Synchronized Output mode to the terminal.

These methods are called before and after the reporter updates the status, respectively. By doing this, we ensure that the terminal renders a consistent state of the screen for each status update, even if we're writing to the screen frequently.

Read more: https://gist.github.com/christianparpart/d8a62cc1ab659194337d73e399004036
Copy link

linux-foundation-easycla bot commented Apr 4, 2024

CLA Signed

The committers listed above are authorized under a signed CLA.

Copy link

netlify bot commented Apr 4, 2024

Deploy Preview for jestjs ready!

Name Link
🔨 Latest commit 4eaf56e
🔍 Latest deploy log https://app.netlify.com/sites/jestjs/deploys/661fcf8cd232f00008d4da29
😎 Deploy Preview https://deploy-preview-15008--jestjs.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 site configuration.

Copy link
Member

@SimenB SimenB left a comment

Choose a reason for hiding this comment

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

ooooh, this is awesome! mind adding a changelog entry? and signing the CLA 🙂

@@ -120,6 +124,26 @@ export default class DefaultReporter extends BaseReporter {
}
}

protected __beginSynchronizedUpdate(): void {
Copy link
Member

Choose a reason for hiding this comment

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

put this in BaseReporter?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is it intentional that we check _globalConfig every time we have a write operation?

@haze
Copy link
Contributor Author

haze commented Apr 5, 2024

and signing the CLA 🙂

I'm waiting on hearing from the legal team at Netflix on how to proceed here. I don't anticipate this taking too long though! Thanks for your patience.

@haze
Copy link
Contributor Author

haze commented Apr 17, 2024

@SimenB CLA Signed!

Copy link
Member

@SimenB SimenB left a comment

Choose a reason for hiding this comment

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

awesome stuff, thanks!

@SimenB SimenB enabled auto-merge (squash) April 17, 2024 13:34
@SimenB SimenB merged commit fd3cd87 into jestjs:main Apr 17, 2024
73 checks passed
@SimenB
Copy link
Member

SimenB commented May 12, 2024

https://github.com/jestjs/jest/releases/tag/v30.0.0-alpha.4

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.

None yet

2 participants