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

fix: don't toggle cli cursor on non-TTY #7336

Merged
merged 2 commits into from
Feb 3, 2025

Conversation

AriPerkkio
Copy link
Member

Description

  • Logger should not toggle CLI cursor when not in TTY

Please don't delete this checklist! Before submitting the PR, please make sure you do the following:

  • It's really useful if your PR references an issue where it is discussed ahead of time. If the feature is substantial or introduces breaking changes without a discussion, PR might be closed.
  • Ideally, include a test that fails without this PR but passes with it.
  • Please, don't make changes to pnpm-lock.yaml unless you introduce a new test example.

Tests

  • Run the tests with pnpm test:ci.

Documentation

  • If you introduce new functionality, document it. You can run documentation with pnpm run docs command.

Changesets

  • Changes in changelog are generated from PR name. Please, make sure that it explains your changes in an understandable manner. Please, prefix changeset messages with feat:, fix:, perf:, docs:, or chore:.

@AriPerkkio AriPerkkio force-pushed the fix/dont-toggle-cursor-ci branch from 8389156 to f80a646 Compare January 24, 2025 08:39
@AriPerkkio AriPerkkio marked this pull request as ready for review January 24, 2025 08:40
Copy link

netlify bot commented Jan 24, 2025

Deploy Preview for vitest-dev ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit f80a646
🔍 Latest deploy log https://app.netlify.com/sites/vitest-dev/deploys/679351bcedc3310008181774
😎 Deploy Preview https://deploy-preview-7336--vitest-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 site configuration.

Copy link

netlify bot commented Jan 24, 2025

Deploy Preview for vitest-dev ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 95810dd
🔍 Latest deploy log https://app.netlify.com/sites/vitest-dev/deploys/6793520def699400083c543a
😎 Deploy Preview https://deploy-preview-7336--vitest-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 site configuration.

@@ -509,8 +509,6 @@ export class Vitest {
}

async collect(filters?: string[]): Promise<TestRunResult> {
this._onClose = []
Copy link
Contributor

Choose a reason for hiding this comment

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

Are these removals also the part of the fix?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, currently all onClose listeners were completely ignored for some reason.

constructor(
public readonly mode: VitestRunMode,
options: VitestOptions = {},
) {
this.logger = new Logger(this, options.stdout, options.stderr)

this.ctx.onClose(() => {
process.off('SIGINT', onExit)
process.off('SIGTERM', onExit)
process.off('exit', onExit)
cleanup()
})

async start(filters?: string[]): Promise<TestRunResult> {
this._onClose = []

This prevented cli cursor clearing. The added test case was failing without this.

Copy link
Contributor

@hi-ogawa hi-ogawa left a comment

Choose a reason for hiding this comment

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

Thanks!

@hi-ogawa hi-ogawa merged commit 3c8050e into vitest-dev:main Feb 3, 2025
13 checks passed
@AriPerkkio AriPerkkio deleted the fix/dont-toggle-cursor-ci branch February 3, 2025 05:41
renovate bot added a commit to mmkal/expect-type that referenced this pull request Feb 3, 2025
##### [v3.0.5](https://github.com/vitest-dev/vitest/releases/tag/v3.0.5)

##### 🚀 Features

-   **ui**: Insert message "no tests found" in ui - by [@DevJoaoLopes](https://github.com/DevJoaoLopes) in vitest-dev/vitest#7366 [<samp>(92da4)</samp>](vitest-dev/vitest@92da490bd)

##### 🐞 Bug Fixes

-   Validate websocket request - by [@hi-ogawa](https://github.com/hi-ogawa) and [@AriPerkkio](https://github.com/AriPerkkio) in vitest-dev/vitest#7317 [<samp>(191ef)</samp>](vitest-dev/vitest@191ef9e34)
-   Don't toggle cli cursor on non-TTY - by [@AriPerkkio](https://github.com/AriPerkkio) in vitest-dev/vitest#7336 [<samp>(3c805)</samp>](vitest-dev/vitest@3c8050e69)
-   **vite-node**: Differentiate file url with hash and query - by [@hi-ogawa](https://github.com/hi-ogawa)  in vitest-dev/vitest#7365 [<samp>(926ca)</samp>](vitest-dev/vitest@926ca9546)

##### [View changes on GitHub](vitest-dev/vitest@v3.0.4...v3.0.5)
renovate bot added a commit to mmkal/expect-type that referenced this pull request Feb 9, 2025
##### [v3.0.5](https://github.com/vitest-dev/vitest/releases/tag/v3.0.5)

This release includes security patches for:

-   [Remote Code Execution when accessing a malicious website while Vitest API server is listening | CVE-2025-24964](GHSA-9crc-q9x8-hgqq)

##### 🚀 Features

-   **ui**: Insert message "no tests found" in ui - by [@DevJoaoLopes](https://github.com/DevJoaoLopes) in vitest-dev/vitest#7366 [<samp>(92da4)</samp>](vitest-dev/vitest@92da490bd)

##### 🐞 Bug Fixes

-   Validate websocket request - by [@hi-ogawa](https://github.com/hi-ogawa) and [@AriPerkkio](https://github.com/AriPerkkio) in vitest-dev/vitest#7317 [<samp>(191ef)</samp>](vitest-dev/vitest@191ef9e34)
-   Don't toggle cli cursor on non-TTY - by [@AriPerkkio](https://github.com/AriPerkkio) in vitest-dev/vitest#7336 [<samp>(3c805)</samp>](vitest-dev/vitest@3c8050e69)
-   **vite-node**: Differentiate file url with hash and query - by [@hi-ogawa](https://github.com/hi-ogawa)  in vitest-dev/vitest#7365 [<samp>(926ca)</samp>](vitest-dev/vitest@926ca9546)

##### [View changes on GitHub](vitest-dev/vitest@v3.0.4...v3.0.5)
renovate bot added a commit to mmkal/expect-type that referenced this pull request Feb 12, 2025
##### [v3.0.5](https://github.com/vitest-dev/vitest/releases/tag/v3.0.5)

This release includes security patches for:

-   [Remote Code Execution when accessing a malicious website while Vitest API server is listening | CVE-2025-24964](GHSA-9crc-q9x8-hgqq)

##### 🚀 Features

-   **ui**: Insert message "no tests found" in ui - by [@DevJoaoLopes](https://github.com/DevJoaoLopes) in vitest-dev/vitest#7366 [<samp>(92da4)</samp>](vitest-dev/vitest@92da490bd)

##### 🐞 Bug Fixes

-   Validate websocket request - by [@hi-ogawa](https://github.com/hi-ogawa) and [@AriPerkkio](https://github.com/AriPerkkio) in vitest-dev/vitest#7317 [<samp>(191ef)</samp>](vitest-dev/vitest@191ef9e34)
-   Don't toggle cli cursor on non-TTY - by [@AriPerkkio](https://github.com/AriPerkkio) in vitest-dev/vitest#7336 [<samp>(3c805)</samp>](vitest-dev/vitest@3c8050e69)
-   **vite-node**: Differentiate file url with hash and query - by [@hi-ogawa](https://github.com/hi-ogawa)  in vitest-dev/vitest#7365 [<samp>(926ca)</samp>](vitest-dev/vitest@926ca9546)

##### [View changes on GitHub](vitest-dev/vitest@v3.0.4...v3.0.5)
renovate bot added a commit to mmkal/expect-type that referenced this pull request Feb 12, 2025
##### [v3.0.5](https://github.com/vitest-dev/vitest/releases/tag/v3.0.5)

This release includes security patches for:

-   [Remote Code Execution when accessing a malicious website while Vitest API server is listening | CVE-2025-24964](GHSA-9crc-q9x8-hgqq)

##### 🚀 Features

-   **ui**: Insert message "no tests found" in ui - by [@DevJoaoLopes](https://github.com/DevJoaoLopes) in vitest-dev/vitest#7366 [<samp>(92da4)</samp>](vitest-dev/vitest@92da490bd)

##### 🐞 Bug Fixes

-   Validate websocket request - by [@hi-ogawa](https://github.com/hi-ogawa) and [@AriPerkkio](https://github.com/AriPerkkio) in vitest-dev/vitest#7317 [<samp>(191ef)</samp>](vitest-dev/vitest@191ef9e34)
-   Don't toggle cli cursor on non-TTY - by [@AriPerkkio](https://github.com/AriPerkkio) in vitest-dev/vitest#7336 [<samp>(3c805)</samp>](vitest-dev/vitest@3c8050e69)
-   **vite-node**: Differentiate file url with hash and query - by [@hi-ogawa](https://github.com/hi-ogawa)  in vitest-dev/vitest#7365 [<samp>(926ca)</samp>](vitest-dev/vitest@926ca9546)

##### [View changes on GitHub](vitest-dev/vitest@v3.0.4...v3.0.5)
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.

3 participants