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

stream.clearLine is not a function #1826

Closed
jdalton opened this issue Jun 1, 2018 · 7 comments · Fixed by #1840
Closed

stream.clearLine is not a function #1826

jdalton opened this issue Jun 1, 2018 · 7 comments · Fixed by #1840
Assignees
Labels
bug current functionality does not work as desired help wanted
Milestone

Comments

@jdalton
Copy link
Contributor

jdalton commented Jun 1, 2018

When upgrading to the beta5 I started hitting this error. It looks like it's erroring out in an Ora dep but may be related to the commit (linked in the previous sentence).

I'm on MacOS 10.13.4 using iTerm 3 with oh-my-zsh.

@novemberborn
Copy link
Member

Could you share an AVA project in which this occurs? Or is it any plain import test from 'ava'; test('test', t => t.pass())?

@novemberborn novemberborn added the bug current functionality does not work as desired label Jun 2, 2018
@jdalton
Copy link
Contributor Author

jdalton commented Jun 2, 2018

Yep!

It's a basic scenario test (all my AVA scenarios regardless of test will fail with beta5 though).
For example this one.

@novemberborn
Copy link
Member

Ah! It's failing when called through your test suite, right?

AVA must be assuming it has a TTY stream, while it doesn't. It's doing that check on oras behalf. We'll need to look at that detection when AVA is invoked through execa like you do here.

A workaround is to specify CI=1 as an environment variable, which supersedes all other TTY detection, and thus disables the spinner (which is rendered through ora).

@novemberborn novemberborn added this to the 1.0 milestone Jun 2, 2018
@jdalton
Copy link
Contributor Author

jdalton commented Jun 3, 2018

Thanks, the CI=1 workaround does work around it :)

@sylvainpolletvillard
Copy link

Same with beta.5.1 on Windows 10 x64:

- W:\github\postcss-grid-kiss\node_modules\ora\index.js:83
			this.stream.clearLine();
			            ^

TypeError: this.stream.clearLine is not a function
    at Ora.clear (W:\github\postcss-grid-kiss\node_modules\ora\index.js:83:16)
    at Ora.render (W:\github\postcss-grid-kiss\node_modules\ora\index.js:92:8)
    at ontimeout (timers.js:427:11)
    at tryOnTimeout (timers.js:289:5)
    at listOnTimeout (timers.js:252:5)
    at Timer.processTimers (timers.js:212:10)
npm ERR! Test failed.  See above for more details.

@novemberborn
Copy link
Member

@sylvainpolletvillard for now you can use --verbose (or the corresponding verbose config option) as a workaround.

The problem seems to be with this line:

enabled: true,

This disables ora's TTY detection, which is intentional. However it doesn't look like AVA is doing any detection on its own! This is an oversight on my part; I was planning further changes so may have forgotten to adjust this.

Changing that line to enabled: options.reportStream.isTTY should fix the issue.

If anybody wants to raise a PR for that change that'd be appreciated. I've been traveling recently and have more travel coming up soon.

@novemberborn novemberborn self-assigned this Jun 12, 2018
@novemberborn
Copy link
Member

Actually the mini reporter shouldn't be used if stdout is not a TTY.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug current functionality does not work as desired help wanted
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants