-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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 CI detection to avoid unwanted TTY behavior #5804
Conversation
What can we do with the code coverage getting a bit lower? I believe it's because we can't mock |
|
prettier/tests_integration/runPrettier.js Lines 71 to 73 in 18b03a3
|
Ah, didn't know about the issue when bundling |
Maybe off-topic but anyway … this seems to be the entire 'use strict'
module.exports = require('ci-info').isCI So … is it better to simply depend on |
Won't make a difference, |
Yeah, I didn’t mean it would help the tests. I guess I was mostly wondering if anybody else was surprised by the seemingly pointless wrapper package :) |
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.
Could you add a changelog item in CHANGELOG.unrelease.md
since the change is visible to users?
Thanks for the quick turnaround on this everyone! Just checking to see if this is scheduled for a release soon--we'd love this functionality! Thanks again! |
@@ -74,6 +76,9 @@ function runPrettier(dir, args, options) { | |||
jest.spyOn(require(thirdParty), "getStream").mockImplementation(() => ({ | |||
then: handler => handler(options.input || "") | |||
})); | |||
jest | |||
.spyOn(require(thirdParty), "isCI") | |||
.mockImplementation(() => process.env.CI); |
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.
Should this be mocked to a specific value so results are consistent?
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.
We want to test both CI and non-CI modes and I’m setting env: { CI: true } in a couple of integration tests to make sure the behavior changes.
Fixes #5801
(If changing the API or CLI) I’ve documented the changes I’ve made (in thedocs/
directory)CHANGELOG.unreleased.md
file following the template.